X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/99c65a4c0e4c563693525e9b7c737a2146418955..e8ff29fa330aef5e8d30eeef44218b87c4a9d97e:/IkiWiki/Plugin/inline.pm diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index c7107d664..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; @@ -304,7 +317,9 @@ sub preprocess_inline (@) { #{{{ } } - return $ret; + return $ret if $raw; + push @inline, $ret; + return "\n\n"; } #}}} sub pagetemplate_inline (@) { #{{{