From abd013d6e423b316d52c1900711f2c8bd7dbe964 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 29 Aug 2013 15:28:45 +1000 Subject: Add $config['always_regenerate_markup'] (99.9% of Tinyboard users should ignore this) --- inc/config.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc/config.php') diff --git a/inc/config.php b/inc/config.php index 5d572010..9f68d04b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -472,6 +472,11 @@ // } // ); + // Always regenerate markup. This isn't recommended and should only be used for debugging; by default, + // Tinyboard only parses post markup when it needs to, and keeps post-markup HTML in the database. This + // will significantly impact performance when enabled. + $config['always_regenerate_markup'] = false; + /* * ==================== * Image settings -- cgit v1.3 From 7b817eea1119a9bd243497d68ba27059533ba5d8 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 29 Aug 2013 15:56:36 +1000 Subject: Fix markup again. And add the option to repair fucked up nesting (and more) with HTML Tidy ($config['markup_repair_tidy']) --- inc/config.php | 12 ++++++++---- inc/functions.php | 11 ++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'inc/config.php') diff --git a/inc/config.php b/inc/config.php index 9f68d04b..f9dc9912 100644 --- a/inc/config.php +++ b/inc/config.php @@ -459,10 +459,10 @@ */ // "Wiki" markup syntax ($config['wiki_markup'] in pervious versions): - $config['markup'][] = array("/'''([^<]+?)'''/", "\$1"); - $config['markup'][] = array("/''([^<]+?)''/", "\$1"); - $config['markup'][] = array("/\*\*([^<]+?)\*\*/", "\$1"); - // $config['markup'][] = array("/^[ |\t]*==([^<]+?)==[ |\t]*$/m", "\$1"); + $config['markup'][] = array("/'''(.+?)'''/", "\$1"); + $config['markup'][] = array("/''(.+?)''/", "\$1"); + $config['markup'][] = array("/\*\*(.+?)\*\*/", "\$1"); + // $config['markup'][] = array("/^[ |\t]*==(.+?)==[ |\t]*$/m", "\$1"); // Highlight PHP code wrapped in tags (PHP 5.3+) // $config['markup'][] = array( @@ -472,6 +472,10 @@ // } // ); + // Repair markup with HTML Tidy. This may be slower, but most if the time it solves nesting mistakes. + // Tinyboad, at the time of writing this, can not prevent out-of-order markup tags (eg. "**''test**''). + $config['markup_repair_tidy'] = false; + // Always regenerate markup. This isn't recommended and should only be used for debugging; by default, // Tinyboard only parses post markup when it needs to, and keeps post-markup HTML in the database. This // will significantly impact performance when enabled. 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/", '
', $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); + } + return $tracked_cites; } -- cgit v1.3 From eb7cb42e938f4f21ac860e08724699424569a2c4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 29 Aug 2013 18:59:36 +1000 Subject: $config['markup_repair_tidy']: Better comment --- inc/config.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'inc/config.php') diff --git a/inc/config.php b/inc/config.php index f9dc9912..86addf9b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -472,8 +472,9 @@ // } // ); - // Repair markup with HTML Tidy. This may be slower, but most if the time it solves nesting mistakes. - // Tinyboad, at the time of writing this, can not prevent out-of-order markup tags (eg. "**''test**''). + // Repair markup with HTML Tidy. This may be slower, but it solves nesting mistakes. Tinyboad, at the + // time of writing this, can not prevent out-of-order markup tags (eg. "**''test**'') without help from + // HTML Tidy. $config['markup_repair_tidy'] = false; // Always regenerate markup. This isn't recommended and should only be used for debugging; by default, -- cgit v1.3 From 3f26aa5ac3dc3f438a9ce875d355d5040b684054 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 29 Aug 2013 20:05:24 +1000 Subject: . --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/config.php') diff --git a/inc/config.php b/inc/config.php index 86addf9b..02cdbabf 100644 --- a/inc/config.php +++ b/inc/config.php @@ -611,7 +611,7 @@ // Display the aspect ratio of uploaded files. $config['show_ratio'] = false; // Display the file's original filename. - $config['show_filename']= true; + $config['show_filename'] = true; // Display image identification links using regex.info/exif, TinEye and Google Images. $config['image_identification'] = false; -- cgit v1.3