From: Joey Hess Date: Thu, 19 Jul 2012 17:46:45 +0000 (-0400) Subject: Merge remote-tracking branch 'anarcat/inline_diffs' X-Git-Url: https://scripts.mit.edu/gitweb/www/ikiwiki.git/commitdiff_plain/9cab856ed70b566292982796187c0c1d71e9d433?hp=45ebcbb4b6dd66827dc83ae870e5218de2d01b08 Merge remote-tracking branch 'anarcat/inline_diffs' --- diff --git a/IkiWiki/Plugin/recentchangesdiff.pm b/IkiWiki/Plugin/recentchangesdiff.pm index 418822793..eb358be67 100644 --- a/IkiWiki/Plugin/recentchangesdiff.pm +++ b/IkiWiki/Plugin/recentchangesdiff.pm @@ -9,10 +9,12 @@ use HTML::Entities; my $maxlines=200; sub import { + add_underlay("javascript"); hook(type => "getsetup", id => "recentchangesdiff", call => \&getsetup); hook(type => "pagetemplate", id => "recentchangesdiff", call => \&pagetemplate); + hook(type => "format", id => "recentchangesdiff.pm", call => \&format); } sub getsetup () { @@ -55,4 +57,24 @@ sub pagetemplate (@) { } } +sub format (@) { + my %params=@_; + + if (! ($params{content}=~s!^(]*>)!$1.include_javascript($params{page})!em)) { + # no tag, probably in preview mode + $params{content}=include_javascript(undef).$params{content}; + } + return $params{content}; +} + +# taken verbatim from toggle.pm +sub include_javascript ($) { + my $from=shift; + + return ''."\n". + ''; +} + 1 diff --git a/templates/change.tmpl b/templates/change.tmpl index d7ec90875..1751a39b5 100644 --- a/templates/change.tmpl +++ b/templates/change.tmpl @@ -9,6 +9,9 @@ + -
+
 
 
+