EOF
sub import { #{{{
+ hook(type => "getsetup", id => "toggle", call => \&getsetup);
hook(type => "preprocess", id => "toggle",
call => \&preprocess_toggle);
hook(type => "preprocess", id => "toggleable",
hook(type => "format", id => "toggle", call => \&format);
} # }}}
+sub getsetup () { #{{{
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+} #}}}
+
sub genid ($$) { #{{{
my $page=shift;
my $id=shift;
sub format (@) { #{{{
my %params=@_;
- if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">)</div>!$1!g) {
+ if ($params{content}=~s!(<div class="toggleable(?:-open)?" id="[^"]+">\s*)</div>!$1!g) {
$params{content}=~s/<div class="toggleableend">//g;
if (! ($params{content}=~s!^<body>!<body>$javascript!m)) {
# no </body> tag, probably in preview mode