aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-08-02 12:50:40 +0200
committerintrigeri <intrigeri@boum.org>2010-08-02 12:52:46 +0200
commitd8a99e97ad6b02b5a5c7666dc2e98f1d6bc50550 (patch)
tree4f21fd01b4b7a67d939e83a9d668ff0ea1475eb7 /IkiWiki
parentd9f0b56a412799feafe041b088db327a4d373c6e (diff)
downloadikiwiki-d8a99e97ad6b02b5a5c7666dc2e98f1d6bc50550.tar
ikiwiki-d8a99e97ad6b02b5a5c7666dc2e98f1d6bc50550.tar.gz
po: avoid bringing duplicates into %links
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/po.pm23
1 files changed, 12 insertions, 11 deletions
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index 6b708e850..610ae664b 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -234,15 +234,15 @@ sub scan (@) {
my $content=$params{content};
if (istranslation($page)) {
- foreach my $destpage (@{$links{$page}}) {
- if (istranslatable($destpage)) {
- # replace the occurence of $destpage in $links{$page}
- for (my $i=0; $i<@{$links{$page}}; $i++) {
- if (@{$links{$page}}[$i] eq $destpage) {
- @{$links{$page}}[$i] = $destpage . '.' . lang($page);
- last;
- }
- }
+ # replace the occurence of $destpage in $links{$page}
+ my @orig_links = @{$links{$page}};
+ $links{$page} = [];
+ foreach my $destpage (@orig_links) {
+ if (istranslatedto($destpage, lang($page))) {
+ add_link($page, $destpage . '.' . lang($page));
+ }
+ else {
+ add_link($page, $destpage);
}
}
}
@@ -251,8 +251,9 @@ sub scan (@) {
if (istranslatable($destpage)) {
# make sure any destpage's translations has
# $page in its backlinks
- push @{$links{$page}},
- values %{otherlanguages_pages($destpage)};
+ foreach my $link (values %{otherlanguages_pages($destpage)}) {
+ add_link($page, $link);
+ }
}
}
}