aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-06-27 09:54:01 +0200
committerMario Vavti <mario@mariovavti.com>2016-06-27 09:54:01 +0200
commit5b9cd0af6492ad9a48ffa0cd757dacaf936dfdba (patch)
treee2622b1391d0a52c6511763f393f8a35cc27c352 /include/bbcode.php
parent27ee95106df739d8daa4eb7fe8907b080fb69c24 (diff)
parent8d298d5a068845856c9827c0d2ea3f02f1399d72 (diff)
downloadvolse-hubzilla-5b9cd0af6492ad9a48ffa0cd757dacaf936dfdba.tar.gz
volse-hubzilla-5b9cd0af6492ad9a48ffa0cd757dacaf936dfdba.tar.bz2
volse-hubzilla-5b9cd0af6492ad9a48ffa0cd757dacaf936dfdba.zip
Merge branch 'dev' into sabre32
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php14
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