1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 16:00:22 +01:00

HTML Tidy fixes: UTF-8, preserving whitespace, keep attributes literal, don't wrap text

This commit is contained in:
Michael Foster 2013-08-29 21:05:03 +10:00
parent 5adadcd838
commit b76f86aa99

View File

@ -1731,16 +1731,22 @@ function markup(&$body, $track_cites = false) {
$body = preg_replace('/\s+$/', '', $body);
$body = preg_replace("/\n/", '<br/>', $body);
if ($config['markup_repair_tidy']) {
$tidy = new tidy();
$body = $tidy->repairString($body, array(
'doctype' => 'omit'
));
$body = $tidy->repairString(str_replace(' ', '&nbsp;', $body), array(
'doctype' => 'omit',
'bare' => true,
'literal-attributes' => true,
'quote-nbsp' => true,
'indent' => false,
'show-body-only' => true,
'wrap' => 0,
'output-bom' => false,
), 'utf8');
$body = str_replace("\n", '', $body);
$body = preg_replace('@^.+<body>|</body>.+$@', '', $body);
}
return $tracked_cites;
}