]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/otl.pm
* Generalised preprocesser loop protection code.
[git.ikiwiki.info.git] / IkiWiki / Plugin / otl.pm
index 6514f0301e81bb39a50e956be727dee0e0c74485..314ed28ad07061a90a110257800c81f5a46906d3 100644 (file)
@@ -8,7 +8,23 @@ use IkiWiki;
 use IPC::Open2;
 
 sub import { #{{{
 use IPC::Open2;
 
 sub import { #{{{
+       IkiWiki::hook(type => "filter", id => "otl", call => \&filter);
        IkiWiki::hook(type => "htmlize", id => "otl", call => \&htmlize);
        IkiWiki::hook(type => "htmlize", id => "otl", call => \&htmlize);
+
+} # }}}
+
+sub filter (@) { #{{{
+       my %params=@_;
+        
+       # Munge up check boxes to look a little bit better. This is a hack.
+       my $checked=IkiWiki::htmllink($params{page}, $params{page},
+               "smileys/star_on.png", 0);
+       my $unchecked=IkiWiki::htmllink($params{page}, $params{page},
+               "smileys/star_off.png", 0);
+       $params{content}=~s/^(\s*)\[X\]\s/${1}$checked /mg;
+       $params{content}=~s/^(\s*)\[_\]\s/${1}$unchecked /mg;
+        
+       return $params{content};
 } # }}}
 
 sub htmlize ($) { #{{{
 } # }}}
 
 sub htmlize ($) { #{{{