| Last change
 on this file since 27094 was             23091, checked in by stoecker, 15 years ago | 
        
          | 
fix order of comments for better translators support
 | 
        
          | File size:
            704 bytes | 
      
      
| Line |  | 
|---|
| 1 | #! /usr/bin/perl -w | 
|---|
| 2 |  | 
|---|
| 3 | # Written by Dirk Stöcker <openstreetmap@dstoecker.de> | 
|---|
| 4 | # Public domain, no rights reserved. | 
|---|
| 5 |  | 
|---|
| 6 | use strict; | 
|---|
| 7 |  | 
|---|
| 8 | # This is a simple conversion and in no way a complete XML parser | 
|---|
| 9 | # but it works with a default Perl installation | 
|---|
| 10 |  | 
|---|
| 11 | # Print a header to write valid Java code.  No line break, | 
|---|
| 12 | # so that the input and output line numbers will match. | 
|---|
| 13 | print "class trans_style { void tr(String s){} void f() {"; | 
|---|
| 14 |  | 
|---|
| 15 | while(my $line = <>) | 
|---|
| 16 | { | 
|---|
| 17 | chomp($line); | 
|---|
| 18 | if($line =~ /<rules\s+name=(".*?")/) | 
|---|
| 19 | { | 
|---|
| 20 | print "/* mappaint style named $1 */ tr($1);\n"; | 
|---|
| 21 | } | 
|---|
| 22 | elsif($line =~ /colour="([^"]+)#/) | 
|---|
| 23 | { | 
|---|
| 24 | print "/* color $1 */ tr(\"$1\");\n"; | 
|---|
| 25 | } | 
|---|
| 26 | else | 
|---|
| 27 | { | 
|---|
| 28 | print "/* $line */\n"; | 
|---|
| 29 | } | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | print "}}\n"; | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.