diff options
author | Einer von Vielen <tomwie@users.sourceforge.net> | 2015-02-14 20:33:51 +0100 |
---|---|---|
committer | Einer von Vielen <tomwie@users.sourceforge.net> | 2015-02-14 20:33:51 +0100 |
commit | 6ed8fb30b8b6b70c1f9a2ff5651d6a4892060db9 (patch) | |
tree | 871a9637fc113c817321f5f13f17a75c55232cd8 /include | |
parent | 59828593c14a64cecf7ee5c077da9f918062ed60 (diff) | |
download | volse-hubzilla-6ed8fb30b8b6b70c1f9a2ff5651d6a4892060db9.tar.gz volse-hubzilla-6ed8fb30b8b6b70c1f9a2ff5651d6a4892060db9.tar.bz2 volse-hubzilla-6ed8fb30b8b6b70c1f9a2ff5651d6a4892060db9.zip |
Changed bb code [toc] to make it more flexible
This usage is know closer to the original usage of
http://ndabas.github.io/toc/
Changed:
- jquery.toc.js: Do not check for empty headings
- bbcode.php: Added processing of [toc] with parameters
- main.js: Use the default params for jquery.toc.js
- bbcode.html: Added more help for [toc] and corrected some html
Diffstat (limited to 'include')
-rw-r--r-- | include/bbcode.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 8f2b5bd38..82d0bd1d1 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -582,9 +582,14 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { if (strpos($Text,'[h6]') !== false) { $Text = preg_replace("(\[h6\](.*?)\[\/h6\])ism",'<h6>$1</h6>',$Text); } - // Check for table of content + // Check for table of content without params if (strpos($Text,'[toc]') !== false) { - $Text = preg_replace("/\[toc\]/ism",'<ul id="toc"></ul>',$Text); + $Text = preg_replace("/\[toc\]/ism",'<ul id="toc"></ul>',$Text); + } + // Check for table of content with params + if (strpos($Text,'[toc') !== false) { + $Text = preg_replace("/\[toc([^\]]+?)\]/ism",'<ul$1></ul>',$Text); + } // Check for centered text if (strpos($Text,'[/center]') !== false) { |