]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/inline.pm
* Title metadata of inlined pages now shows up in blogs, although not yet
[git.ikiwiki.info.git] / IkiWiki / Plugin / inline.pm
index 427c25a96d75f8ffdd760a487ad1ae704ee80364..b06470bfef299dd0accf075ef6103e05893b4b21 100644 (file)
@@ -58,7 +58,7 @@ sub preprocess_inline (@) { #{{{
 
        my $ret="";
        
-       if (exists $params{rootpage}) {
+       if (exists $params{rootpage} && $config{cgiurl}) {
                # Add a blog post form, with a rss link button.
                my $formtemplate=template("blogpost.tmpl", blind_cache => 1);
                $formtemplate->param(cgiurl => $config{cgiurl});
@@ -83,20 +83,20 @@ sub preprocess_inline (@) { #{{{
        );
        
        foreach my $page (@list) {
-               $template->param(pagelink => htmllink($params{page}, $params{page}, $page));
+               # Don't use htmllink because this way the title is separate
+               # and can be overridden by other plugins.
+               my $link=htmlpage(bestlink($params{page}, $page));
+               $link=abs2rel($link, dirname($params{page}));
+               $template->param(pageurl => $link);
+               $template->param(title => $page);
                $template->param(content => get_inline_content($page, $params{page}))
                        if $params{archive} eq "no";
                $template->param(ctime => displaytime($pagectime{$page}));
 
-               if (exists $hooks{pagetemplate}) {
-                       foreach my $id (keys %{$hooks{pagetemplate}}) {
-                               $hooks{pagetemplate}{$id}{call}->(
-                                       page => $page,
-                                       destpage => $params{page},
-                                       template => $template,
-                               );
-                       }
-               }
+               run_hooks(pagetemplate => sub {
+                       shift->(page => $page, destpage => $params{page},
+                               template => $template,);
+               });
 
                $ret.=$template->output;
                $template->clear_params;
@@ -177,17 +177,15 @@ sub genrss ($@) { #{{{
 
        $template->param(
                title => $config{wikiname},
+               wikiname => $config{wikiname},
                pageurl => $url,
                items => \@items,
        );
        
-       foreach my $id (keys %{$hooks{pagetemplate}}) {
-               $hooks{pagetemplate}{$id}{call}->(
-                       page => $page,
-                       destpage => $page,
-                       template => $template,
-               );
-       }
+       run_hooks(pagetemplate => sub {
+               shift->(page => $page, destpage => $page,
+                       template => $template);
+       });
        
        return $template->output;
 } #}}}