From 503e5847f98894d85588076d7d719f36643241c3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 14 Jan 2018 13:13:16 -0500 Subject: [PATCH] Improve html2bbcode - trim code blocks - Add conversion to (from Diaspora) --- include/html2bbcode.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/html2bbcode.php b/include/html2bbcode.php index 763351e802..936bce3384 100644 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -95,7 +95,7 @@ function html2bbcode($message, $basepath = '') if ($matches[1] != '') { $prefix = '[code=' . $matches[1] . ']'; } - $codeblocks[] = $prefix . $matches[2] . '[/code]'; + $codeblocks[] = $prefix . trim($matches[2]) . '[/code]'; return $return; }, $message @@ -247,6 +247,7 @@ function html2bbcode($message, $basepath = '') node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]'); node2bbcode($doc, 'key', array(), '[code]', '[/code]'); + node2bbcode($doc, 'code', array(), '[code]', '[/code]'); $message = $doc->saveHTML();