diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-12-04 12:51:23 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-12-04 12:51:23 +0100 |
commit | b12d4c03cbc2627774b279f17a413860d868e854 (patch) | |
tree | 10acf01c398ad51bbf51e8f41ea4bda64963f122 /include/bbcode.php | |
parent | 792527d456a031696f93015fb4fc91e60dee151b (diff) | |
download | volse-hubzilla-b12d4c03cbc2627774b279f17a413860d868e854.tar.gz volse-hubzilla-b12d4c03cbc2627774b279f17a413860d868e854.tar.bz2 volse-hubzilla-b12d4c03cbc2627774b279f17a413860d868e854.zip |
fixes for toc bbcode and bbcode wiki toc
Diffstat (limited to 'include/bbcode.php')
-rw-r--r-- | include/bbcode.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 6794fca96..396cbcb29 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -824,12 +824,14 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$Text); } // Check for table of content without params - if (strpos($Text,'[toc]') !== false) { - $Text = preg_replace("/\[toc\]/ism",'<ul id="toc"></ul>',$Text); + while(strpos($Text,'[toc]') !== false) { + $toc_id = 'toc-' . random_string(10); + $Text = preg_replace("/\[toc\]/ism", '<strong>' . t('Contents:') . '</strong><ul id="' . $toc_id . '" class="toc" data-toc=".section-content-wrapper"></ul><script>$("#' . $toc_id . '").toc();</script>', $Text, 1); } // Check for table of content with params - if (strpos($Text,'[toc') !== false) { - $Text = preg_replace("/\[toc([^\]]+?)\]/ism",'<ul$1></ul>',$Text); + while(strpos($Text,'[toc') !== false) { + $toc_id = 'toc-' . random_string(10); + $Text = preg_replace("/\[toc([^\]]+?)\]/ism", '<strong>' . t('Contents:') . '</strong><ul id="' . $toc_id . '" class="toc"$1></ul><script>$("#' . $toc_id . '").toc();</script>', $Text, 1); } // Check for centered text if (strpos($Text,'[/center]') !== false) { |