optimise gettext calls
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 14 Aug 2009 01:04:19 +0000 (21:04 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 14 Aug 2009 01:04:19 +0000 (21:04 -0400)
IkiWiki/Plugin/brokenlinks.pm
IkiWiki/Plugin/inline.pm

index cf8f25281585fff56ee8b11dd9c58bdfc64b793c..f8d44892b79f6e0f30612e08d949b2ebf69a35d2 100644 (file)
@@ -28,9 +28,9 @@ sub preprocess (@) {
        add_depends($params{page}, $params{pages});
        
        my %broken;
+       my $discussion=gettext("Discussion");
        foreach my $page (pagespec_match_list([keys %links],
                        $params{pages}, location => $params{page})) {
-               my $discussion=gettext("Discussion");
                my %seen;
                foreach my $link (@{$links{$page}}) {
                        next if $seen{$link};
index 04ad6ed2308526b47666ca2fe8db1ab1c199b6b4..2fbb45e02674929adfb8443df588afec2ee6116f 100644 (file)
@@ -348,6 +348,9 @@ sub preprocess_inline (@) {
                }
                my $template=HTML::Template->new(@params) unless $raw;
        
+               my $discussionlink=lc(gettext("Discussion"))
+                       if $config{discussion};
+
                foreach my $page (@list) {
                        my $file = $pagesources{$page};
                        my $type = pagetype($file);
@@ -371,7 +374,6 @@ sub preprocess_inline (@) {
                                        my $file = $pagesources{$page};
                                        my $type = pagetype($file);
                                        if ($config{discussion}) {
-                                               my $discussionlink=lc(gettext("Discussion"));
                                                if ($page !~ /.*\/\Q$discussionlink\E$/ &&
                                                    (length $config{cgiurl} ||
                                                     exists $links{$page."/".$discussionlink})) {