diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-09 14:41:28 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-09 14:41:28 -0500 |
commit | e01960e90aae4185771719e9eed00b23d43431a7 (patch) | |
tree | 65e4f88e717790fd1cae39d8471f8fad5f528563 | |
parent | 2b9ce0129bc61177e976caf432af9b4406ab2f3f (diff) | |
download | ikiwiki-e01960e90aae4185771719e9eed00b23d43431a7.tar ikiwiki-e01960e90aae4185771719e9eed00b23d43431a7.tar.gz |
not only markdown adds gunk, so remove it in the main htmlize function
-rw-r--r-- | IkiWiki.pm | 10 | ||||
-rw-r--r-- | IkiWiki/Plugin/mdwn.pm | 9 | ||||
-rw-r--r-- | debian/changelog | 8 |
3 files changed, 14 insertions, 13 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index d001760a2..230170d85 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -624,12 +624,22 @@ sub htmlize ($$$) { #{{{ error("htmlization of $type not supported"); } + my $oneline = $content !~ /\n/; + run_hooks(sanitize => sub { $content=shift->( page => $page, content => $content, ); }); + + if ($oneline) { + # hack to get rid of enclosing junk added by markdown + # and other htmlizers + $content=~s/^<p>//i; + $content=~s/<\/p>$//i; + chomp $content; + } return $content; } #}}} diff --git a/IkiWiki/Plugin/mdwn.pm b/IkiWiki/Plugin/mdwn.pm index 1520b3eec..254ab51d0 100644 --- a/IkiWiki/Plugin/mdwn.pm +++ b/IkiWiki/Plugin/mdwn.pm @@ -41,8 +41,6 @@ sub htmlize (@) { #{{{ require Encode; } - my $oneline = $content !~ /\n/; - # Workaround for perl bug (#376329) $content=Encode::encode_utf8($content); eval {$content=&$markdown_sub($content)}; @@ -52,13 +50,6 @@ sub htmlize (@) { #{{{ } $content=Encode::decode_utf8($content); - if ($oneline) { - # hack to get rid of enclosing junk added by markdown - $content=~s!^<p>!!; - $content=~s!</p>$!!; - chomp $content; - } - return $content; } # }}} diff --git a/debian/changelog b/debian/changelog index ee2ecc4d5..d115efafc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,10 +17,10 @@ ikiwiki (2.20) UNRELEASED; urgency=low * template: Remove bogus htmlize pass added in 2.16. * template: Htmlize template variables, but also provide a raw version via `<TMPL_VAR raw_variable>`. - * mdwn: When htmlizing text, if it's a single line with no newline, - remove the enclosing paragraph and newline markdown wraps it in. - This allows removing several hacks around this markdown behavior from - other plugins that htmlize fragements of pages. + * When htmlizing text, if the input is a single line with no newline, + and the htmlizer (such as markdown and textile) generates a html + paragraph, remove it. This allows removing several hacks around this + markdown behavior from other plugins that htmlize fragements of pages. -- Joey Hess <joeyh@debian.org> Wed, 09 Jan 2008 00:34:46 -0500 |