source: subversion/applications/editors/josm/i18n/convwms.pl @ 26224

Last change on this file since 26224 was 25613, checked in by Dirk Stoecker, 9 years ago

fix wms and validator

File size: 891 bytes
Line 
1#! /usr/bin/perl -w
2
3# Written by Dirk Stöcker <openstreetmap@dstoecker.de>
4# Public domain, no rights reserved.
5
6use strict;
7use LWP::Simple;
8
9my $item;
10my $comment = 0;
11
12# This is a simple conversion and in no way a complete XML parser
13# but it works with a default Perl installation
14
15# Print a header to write valid Java code.  No line break,
16# so that the input and output line numbers will match.
17print "class trans_wms { void tr(String s){} void f() {";
18
19my @lines;
20if($ARGV[0] && $ARGV[0] =~ /^http:\/\//)
21{
22  @lines = split("\r?\n", get($ARGV[0]));
23}
24else
25{
26  @lines = <>;
27}
28
29for my $line (@lines)
30{
31  $line =~ s/\r//g;
32  chomp($line);
33  if($line =~ /^#(.*)$/)
34  {
35    print "/* $1 */\n";
36  }
37  elsif($line =~ /^$/)
38  {
39    print "\n";
40  }
41  elsif($line =~ /^(.*?);(.*?);(.*)$/)
42  {
43    print "/* $3 */ tr(\"$2\");\n";
44  }
45  else
46  {
47    print "/* $line */\n";
48  }
49}
50
51print "}}\n";
Note: See TracBrowser for help on using the repository browser.