Merge pull request #5912 from MrPetovan/bug/fix-code-tag-nonsense
Fix [code] tag whitespace nonsense
This commit is contained in:
commit
68af56a10e
2 changed files with 11 additions and 15 deletions
|
@ -114,6 +114,17 @@ function babel_content()
|
||||||
'content' => visible_whitespace($bbcode)
|
'content' => visible_whitespace($bbcode)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$html2 = Text\BBCode::convert($bbcode);
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
|
||||||
|
'content' => $html2
|
||||||
|
];
|
||||||
|
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
|
||||||
|
'content' => htmlspecialchars($html2)
|
||||||
|
];
|
||||||
|
|
||||||
$markdown = Text\HTML::toMarkdown($html);
|
$markdown = Text\HTML::toMarkdown($html);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('HTML::toMarkdown'),
|
'title' => L10n::t('HTML::toMarkdown'),
|
||||||
|
|
|
@ -1265,9 +1265,6 @@ class BBCode extends BaseObject
|
||||||
$text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "[share$1]$2[/share]", $text);
|
$text = preg_replace("/\s?\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "[share$1]$2[/share]", $text);
|
||||||
$text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "[quote$1]$2[/quote]", $text);
|
$text = preg_replace("/\s?\[quote(.*?)\]\s?(.*?)\s?\[\/quote\]\s?/ism", "[quote$1]$2[/quote]", $text);
|
||||||
|
|
||||||
$text = preg_replace("/\n\[code\]/ism", "[code]", $text);
|
|
||||||
$text = preg_replace("/\[\/code\]\n/ism", "[/code]", $text);
|
|
||||||
|
|
||||||
// when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
|
// when the content is meant exporting to other systems then remove the avatar picture since this doesn't really look good on these systems
|
||||||
if (!$try_oembed) {
|
if (!$try_oembed) {
|
||||||
$text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "\n[share$1$2]$3[/share]", $text);
|
$text = preg_replace("/\[share(.*?)avatar\s?=\s?'.*?'\s?(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "\n[share$1$2]$3[/share]", $text);
|
||||||
|
@ -1717,18 +1714,6 @@ class BBCode extends BaseObject
|
||||||
$text = Smilies::replace($text, false, true);
|
$text = Smilies::replace($text, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace inline code blocks
|
|
||||||
$text = preg_replace_callback("|(?!<br[^>]*>)<code>([^<]*)</code>(?!<br[^>]*>)|ism",
|
|
||||||
function ($match) use ($simple_html) {
|
|
||||||
$return = '<key>' . $match[1] . '</key>';
|
|
||||||
// Use <code> for Diaspora inline code blocks
|
|
||||||
if ($simple_html === 3) {
|
|
||||||
$return = '<code>' . $match[1] . '</code>';
|
|
||||||
}
|
|
||||||
return $return;
|
|
||||||
}
|
|
||||||
, $text);
|
|
||||||
|
|
||||||
// Unhide all [noparse] contained bbtags unspacefying them
|
// Unhide all [noparse] contained bbtags unspacefying them
|
||||||
// and triming the [noparse] tag.
|
// and triming the [noparse] tag.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue