diff options
author | redmatrix <git@macgirvin.com> | 2016-06-26 20:15:42 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-26 20:15:42 -0700 |
commit | e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8 (patch) | |
tree | 8a7661ce547aa252bf943d8f8f990a55d9aac360 /include/bbcode.php | |
parent | ec3651d216a5eafcb8019825bc6751e6ffa8c198 (diff) | |
download | volse-hubzilla-e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8.tar.gz volse-hubzilla-e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8.tar.bz2 volse-hubzilla-e2de2f65d5f434f800ac9fb6b824f9cbb5f860e8.zip |
issue #442, tables contain too much whitespace (there's a definite issue here, but I should note the offending example was full of carriage returns as well as linefeeds; which exacerbated the problem).
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 0bf326506..7f7be4300 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -498,6 +498,18 @@ function bb_highlight($match) { return $match[0]; } +function bb_fixtable_lf($match) { + + // remove extraneous whitespace between table element tags since newlines will all + // be converted to '<br />' and turn your neatly crafted tables into a whole lot of + // empty space. + + $x = preg_replace("/\]\s+\[/",'][',$match[1]); + return '[table]' . $x . '[/table]'; + +} + + // BBcode 2 HTML was written by WAY2WEB.net // extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin @@ -579,7 +591,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace_callback("/\[code=(.*?)\](.*?)\[\/code\]/ism", 'bb_highlight', $Text); } - + $Text = preg_replace_callback("/\[table\](.*?)\[\/table\]/ism",'bb_fixtable_lf',$Text); // Convert new line chars to html <br /> tags |