]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Render.pm
* Rebuilding on upgrade to this version is recommended.
[ikiwiki.git] / IkiWiki / Render.pm
index 854d5105ebecc793e97d2c3f3a32c8ad3b3e0131..5bc7f6ebba91c4ebbb68e4a8d9a511082a47c3a8 100644 (file)
@@ -8,8 +8,8 @@ use File::Spec;
 use IkiWiki;
 
 sub linkify ($$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
 
        $content =~ s{(\\?)$config{wiki_link_regexp}}{
                $2 ? ( $1 ? "[[$2|$3]]" : htmllink($page, titlepage($3), 0, 0, pagetitle($2)))
@@ -152,8 +152,8 @@ sub globlist_merge ($$) { #{{{
 } #}}}
 
 sub genpage ($$$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
        my $mtime=shift;
 
        my $title=pagetitle(basename($page));
@@ -177,7 +177,12 @@ sub genpage ($$$) { #{{{
        if ($config{discussion}) {
                $template->param(discussionlink => htmllink($page, "Discussion", 1, 1));
        }
-       $template->param(headercontent => $config{headercontent});
+
+       if (exists $hooks{pagetemplate}) {
+               foreach my $id (keys %{$hooks{pagetemplate}}) {
+                       $hooks{pagetemplate}{$id}{call}->($page, $template);
+               }
+       }
 
        $template->param(
                title => $title,
@@ -213,8 +218,8 @@ sub mtime ($) { #{{{
 } #}}}
 
 sub findlinks ($$) { #{{{
-       my $content=shift;
        my $page=shift;
+       my $content=shift;
 
        my @links;
        while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
@@ -249,15 +254,15 @@ sub render ($) { #{{{
                        }
                }
                
-               $links{$page}=[findlinks($content, $page)];
+               $links{$page}=[findlinks($page, $content)];
                
-               $content=linkify($content, $page);
+               $content=linkify($page, $content);
                $content=preprocess($page, $content);
                $content=htmlize($type, $content);
                
                check_overwrite("$config{destdir}/".htmlpage($page), $page);
                writefile(htmlpage($page), $config{destdir},
-                       genpage($content, $page, mtime($srcfile)));
+                       genpage($page, $content, mtime($srcfile)));
                $oldpagemtime{$page}=time;
                $renderedfiles{$page}=htmlpage($page);
        }