From 30e97b4cc1f9dc707a916f5aece2188608a1d32b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 29 Jan 2019 20:39:05 -0500 Subject: [PATCH] Ignore code blocks when extracting tags --- src/Content/Text/BBCode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index e0190c0c1d..794410a690 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1743,7 +1743,7 @@ class BBCode extends BaseObject // Clean up the HTML by loading and saving the HTML with the DOM. // Bad structured html can break a whole page. - // For performance reasons do it only with ativated item cache or at export. + // For performance reasons do it only with activated item cache or at export. if (!$try_oembed || (get_itemcachepath() != "")) { $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; @@ -1959,7 +1959,7 @@ class BBCode extends BaseObject $string = preg_replace('/#\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism', '#$2', $string); // ignore anything in a code block - $string = preg_replace('/\[code\](.*?)\[\/code\]/sm', '', $string); + $string = preg_replace('/\[code.*?\].*?\[\/code\]/sm', '', $string); // Force line feeds at bbtags $string = str_replace(['[', ']'], ["\n[", "]\n"], $string);