not only markdown adds gunk, so remove it in the main htmlize function
parent
2b9ce0129b
commit
e01960e90a
10
IkiWiki.pm
10
IkiWiki.pm
|
@ -624,6 +624,8 @@ sub htmlize ($$$) { #{{{
|
||||||
error("htmlization of $type not supported");
|
error("htmlization of $type not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $oneline = $content !~ /\n/;
|
||||||
|
|
||||||
run_hooks(sanitize => sub {
|
run_hooks(sanitize => sub {
|
||||||
$content=shift->(
|
$content=shift->(
|
||||||
page => $page,
|
page => $page,
|
||||||
|
@ -631,6 +633,14 @@ sub htmlize ($$$) { #{{{
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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;
|
return $content;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ sub htmlize (@) { #{{{
|
||||||
require Encode;
|
require Encode;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $oneline = $content !~ /\n/;
|
|
||||||
|
|
||||||
# Workaround for perl bug (#376329)
|
# Workaround for perl bug (#376329)
|
||||||
$content=Encode::encode_utf8($content);
|
$content=Encode::encode_utf8($content);
|
||||||
eval {$content=&$markdown_sub($content)};
|
eval {$content=&$markdown_sub($content)};
|
||||||
|
@ -52,13 +50,6 @@ sub htmlize (@) { #{{{
|
||||||
}
|
}
|
||||||
$content=Encode::decode_utf8($content);
|
$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;
|
return $content;
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ ikiwiki (2.20) UNRELEASED; urgency=low
|
||||||
* template: Remove bogus htmlize pass added in 2.16.
|
* template: Remove bogus htmlize pass added in 2.16.
|
||||||
* template: Htmlize template variables, but also provide a raw version
|
* template: Htmlize template variables, but also provide a raw version
|
||||||
via `<TMPL_VAR raw_variable>`.
|
via `<TMPL_VAR raw_variable>`.
|
||||||
* mdwn: When htmlizing text, if it's a single line with no newline,
|
* When htmlizing text, if the input is a single line with no newline,
|
||||||
remove the enclosing paragraph and newline markdown wraps it in.
|
and the htmlizer (such as markdown and textile) generates a html
|
||||||
This allows removing several hacks around this markdown behavior from
|
paragraph, remove it. This allows removing several hacks around this
|
||||||
other plugins that htmlize fragements of pages.
|
markdown behavior from other plugins that htmlize fragements of pages.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 09 Jan 2008 00:34:46 -0500
|
-- Joey Hess <joeyh@debian.org> Wed, 09 Jan 2008 00:34:46 -0500
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue