From f8457f9a902e880e0240ba7f5180c22999f0e713 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Apr 2010 17:18:30 -0400 Subject: [PATCH] fix bug that left stray

tags Both markdown and tidy add paragraph tags around text, that needs to be stripped when the text is a short, one line fragment that is being inserted into a larger page. tidy also adds several newlines to the end, and this broke removal of the paragraph tags. --- IkiWiki.pm | 7 +++---- doc/bugs/stray___60____47__p__62___tags.mdwn | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 6739ba56c..0cbc84788 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1164,7 +1164,7 @@ sub htmlize ($$$$) { my $content=shift; my $oneline = $content !~ /\n/; - + if (exists $hooks{htmlize}{$type}) { $content=$hooks{htmlize}{$type}{call}->( page => $page, @@ -1185,10 +1185,9 @@ sub htmlize ($$$$) { if ($oneline) { # hack to get rid of enclosing junk added by markdown - # and other htmlizers + # and other htmlizers/sanitizers $content=~s/^

//i; - $content=~s/<\/p>$//i; - chomp $content; + $content=~s/<\/p>\n*$//i; } return $content; diff --git a/doc/bugs/stray___60____47__p__62___tags.mdwn b/doc/bugs/stray___60____47__p__62___tags.mdwn index 6e508ffda..99d6fe09f 100644 --- a/doc/bugs/stray___60____47__p__62___tags.mdwn +++ b/doc/bugs/stray___60____47__p__62___tags.mdwn @@ -13,3 +13,5 @@ I believe that this snippet in `IkiWiki.pm` might be the reason for the imbalanc } The fact that HTML in a `\[[!meta title]]` is added but then escaped might indicate that some other bug is involved. + +> [[done]] --[[Joey]] -- 2.44.0