render code bbcode inline if there are no linebreaks in the text.
This commit is contained in:
parent
f2ebe41a50
commit
d1efb59fcd
@ -477,9 +477,12 @@ function bb_observer($Text) {
|
|||||||
return $Text;
|
return $Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bb_code($match) {
|
||||||
|
if(strpos($match[0], "<br />"))
|
||||||
|
return '<code>' . trim($match[1]) . '</code>';
|
||||||
|
else
|
||||||
|
return '<code class="inline-code">' . trim($match[1]) . '</code>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -785,12 +788,9 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
|
|||||||
$Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $Text);
|
$Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Declare the format for [code] layout
|
|
||||||
$CodeLayout = '<code>$1</code>';
|
|
||||||
|
|
||||||
// Check for [code] text
|
// Check for [code] text
|
||||||
if (strpos($Text,'[code]') !== false) {
|
if (strpos($Text,'[code]') !== false) {
|
||||||
$Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text);
|
$Text = preg_replace_callback("/\[code\](.*?)\[\/code\]/ism", 'bb_code', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for [spoiler] text
|
// Check for [spoiler] text
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
/* common */
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: Courier, monospace;
|
|
||||||
display: block;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* jot */
|
/* jot */
|
||||||
|
|
||||||
.jothidden input {
|
.jothidden input {
|
||||||
@ -305,6 +297,18 @@ a.wall-item-name-link {
|
|||||||
|
|
||||||
/* bb-code */
|
/* bb-code */
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: Courier, monospace;
|
||||||
|
font-size: 1em;
|
||||||
|
padding: 1em 1.5em;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
code.inline-code {
|
||||||
|
padding: 0px 4px;
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
.overline {
|
.overline {
|
||||||
text-decoration: overline;
|
text-decoration: overline;
|
||||||
}
|
}
|
||||||
|
@ -113,13 +113,12 @@ pre code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
font-size: 1em;
|
|
||||||
padding: 1em 1.5em;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
color: #000;
|
color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
Reference in New Issue
Block a user