From b5b21ecad7b164168fbc75792c7285700cee5c9f Mon Sep 17 00:00:00 2001 From: Treer Date: Sat, 30 Apr 2016 02:03:38 +1000 Subject: improve whitespace control around definition list ([dl]) bbcode --- include/bbcode.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/bbcode.php') diff --git a/include/bbcode.php b/include/bbcode.php index 1640307f8..5bd5301cc 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -360,14 +360,16 @@ function bb_definitionList($match) { // The bbcode transformation will be: // [*=term-text] description-text =>
term-text
description-text - // then after all replacements have been made, the
remaining the start of the - // string can be removed. HTML5 allows the missing end tag. + // then after all replacements have been made, the extra at the start of the + // first line can be removed. HTML5 allows the tag to be missing from the end of the last line. // Using '(?\n"; + $eatLeadingSpaces = '(?: |[ \t])*'; // prevent spaces infront of [*= from adding another line to the previous element + $listElements = preg_replace('/^(\n|
)/', '', $match[2]); // ltrim the first newline $listElements = preg_replace( - '/\[\*=([[:print:]]*?)(?$1
', - $match[2] + $listElements ); // Unescape any \] inside the
tags $listElements = preg_replace_callback('/
(.*?)<\/dt>/ism', 'bb_definitionList_unescapeBraces', $listElements); -- cgit v1.2.3