]> git.mxchange.org Git - friendica.git/commitdiff
Deprecate limited-use and potentially confusing [class] BBCode tag
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 18 Oct 2021 01:29:54 +0000 (21:29 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 18 Oct 2021 06:45:42 +0000 (02:45 -0400)
- Replace its usage in Mastodon emoji with an internal tag [emoji]

doc/BBCode.md
doc/de/BBCode.md
src/Content/Text/BBCode.php
src/Protocol/ActivityPub/Processor.php

index 753bc69425bf669ee73b611604cd7cbb3ae60a25..0404c381bec63200085393bb913d048163749230 100644 (file)
@@ -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]</td>
   <td><span style="text-shadow: 0 0 4px #cc0000;;">You can change all the CSS properties of this block.</span></td>
 </tr>
-<tr>
-  <td>Custom class block<br>
-<br>
-[class=custom]If the class exists, this block will have the custom class style applied.[/class]</td>
-  <td><pre>&lt;span class="custom"&gt;If the class exists,<br> this block will have the custom class<br> style applied.&lt;/span&gt;</pre></td>
-</tr>
 </table>
index ded52cdb7848e502cfcabda88b3894f4ca9ad31e..534ebcc546c9ec0900d5873013f74e1010b5d498 100644 (file)
@@ -609,13 +609,5 @@ Dieses Feld wird von Mastodon f&uuml;r die Inhaltswarnung (content warning) verw
 [style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks &auml;ndern-[/style]</td>
   <td><span style="text-shadow: 0 0 4px #cc0000;;">Du kannst alle CSS-Eigenschaften eines Blocks &auml;ndern-</span></td>
 </tr>
-<tr>
-  <td>Benutzerdefinierte CSS Klassen<br>
-<br>
-[class=custom]Wenn die vergebene Klasse in den CSS Anweisungen existiert, wird sie angewandt.[/class]</td>
-  <td><pre>&lt;span class="custom"&gt;Wenn die<br>
-vergebene Klasse in den CSS Anweisungen<br>
-existiert,wird sie angewandt.&lt;/span&gt;</pre></td>
-</tr>
 </table>
 
index 7328328e23fb6785166445a5b56536ca57d0a72d..8970d30c837d565b328373eb367f930d319e2b46 100644 (file)
@@ -1648,7 +1648,11 @@ class BBCode
                                // Check for style sheet commands
                                $text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '<span style="$1">$2</span>', $text);
 
+                               // Mastodon Emoji (internal tag, do not document for users)
+                               $text = preg_replace("(\[emoji=(.*?)](.*?)\[/emoji])ism", '<span class="mastodon emoji"><img src="$1" alt="$2" title="$2"/></span>', $text);
+
                                // Check for CSS classes
+                               // @deprecated since 2021.12, left for backward-compatibility reasons
                                $text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '<span class="$1">$2</span>', $text);
 
                                // handle nested lists
index 51a7ede2f2bbf7b12acbc9c98e32fa407a915a47..f10df66b6f52b65d81101ec9ac04b02182681f8b 100644 (file)
@@ -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)
                        )
                );