From 39aff642aa6a65243991ce9f0012cb7c4d0f2b71 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 17 Oct 2021 21:29:54 -0400 Subject: [PATCH] Deprecate limited-use and potentially confusing [class] BBCode tag - Replace its usage in Mastodon emoji with an internal tag [emoji] --- doc/BBCode.md | 6 ------ doc/de/BBCode.md | 8 -------- src/Content/Text/BBCode.php | 4 ++++ src/Protocol/ActivityPub/Processor.php | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/doc/BBCode.md b/doc/BBCode.md index 753bc69425..0404c381be 100644 --- a/doc/BBCode.md +++ b/doc/BBCode.md @@ -650,10 +650,4 @@ On Mastodon this field is used for the content warning. [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. - - 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 --git a/doc/de/BBCode.md b/doc/de/BBCode.md index ded52cdb78..534ebcc546 100644 --- a/doc/de/BBCode.md +++ b/doc/de/BBCode.md @@ -609,13 +609,5 @@ Dieses Feld wird von Mastodon für die Inhaltswarnung (content warning) verw [style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style] Du kannst alle CSS-Eigenschaften eines Blocks ä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 --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 7328328e23..8970d30c83 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -1648,7 +1648,11 @@ class BBCode // Check for style sheet commands $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); // handle nested lists diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 51a7ede2f2..f10df66b6f 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -96,7 +96,7 @@ class Processor array_combine( array_column($emojis, 'name'), array_map(function ($emoji) { - return '[class=emoji mastodon][img=' . $emoji['href'] . ']' . $emoji['name'] . '[/img][/class]'; + return '[emoji=' . $emoji['href'] . ']' . $emoji['name'] . '[/emoji]'; }, $emojis) ) );