aboutsummaryrefslogtreecommitdiffstats
path: root/include/bbcode.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-12-21 09:07:37 +0100
committerMario Vavti <mario@mariovavti.com>2017-12-21 09:07:37 +0100
commit64fe15b6f5813ba860034f583f8014f63951931d (patch)
treed57c8897702a8778112cf6fa5883b67c91ce8bd8 /include/bbcode.php
parent73766caa81b2cf2604f5343c41df0a33da8795f8 (diff)
downloadvolse-hubzilla-64fe15b6f5813ba860034f583f8014f63951931d.tar.gz
volse-hubzilla-64fe15b6f5813ba860034f583f8014f63951931d.tar.bz2
volse-hubzilla-64fe15b6f5813ba860034f583f8014f63951931d.zip
remove additional linebreaks after headings
Diffstat (limited to 'include/bbcode.php')
-rw-r--r--include/bbcode.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index ed34bc5d6..775a91f9a 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -941,27 +941,34 @@ function bbcode($Text, $options = []) {
// Check for h1
if (strpos($Text,'[h1]') !== false) {
$Text = preg_replace("(\[h1\](.*?)\[\/h1\])ism",'<h1>$1</h1>',$Text);
+ $Text = str_replace('</h1><br />', '</h1>', $Text);
}
// Check for h2
if (strpos($Text,'[h2]') !== false) {
$Text = preg_replace("(\[h2\](.*?)\[\/h2\])ism",'<h2>$1</h2>',$Text);
+ $Text = str_replace('</h2><br />', '</h2>', $Text);
}
// Check for h3
if (strpos($Text,'[h3]') !== false) {
$Text = preg_replace("(\[h3\](.*?)\[\/h3\])ism",'<h3>$1</h3>',$Text);
+ $Text = str_replace('</h3><br />', '</h3>', $Text);
}
// Check for h4
if (strpos($Text,'[h4]') !== false) {
$Text = preg_replace("(\[h4\](.*?)\[\/h4\])ism",'<h4>$1</h4>',$Text);
+ $Text = str_replace('</h4><br />', '</h4>', $Text);
}
// Check for h5
if (strpos($Text,'[h5]') !== false) {
$Text = preg_replace("(\[h5\](.*?)\[\/h5\])ism",'<h5>$1</h5>',$Text);
+ $Text = str_replace('</h5><br />', '</h5>', $Text);
}
// Check for h6
if (strpos($Text,'[h6]') !== false) {
$Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$Text);
+ $Text = str_replace('</h6><br />', '</h6>', $Text);
}
+
// Check for table of content without params
while(strpos($Text,'[toc]') !== false) {
$toc_id = 'toc-' . random_string(10);