1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 07:30:10 +01:00

HTML Tidy bug fix: broken attributes, and preserve whitespace properly

This commit is contained in:
Michael Foster 2013-08-29 21:24:38 +10:00
parent 471525a58b
commit 738179c766

View File

@ -1555,6 +1555,9 @@ function markup(&$body, $track_cites = false) {
if ($num_links > $config['max_links']) if ($num_links > $config['max_links'])
error($config['error']['toomanylinks']); error($config['error']['toomanylinks']);
} }
if ($config['markup_repair_tidy'])
$body = str_replace(' ', '  ', $body);
if ($config['auto_unicode']) { if ($config['auto_unicode']) {
$body = unicodify($body); $body = unicodify($body);
@ -1731,18 +1734,21 @@ function markup(&$body, $track_cites = false) {
$body = preg_replace('/\s+$/', '', $body); $body = preg_replace('/\s+$/', '', $body);
$body = preg_replace("/\n/", '<br/>', $body); $body = preg_replace("/\n/", '<br/>', $body);
if ($config['markup_repair_tidy']) { if ($config['markup_repair_tidy']) {
$tidy = new tidy(); $tidy = new tidy();
$body = $tidy->repairString(str_replace(' ', '&nbsp;', $body), array( $body = $tidy->repairString($body, array(
'doctype' => 'omit', 'doctype' => 'omit',
'bare' => true, 'bare' => true,
'literal-attributes' => true, 'literal-attributes' => true,
'quote-nbsp' => true,
'indent' => false, 'indent' => false,
'show-body-only' => true, 'show-body-only' => true,
'wrap' => 0, 'wrap' => 0,
'output-bom' => false, 'output-bom' => false,
'output-html' => true,
'newline' => 'LF',
'quiet' => true,
), 'utf8'); ), 'utf8');
$body = str_replace("\n", '', $body); $body = str_replace("\n", '', $body);
} }