aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-12-28 14:58:25 -0500
committerAndrew Manning <tamanning@zoho.com>2016-12-28 14:58:25 -0500
commit13768fdb9b2925f31f49fb5f42de30ba0a0f3c0b (patch)
treef8ed5ba0cd5447e8bfa212ec0159308f7acf73d5 /include
parent46e4bd5fe067224985b396a0741cdb82f5941ecd (diff)
downloadvolse-hubzilla-13768fdb9b2925f31f49fb5f42de30ba0a0f3c0b.tar.gz
volse-hubzilla-13768fdb9b2925f31f49fb5f42de30ba0a0f3c0b.tar.bz2
volse-hubzilla-13768fdb9b2925f31f49fb5f42de30ba0a0f3c0b.zip
Zot structures doco integrated into the Zot page. Added nowrap option to [code] BBcode tag.
Diffstat (limited to 'include')
-rw-r--r--include/bbcode.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index f0cf861f3..00d22d26d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -511,6 +511,20 @@ function bb_code($match) {
return '<code class="inline-code">' . trim($match[1]) . '</code>';
}
+function bb_code_options($match) {
+ if(strpos($match[0], "<br />")) {
+ $class = "";
+ } else {
+ $class = "inline-code";
+ }
+ if(strpos($match[1], 'nowrap')) {
+ $style = "overflow-x: auto; white-space: pre;";
+ } else {
+ $style = "";
+ }
+ return '<code class="'. $class .'" style="'. $style .'">' . trim($match[2]) . '</code>';
+}
+
function bb_highlight($match) {
$lang = ((in_array(strtolower($match[1]),['php','css','mysql','sql','abap','diff','html','perl','ruby',
'vbscript','avrc','dtd','java','xml','cpp','python','javascript','js','json','sh']))
@@ -933,6 +947,11 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text);
}
+ // Check for [code options] text
+ if (strpos($Text,'[code ') !== false) {
+ $Text = preg_replace_callback("/\[code(.*?)\](.*?)\[\/code\]/ism", 'bb_code_options', $Text);
+ }
+
// Check for [spoiler] text
$endlessloop = 0;
while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) {