diff options
author | Antoine Beaupré <anarcat@koumbit.org> | 2012-08-09 02:03:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-25 10:45:16 -0400 |
commit | a12dc958839ee684fc5755c371a9b3c5a917e88c (patch) | |
tree | c2c8b09b55b8eff0b2851c64eff3fef5034e3dcb /IkiWiki | |
parent | 5fa605beada972eb32ca781ee420cc69e1732e20 (diff) | |
download | ikiwiki-a12dc958839ee684fc5755c371a9b3c5a917e88c.tar ikiwiki-a12dc958839ee684fc5755c371a9b3c5a917e88c.tar.gz |
osm: optimization: do not create duplicate styles
(cherry picked from commit 9d550817ca546d1dd30a21cebad6093d1f3bacad)
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/osm.pm | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm index f570f4032..466006cbf 100644 --- a/IkiWiki/Plugin/osm.pm +++ b/IkiWiki/Plugin/osm.pm @@ -365,17 +365,23 @@ sub writekml($;$) { $writer->startTag("Document"); # first pass: get the icons + my %tags_map = (); # keep track of tags seen foreach my $name (keys %{$waypoints{$map}}) { my %options = %{$waypoints{$map}{$name}}; - $writer->startTag("Style", id => $options{tag}); - $writer->startTag("IconStyle"); - $writer->startTag("Icon"); - $writer->startTag("href"); - $writer->characters($options{icon}); - $writer->endTag(); - $writer->endTag(); - $writer->endTag(); - $writer->endTag(); + if (!$tags_map{$options{tag}}) { + debug("found new style " . $options{tag}); + $tags_map{$options{tag}} = (); + $writer->startTag("Style", id => $options{tag}); + $writer->startTag("IconStyle"); + $writer->startTag("Icon"); + $writer->startTag("href"); + $writer->characters($options{icon}); + $writer->endTag(); + $writer->endTag(); + $writer->endTag(); + $writer->endTag(); + } + $tags_map{$options{tag}}{$name} = \%options; } foreach my $name (keys %{$waypoints{$map}}) { |