]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Render.pm
missing <p>
[git.ikiwiki.info.git] / IkiWiki / Render.pm
index 3fdbc6f4a3dd87f5094f71a70f009deb154f9188..1fc047a62f78ed8b21d2cde47940363a65930d09 100644 (file)
@@ -9,7 +9,8 @@ sub linkify ($$) { #{{{
        my $page=shift;
 
        $content =~ s{(\\?)$config{wiki_link_regexp}}{
        my $page=shift;
 
        $content =~ s{(\\?)$config{wiki_link_regexp}}{
-               $1 ? "[[$2]]" : htmllink($page, $2)
+               $2 ? ( $1 ? "[[$2|$3]]" : htmllink($page, titlepage($3), 0, 0, pagetitle($2)))
+                  : ( $1 ? "[[$3]]" :    htmllink($page, titlepage($3)))
        }eg;
        
        return $content;
        }eg;
        
        return $content;
@@ -160,12 +161,22 @@ sub postprocess_html_inline { #{{{
        }
        $inlinepages{$parentpage}=$params{pages};
        
        }
        $inlinepages{$parentpage}=$params{pages};
        
+       my $ret="";
+       
+       if (exists $params{rootpage}) {
+               my $formtemplate=HTML::Template->new(blind_cache => 1,
+                       filename => "$config{templatedir}/blogpost.tmpl");
+               $formtemplate->param(cgiurl => $config{cgiurl});
+               $formtemplate->param(rootpage => $params{rootpage});
+               my $form=$formtemplate->output;
+               $ret.=$form;
+       }
+       
        my $template=HTML::Template->new(blind_cache => 1,
                filename => (($params{archive} eq "no") 
                                ? "$config{templatedir}/inlinepage.tmpl"
                                : "$config{templatedir}/inlinepagetitle.tmpl"));
        
        my $template=HTML::Template->new(blind_cache => 1,
                filename => (($params{archive} eq "no") 
                                ? "$config{templatedir}/inlinepage.tmpl"
                                : "$config{templatedir}/inlinepagetitle.tmpl"));
        
-       my $ret="";
        foreach my $page (blog_list($params{pages}, $params{show})) {
                next if $page eq $parentpage;
                $template->param(pagelink => htmllink($parentpage, $page));
        foreach my $page (blog_list($params{pages}, $params{show})) {
                next if $page eq $parentpage;
                $template->param(pagelink => htmllink($parentpage, $page));
@@ -175,7 +186,7 @@ sub postprocess_html_inline { #{{{
                $ret.=$template->output;
        }
        
                $ret.=$template->output;
        }
        
-       return $ret;
+       return "</p>$ret<p>";
 } #}}}
 
 sub genpage ($$$) { #{{{
 } #}}}
 
 sub genpage ($$$) { #{{{
@@ -191,10 +202,10 @@ sub genpage ($$$) { #{{{
                filename => "$config{templatedir}/page.tmpl");
        
        if (length $config{cgiurl}) {
                filename => "$config{templatedir}/page.tmpl");
        
        if (length $config{cgiurl}) {
-               $template->param(editurl => "$config{cgiurl}?do=edit&page=$page");
-               $template->param(prefsurl => "$config{cgiurl}?do=prefs");
+               $template->param(editurl => cgiurl(do => "edit", page => $page));
+               $template->param(prefsurl => cgiurl(do => "prefs"));
                if ($config{rcs}) {
                if ($config{rcs}) {
-                       $template->param(recentchangesurl => "$config{cgiurl}?do=recentchanges");
+                       $template->param(recentchangesurl => cgiurl(do => "recentchanges"));
                }
        }
 
                }
        }
 
@@ -205,7 +216,7 @@ sub genpage ($$$) { #{{{
        }
 
        if ($config{rss} && $inlinepages{$page}) {
        }
 
        if ($config{rss} && $inlinepages{$page}) {
-               $template->param(rssurl => rsspage($page));
+               $template->param(rssurl => rsspage(basename($page)));
        }
        
        $template->param(
        }
        
        $template->param(
@@ -256,8 +267,6 @@ sub genrss ($$$) { #{{{
                my $parentpage=shift;
                my %params=@_;
                
                my $parentpage=shift;
                my %params=@_;
                
-               return "" if exists $params{archive} && $params{archive} eq 'yes';
-               
                if (! exists $params{show}) {
                        $params{show}=10;
                }
                if (! exists $params{show}) {
                        $params{show}=10;
                }
@@ -305,9 +314,9 @@ sub check_overwrite ($$) { #{{{
 } #}}}
 
 sub mtime ($) { #{{{
 } #}}}
 
 sub mtime ($) { #{{{
-       my $page=shift;
+       my $file=shift;
        
        
-       return (stat($page))[9];
+       return (stat($file))[9];
 } #}}}
 
 sub findlinks ($$) { #{{{
 } #}}}
 
 sub findlinks ($$) { #{{{
@@ -316,7 +325,7 @@ sub findlinks ($$) { #{{{
 
        my @links;
        while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
 
        my @links;
        while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
-               push @links, lc($1);
+               push @links, titlepage($2);
        }
        # Discussion links are a special case since they're not in the text
        # of the page, but on its template.
        }
        # Discussion links are a special case since they're not in the text
        # of the page, but on its template.
@@ -408,7 +417,8 @@ sub refresh () { #{{{
                        push @add, $file;
                        $links{$page}=[];
                        $pagesources{$page}=$file;
                        push @add, $file;
                        $links{$page}=[];
                        $pagesources{$page}=$file;
-                       $pagectime{$page}=time unless exists $pagectime{$page};
+                       $pagectime{$page}=mtime("$config{srcdir}/$file") 
+                               unless exists $pagectime{$page};
                }
        }
        my @del;
                }
        }
        my @del;