From 63b0b92690b0f8aefbdab14450b3e3d7da977a1e Mon Sep 17 00:00:00 2001 From: rarjpg <57395050+rarjpg@users.noreply.github.com> Date: Tue, 12 Nov 2019 09:34:23 +0000 Subject: [PATCH] Move HTML Tidy 'bare' option to the config --- inc/config.php | 7 ++++++- inc/functions.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/config.php b/inc/config.php index 5053a7ce..e1cae2e5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -676,11 +676,16 @@ // "/```([a-z0-9-]{0,20})\n(.*?)\n?```\n?/s" $config['markup_code'] = false; - // Repair markup with HTML Tidy. This may be slower, but it solves nesting mistakes. Tinyboad, at the + // Repair markup with HTML Tidy. This may be slower, but it solves nesting mistakes. Tinyboard, 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; + // Use 'bare' config option of tidy::repairString. + // This option replaces some punctuation marks with their ASCII counterparts. + // Dashes are replaced with (single) hyphens, for example. + $config['markup_repair_tidy_bare'] = true; + // 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 2d3c4582..ee056dfa 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -2174,7 +2174,7 @@ function markup(&$body, $track_cites = false, $op = false) { $body = str_replace("\t", ' ', $body); $body = $tidy->repairString($body, array( 'doctype' => 'omit', - 'bare' => true, + 'bare' => $config['markup_repair_tidy_bare'], 'literal-attributes' => true, 'indent' => false, 'show-body-only' => true,