X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/f7303db5a194bff0e0c621efedc320cf9997d35e..060183df6797c22edad0bef0d75ee9043b211bf8:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index b43530eb8..9b2caffcf 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -10,6 +10,7 @@ use URI; my %knownfeeds; my %page_numfeeds; +my @inline; sub import { #{{{ hook(type => "getopt", id => "inline", call => \&getopt); @@ -19,6 +20,7 @@ sub import { #{{{ call => \&IkiWiki::preprocess_inline); hook(type => "pagetemplate", id => "inline", call => \&IkiWiki::pagetemplate_inline); + hook(type => "format", id => "inline", call => \&format); # Hook to change to do pinging since it's called late. # This ensures each page only pings once and prevents slow # pings interrupting page builds. @@ -51,6 +53,17 @@ sub checkconfig () { #{{{ } } #}}} +sub format (@) { #{{{ + my %params=@_; + + # Fill in the inline content generated earlier. This is actually an + # optimisation. + $params{content}=~s{
}{ + delete @inline[$1,] + }eg; + return $params{content}; +} #}}} + sub sessioncgi () { #{{{ my $q=shift; my $session=shift; @@ -286,7 +299,8 @@ sub preprocess_inline (@) { #{{{ will_render($params{destpage}, $rssp); if (! $params{preview}) { writefile($rssp, $config{destdir}, - genfeed("rss", $rssurl, $desc, $params{destpage}, @list)); + genfeed("rss", + $config{url}."/".rsspage($params{destpage}).$feednum, $desc, $params{destpage}, @list)); $toping{$params{destpage}}=1 unless $config{rebuild}; $feedlinks{$params{destpage}}=qq{}; } @@ -296,14 +310,16 @@ sub preprocess_inline (@) { #{{{ will_render($params{destpage}, $atomp); if (! $params{preview}) { writefile($atomp, $config{destdir}, - genfeed("atom", $atomurl, $desc, $params{destpage}, @list)); + genfeed("atom", $config{url}."/".atompage($params{destpage}).$feednum, $desc, $params{destpage}, @list)); $toping{$params{destpage}}=1 unless $config{rebuild}; $feedlinks{$params{destpage}}=qq{}; } } } - return $ret; + return $ret if $raw; + push @inline, $ret; + return "
\n\n"; } #}}} sub pagetemplate_inline (@) { #{{{ @@ -362,8 +378,8 @@ sub absolute_urls ($$) { #{{{ $url=~s/[^\/]+$//; $content=~s/(