Merge pull request #10888 from MrPetovan/task/10887-bbcode-style-block
Add conditional block output for BBCode tag [style]
This commit is contained in:
commit
df99ca8d82
|
@ -644,10 +644,16 @@ On Mastodon this field is used for the content warning.
|
||||||
</td>
|
</td>
|
||||||
<td>;-) :-O</td>
|
<td>;-) :-O</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Custom block styles<br>
|
||||||
|
<br>
|
||||||
|
[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style]</td>
|
||||||
|
<td><div style="text-shadow: 0 0 4px #cc0000;;">You can change all the CSS properties of this block.</div></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Custom inline styles<br>
|
<td>Custom inline styles<br>
|
||||||
<br>
|
<br>
|
||||||
[style=text-shadow: 0 0 4px #CC0000;]You can change all the CSS properties of this block.[/style]</td>
|
[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>
|
<td>You can change all <span style="text-shadow: 0 0 4px #cc0000;;">the CSS properties of this inline text.</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -603,11 +603,17 @@ Dieses Feld wird von Mastodon für die Inhaltswarnung (content warning) verw
|
||||||
</td>
|
</td>
|
||||||
<td>;-) :-O</td>
|
<td>;-) :-O</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Benutzerdefinierte Block-Styles<br>
|
||||||
|
<br>
|
||||||
|
[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style]</td>
|
||||||
|
<td><div style="text-shadow: 0 0 4px #cc0000;;">Du kannst alle CSS-Eigenschaften eines Blocks ändern.</div></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Benutzerdefinierte Inline-Styles<br>
|
<td>Benutzerdefinierte Inline-Styles<br>
|
||||||
<br>
|
<br>
|
||||||
[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style]</td>
|
[style=text-shadow: 0 0 4px #CC0000;]Du kannst alle CSS-Eigenschaften eines Blocks ändern-[/style]</td>
|
||||||
<td><span style="text-shadow: 0 0 4px #cc0000;;">Du kannst alle CSS-Eigenschaften eines Blocks ändern-</span></td>
|
<td>Du kannst alle <span style="text-shadow: 0 0 4px #cc0000;;">CSS-Eigenschaften dieses Inline-Textes ändern-</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -1560,9 +1560,6 @@ class BBCode
|
||||||
$text = self::convertAttachment($text, $simple_html, $try_oembed, [], $uriid);
|
$text = self::convertAttachment($text, $simple_html, $try_oembed, [], $uriid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add HTML new lines
|
|
||||||
$text = str_replace("\n", '<br>', $text);
|
|
||||||
|
|
||||||
$nosmile = strpos($text, '[nosmile]') !== false;
|
$nosmile = strpos($text, '[nosmile]') !== false;
|
||||||
$text = str_replace('[nosmile]', '', $text);
|
$text = str_replace('[nosmile]', '', $text);
|
||||||
|
|
||||||
|
@ -1645,7 +1642,10 @@ class BBCode
|
||||||
// Check for list text
|
// Check for list text
|
||||||
$text = str_replace("[*]", "<li>", $text);
|
$text = str_replace("[*]", "<li>", $text);
|
||||||
|
|
||||||
// Check for style sheet commands
|
// Check for block-level custom CSS
|
||||||
|
$text = preg_replace('#(?<=^|\n)\[style=(.*?)](.*?)\[/style](?:\n|$)#ism', '<div style="$1">$2</div>', $text);
|
||||||
|
|
||||||
|
// Check for inline custom CSS
|
||||||
$text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '<span style="$1">$2</span>', $text);
|
$text = preg_replace("(\[style=(.*?)\](.*?)\[\/style\])ism", '<span style="$1">$2</span>', $text);
|
||||||
|
|
||||||
// Mastodon Emoji (internal tag, do not document for users)
|
// Mastodon Emoji (internal tag, do not document for users)
|
||||||
|
@ -1654,6 +1654,8 @@ class BBCode
|
||||||
// Check for CSS classes
|
// Check for CSS classes
|
||||||
// @deprecated since 2021.12, left for backward-compatibility reasons
|
// @deprecated since 2021.12, left for backward-compatibility reasons
|
||||||
$text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '<span class="$1">$2</span>', $text);
|
$text = preg_replace("(\[class=(.*?)\](.*?)\[\/class\])ism", '<span class="$1">$2</span>', $text);
|
||||||
|
// Add HTML new lines
|
||||||
|
$text = str_replace("\n", '<br>', $text);
|
||||||
|
|
||||||
// handle nested lists
|
// handle nested lists
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user