summaryrefslogtreecommitdiff
path: root/inc/functions.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-29 15:56:36 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-29 15:56:36 +1000
commit7b817eea1119a9bd243497d68ba27059533ba5d8 (patch)
treeae9a1a224127ae36aa251262d131122e1716188c /inc/functions.php
parent3b63cad71fe15f98dc84f3d6451817251e8f89f7 (diff)
Fix markup again. And add the option to repair fucked up nesting (and more) with HTML Tidy ($config['markup_repair_tidy'])
Diffstat (limited to 'inc/functions.php')
-rw-r--r--inc/functions.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/inc/functions.php b/inc/functions.php
index d4a5766a..d006d0ad 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1728,7 +1728,16 @@ 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 = str_replace("\n", '', $body);
+ $body = preg_replace('@^.+<body>|</body>.+$@', '', $body);
+ }
+
return $tracked_cites;
}