From: Michael Vogel Date: Mon, 18 Oct 2021 18:19:53 +0000 (+0200) Subject: Merge pull request #10888 from MrPetovan/task/10887-bbcode-style-block X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=df99ca8d8236b99e392bb3b6f6decba1673c9920;p=friendica.git Merge pull request #10888 from MrPetovan/task/10887-bbcode-style-block Add conditional block output for BBCode tag [style] --- df99ca8d8236b99e392bb3b6f6decba1673c9920 diff --cc doc/BBCode.md index 0404c381be,d232256583..dae630448f --- a/doc/BBCode.md +++ b/doc/BBCode.md @@@ -648,6 -654,12 +654,6 @@@ On Mastodon this field is used for the Custom inline styles

[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style] - You can change all the CSS properties of this block. + You can change all the CSS properties of this inline text. - - Custom class block
-
-[class=custom]If the class exists, this block will have the custom class style applied.[/class] -
<span class="custom">If the class exists,
this block will have the custom class
style applied.</span>
- diff --cc doc/de/BBCode.md index 534ebcc546,7af0861a7a..5949e67e18 --- a/doc/de/BBCode.md +++ b/doc/de/BBCode.md @@@ -607,7 -613,15 +613,7 @@@ Dieses Feld wird von Mastodon für Benutzerdefinierte Inline-Styles

[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style] - Du kannst alle CSS-Eigenschaften eines Blocks ändern- + Du kannst alle CSS-Eigenschaften dieses Inline-Textes ändern- - - Benutzerdefinierte CSS Klassen
-
-[class=custom]Wenn die vergebene Klasse in den CSS Anweisungen existiert, wird sie angewandt.[/class] -
<span class="custom">Wenn die
-vergebene Klasse in den CSS Anweisungen
-existiert,wird sie angewandt.</span>
- diff --cc src/Content/Text/BBCode.php index 696cc7d8c5,76bb9bb3f8..da95c3d673 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@@ -1645,15 -1642,16 +1642,20 @@@ class BBCod // Check for list text $text = str_replace("[*]", "
  • ", $text); - // Check for style sheet commands + // Check for block-level custom CSS + $text = preg_replace('#(?<=^|\n)\[style=(.*?)](.*?)\[/style](?:\n|$)#ism', '
    $2
    ', $text); + + // Check for inline custom CSS $text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '$2', $text); + // Mastodon Emoji (internal tag, do not document for users) + $text = preg_replace("(\[emoji=(.*?)](.*?)\[/emoji])ism", '$2', $text); + // Check for CSS classes + // @deprecated since 2021.12, left for backward-compatibility reasons $text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '$2', $text); + // Add HTML new lines + $text = str_replace("\n", '
    ', $text); // handle nested lists $endlessloop = 0;