source: osm/applications/editors/josm/i18n/convwiki.pl@ 34389

Last change on this file since 34389 was 33841, checked in by stoecker, 7 years ago

fix recent parsing errors

File size: 1.4 KB
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;
8use open qw/:std :encoding(utf8)/;
9
10my $filename;
11my $dir = $ARGV[1] || "build/josmfiles";
12print "$ARGV[0]\n";
13if($ARGV[0] && $ARGV[0] =~ /^https?:\/\//)
14{
15 $filename = $ARGV[2] || "build/josmfiles.zip";
16 my $content = get($ARGV[0]);
17 die "Couldn't get $ARGV[0]" unless defined $content;
18 open FILE,">:raw",$filename or die "Could not open $filename";
19 print FILE $content;
20 close FILE
21}
22else
23{
24 $filename = $ARGV[0];
25}
26system "rm -rf $dir/";
27print "Extracting to $dir\n";
28mkdir $dir;
29system "unzip -q -d $dir $filename";
30foreach my $name (glob "$dir/*")
31{
32 if($name =~ /^(.*?)([^\/]+-preset\.xml)$/)
33 {
34 system "mv \"$name\" \"$name.orig\"";
35 my ($path, $xmlname) = ($1, $2);
36 my $res = `xmllint --format --schema ../core/data/tagging-preset.xsd \"$name.orig\" --encode utf-8 --output \"$name\" 2>&1`;
37 print $res if $res !~ /\.orig validates/;
38 system "perl convpreset.pl \"$name\" >\"${path}trans_$xmlname\"";
39 unlink "$name.orig";
40 }
41 elsif($name =~ /^(.*?)([^\/]+-style\.xml$)/)
42 {
43 system "perl convstyle.pl \"$name\" >${1}trans_$2";
44 }
45 elsif($name =~ /^(.*?)([^\/]+\.mapcss)$/)
46 {
47 system "perl convcss.pl \"$name\" >${1}trans_$2";
48 }
49 else
50 {
51 die "Unknown file type \"$name\".";
52 }
53 unlink $name;
54}
Note: See TracBrowser for help on using the repository browser.