X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/89e0de5bc46f87231a3447acb8609641cc9162aa..2b53de66a06dd6449cf81f105bc6cdcf44ebac0d:/IkiWiki/Plugin/toggle.pm?ds=sidebyside diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index cd9617e25..610d38e3a 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -60,6 +60,7 @@ function getElementsByClass(cls, node, tag) { EOF sub import { #{{{ + hook(type => "getsetup", id => "toggle", call => \&getsetup); hook(type => "preprocess", id => "toggle", call => \&preprocess_toggle); hook(type => "preprocess", id => "toggleable", @@ -67,6 +68,14 @@ sub import { #{{{ hook(type => "format", id => "toggle", call => \&format); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub genid ($$) { #{{{ my $page=shift; my $id=shift; @@ -110,7 +119,7 @@ sub preprocess_toggleable (@) { #{{{ sub format (@) { #{{{ my %params=@_; - if ($params{content}=~s!(
)
!$1!g) { + if ($params{content}=~s!(
\s*)
!$1!g) { $params{content}=~s/
//g; if (! ($params{content}=~s!^!$javascript!m)) { # no tag, probably in preview mode