hook(type => "preprocess", id => "toggle",
call => \&preprocess_toggle);
hook(type => "preprocess", id => "toggleable",
hook(type => "preprocess", id => "toggle",
call => \&preprocess_toggle);
hook(type => "preprocess", id => "toggleable",
my %params=(id => "default", text => "", @_);
# Preprocess the text to expand any preprocessor directives
my %params=(id => "default", text => "", @_);
# Preprocess the text to expand any preprocessor directives
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage}, $params{text});
my $id=genid($params{page}, $params{id});
# Should really be a postprocessor directive, oh well. Work around
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage}, $params{text});
my $id=genid($params{page}, $params{id});
# Should really be a postprocessor directive, oh well. Work around
- # markdown's dislike of markdown inside a <div>.
- return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n<div class=\"toggleableend\"></div>";
+ # markdown's dislike of markdown inside a <div> with various funky
+ # whitespace.
+ my ($indent)=$params{text}=~/( +)$/;
+ $indent="" unless defined $indent;
+ return "<div class=\"toggleable\" id=\"$id\"></div>\n\n$params{text}\n$indent<div class=\"toggleableend\"></div>";