summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-29 21:24:38 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-29 21:24:38 +1000
commit738179c766953fa45670e451875210c6874a41f2 (patch)
tree85b5f1120b13dbbd3584532631cda59b8f5d712f /inc
parent471525a58bc59399066eaffb6e593b432ec854a8 (diff)
HTML Tidy bug fix: broken attributes, and preserve whitespace properly
Diffstat (limited to 'inc')
-rw-r--r--inc/functions.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 22a6d9ff..e634b87e 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1555,6 +1555,9 @@ function markup(&$body, $track_cites = false) {
if ($num_links > $config['max_links'])
error($config['error']['toomanylinks']);
}
+
+ if ($config['markup_repair_tidy'])
+ $body = str_replace(' ', ' &nbsp;', $body);
if ($config['auto_unicode']) {
$body = unicodify($body);
@@ -1731,18 +1734,21 @@ 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(str_replace(' ', '&nbsp;', $body), array(
+ $body = $tidy->repairString($body, array(
'doctype' => 'omit',
'bare' => true,
'literal-attributes' => true,
- 'quote-nbsp' => true,
'indent' => false,
'show-body-only' => true,
'wrap' => 0,
'output-bom' => false,
+ 'output-html' => true,
+ 'newline' => 'LF',
+ 'quiet' => true,
+
), 'utf8');
$body = str_replace("\n", '', $body);
}