diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-12-26 08:58:40 -0500 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-12-26 08:58:40 -0500 |
commit | 1a5dd5c87c60f28fd799397e2aa0081f9b6c58ed (patch) | |
tree | 073e722d8efd22ba629d4dc30aac84e992775dc1 | |
parent | c2a189ab18aa77ceecb7f00a2ddf02aca9fecc5c (diff) | |
download | volse-hubzilla-1a5dd5c87c60f28fd799397e2aa0081f9b6c58ed.tar.gz volse-hubzilla-1a5dd5c87c60f28fd799397e2aa0081f9b6c58ed.tar.bz2 volse-hubzilla-1a5dd5c87c60f28fd799397e2aa0081f9b6c58ed.zip |
Updated markup language support doco. Modified parseIdentityAwareHTML BBcode parsing to support the BBcode reference which is now in /help/member/bbcode.html. Add Bootstrap classes to tables for BBcode tables that have the border=0 or border=1 options set.
-rw-r--r-- | doc/about/about_hubzilla.bb | 9 | ||||
-rw-r--r-- | doc/member/bbcode.html (renamed from doc/bbcode.html) | 28 | ||||
-rw-r--r-- | doc/member/member_guide.bb | 9 | ||||
-rw-r--r-- | include/bbcode.php | 32 |
4 files changed, 48 insertions, 30 deletions
diff --git a/doc/about/about_hubzilla.bb b/doc/about/about_hubzilla.bb index 3568ca200..3327e0b50 100644 --- a/doc/about/about_hubzilla.bb +++ b/doc/about/about_hubzilla.bb @@ -186,17 +186,8 @@ Any number of profiles may be created containing different information and these $Projectname offers a simple, one-click account backup, where you can download a complete backup of your profile(s). Backups can then be used to clone or restore a profile. [h4]Account Deletion[/h4] - Accounts can be immediately deleted by clicking on a link. That's it. All associated content is then deleted from the grid (this includes posts and any other content produced by the deleted profile). Depending on the number of connections you have, the process of deleting remote content could take some time but it is scheduled to happen as quickly as is practical. -[h4]Content Creation[/h4] - -[h4]Writing Posts[/h4] - -$Projectname supports a number of different ways of adding rich-text content. The default is a custom variant of BBcode, tailored for use in $Projectname. You may also enable the use of Markdown if you find that easier to work with. A visual editor may also be used. The traditional visual editor for $Projectname had some serious issues and has since been removed. We are currently looking for a replacement. - -When creating "Websites", content may be entered in HTML, Markdown, BBcode, and/or plain text. - [h4]Deletion of content[/h4] Any content created in $Projectname remains under the control of the member (or channel) that originally created it. At any time, a member can delete a message, or a range of messages. The deletion process ensures that the content is deleted, regardless of whether it was posted on a channel's primary (home) hub, or on another hub, where the channel was remotely authenticated via Zot ($Projectname communication and authentication protocol). diff --git a/doc/bbcode.html b/doc/member/bbcode.html index 36f40d3f4..e186085d3 100644 --- a/doc/bbcode.html +++ b/doc/member/bbcode.html @@ -8,16 +8,16 @@ <li>[s]strike[/s] - <strike>strike</strike><br /> <li>[color=red]red[/color] - <span style="color: red;">red</span><br /> <li>[url=https://zothub.com]$Projectname[/url] <a href="https://zothub.com">$Projectname</a><br /> -<li>[img]https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg" alt="Image/photo" /><br /> -<li>[img float=left]https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg" style="float:left;" alt="Image/photo" /><br /> +<li>[img]/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="/images/default_profile_photos/rainbow_man/48.jpg" alt="Image/photo" /><br /> +<li>[img float=left]/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="/images/default_profile_photos/rainbow_man/48.jpg" style="float:left;" alt="Image/photo" /><br /> <div style="clear:both;"></div> -<li>[img float=right]https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="https://zothub.com/images/default_profile_photos/rainbow_man/48.jpg" style="float:right;" alt="Image/photo" /><br /> +<li>[img float=right]/images/default_profile_photos/rainbow_man/48.jpg[/img] <img src="/images/default_profile_photos/rainbow_man/48.jpg" style="float:right;" alt="Image/photo" /><br /> <div style="clear:both;"></div> <li>[code]code[/code] <code>code</code><br /> <li>[code=xxx]syntax highlighted code[/code] <code>supported languages php, css, mysql, sql, abap, diff, html, perl, ruby, vbscript, avrc, dtd, java, xml, cpp, python, javascript, js, json, sh</code><br /> <li>[quote]quote[/quote] <blockquote>quote</blockquote><br /> <li>[quote=Author]Author? Me? No, no, no...[/quote] <br /><strong class="author">Author wrote:</strong><blockquote>Author? Me? No, no, no...</blockquote><br /> -<li> [nobb] may be used to escape bbcode.</ul><br /> +<li> [nobb][nobb]This is how you can show how to use BBcode syntax[/nobb][/nobb]</ul><br /> <br />You can make lists with:<br /> <ul class="listbullet" style="list-style-type: circle;"> @@ -73,14 +73,14 @@ or<br /><br />[dl terms="b"]<br />[*= First element term] First element descript <li>[zrl]https://zothub.com[/zrl] Magic-auth version of [url] tag</li> <li>[zmg]https://zothub.com/some/photo.jpg[/zmg] Magic-auth version of [img] tag<br /></li> -<li>[observer=1]Text to display if observer is authenticated in the matrix[/observer]</li> -<li>[observer=0]Text to display if observer is <strong>not</strong> authenticated in the matrix[/observer]</li> -<li>[observer.baseurl] website of observer</li> -<li>[observer.url] channel URL of observer</li> -<li>[observer.name] name of observer</li> -<li>[observer.webname] short name in the url of the observer</li> -<li>[observer.address] address (zot-id) of observer</li> -<li>[observer.photo] profile photo of observer<br /></li> +<li>[nobb][observer=1]Text to display if observer is authenticated in the matrix[/observer][/nobb]</li> +<li>[nobb][observer=0]Text to display if observer is <strong>not</strong> authenticated in the matrix[/observer][/nobb]</li> +<li>[nobb][observer.url][/nobb] channel URL of observer</li> +<li>[nobb][observer.baseurl][/nobb] website of observer</li> +<li>[nobb][observer.name][/nobb] name of observer</li> +<li>[nobb][observer.webname][/nobb] short name in the url of the observer</li> +<li>[nobb][observer.address][/nobb] address (zot-id) of observer</li> +<li>[nobb][observer.photo][/nobb] profile photo of observer<br /></li> <li>[spoiler] for hiding spoilers<br /><br /></li> @@ -102,8 +102,4 @@ or<br /><br />[dl terms="b"]<br />[*= First element term] First element descript <li>[map]Place Name[/map] Generate a map for a given named location. The first matching location is returned. For instance "Sydney" will usually return Sydney, Australia and not Sydney, Nova Scotia, Canada unless the more precise location is specified. It is highly recommended to use the post preview utility to ensure you have the correct location before submitting the post.<br /> </ul> -#include doc/macros/main_footer.bb; </div> - - - diff --git a/doc/member/member_guide.bb b/doc/member/member_guide.bb index 53cc6b8c7..b68eef12a 100644 --- a/doc/member/member_guide.bb +++ b/doc/member/member_guide.bb @@ -287,6 +287,15 @@ The connection edit screen offers a slider to select a degree of friendship with The slider on the matrix page has both a minimum and maximum value. Posts will only be shown from people who fall between this range. Affinity has no relation to permissions, and is only useful in conjunction with the affinity tool feature. +[h3]Markup Languages[/h3] +$Projectname supports several markup languages for advanced formatting of content. The default markup language is a [url=[baseurl]/help/member/bbcode]custom variant of BBcode[/url], tailored for use in $Projectname. BBcode is supported for posts, wiki pages, and web page elements. Wiki pages and webpage elements may also be written using standard Markdown. +[table border=0] +[tr][th]Content Type[/th][th]Supported Markup[/th][/tr] +[tr][td]Post[/td][td]BBcode[/td][/tr] +[tr][td]Wiki[/td][td]BBcode, Markdown[/td][/tr] +[tr][td]Webpage element[/td][td]BBcode, Markdown, HTML[/td][/tr] +[/table] + [h3]Personal Cloud Storage[/h3] $Projectname provides an ability to store privately and/or share arbitrary files with friends. diff --git a/include/bbcode.php b/include/bbcode.php index c7bee6f97..f0cf861f3 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -530,7 +530,17 @@ function bb_fixtable_lf($match) { } function parseIdentityAwareHTML($Text) { - + + // Hide all [noparse] contained bbtags by spacefying them + if (strpos($Text,'[noparse]') !== false) { + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_spacefy',$Text); + } + if (strpos($Text,'[nobb]') !== false) { + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_spacefy',$Text); + } + if (strpos($Text,'[pre]') !== false) { + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_spacefy',$Text); + } // process [observer] tags before we do anything else because we might // be stripping away stuff that then doesn't need to be worked on anymore @@ -568,9 +578,21 @@ function parseIdentityAwareHTML($Text) { $Text = str_replace('[observer.photo]','', $Text); } - $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); + $Text = str_replace(array('[baseurl]','[sitename]'),array(z_root(),get_config('system','sitename')),$Text); - return $Text; + + // Unhide all [noparse] contained bbtags unspacefying them + // and triming the [noparse] tag. + if (strpos($Text,'[noparse]') !== false) { + $Text = preg_replace_callback("/\[noparse\](.*?)\[\/noparse\]/ism", 'bb_unspacefy_and_trim', $Text); + } + if (strpos($Text,'[nobb]') !== false) { + $Text = preg_replace_callback("/\[nobb\](.*?)\[\/nobb\]/ism", 'bb_unspacefy_and_trim', $Text); + } + if (strpos($Text,'[pre]') !== false) { + $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim', $Text); + } + return $Text; } // BBcode 2 HTML was written by WAY2WEB.net @@ -891,8 +913,8 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) } if (strpos($Text,'[/table]') !== false) { $Text = preg_replace("/\[table\](.*?)\[\/table\]/sm", '<table>$1</table>', $Text); - $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '<table border="1" >$1</table>', $Text); - $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '<table border="0" >$1</table>', $Text); + $Text = preg_replace("/\[table border=1\](.*?)\[\/table\]/sm", '<table class="table table-responsive table-bordered" >$1</table>', $Text); + $Text = preg_replace("/\[table border=0\](.*?)\[\/table\]/sm", '<table class="table table-responsive" >$1</table>', $Text); } $Text = str_replace('</tr><br /><tr>', "</tr>\n<tr>", $Text); $Text = str_replace('[hr]', '<hr />', $Text); |