Normalize [ul] and [ol] BBCode output to <ul> and <ol> HTML tags
This commit is contained in:
parent
c3cecf3d28
commit
200bdb55ba
|
@ -1473,8 +1473,8 @@ class BBCode
|
||||||
$text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '</p><ul class="listupperroman" style="list-style-type: upper-roman;">$2</ul><p>', $text);
|
$text = preg_replace("/\[list=((?-i)I)\](.*?)\[\/list\]/ism", '</p><ul class="listupperroman" style="list-style-type: upper-roman;">$2</ul><p>', $text);
|
||||||
$text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '</p><ul class="listloweralpha" style="list-style-type: lower-alpha;">$2</ul><p>', $text);
|
$text = preg_replace("/\[list=((?-i)a)\](.*?)\[\/list\]/ism", '</p><ul class="listloweralpha" style="list-style-type: lower-alpha;">$2</ul><p>', $text);
|
||||||
$text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '</p><ul class="listupperalpha" style="list-style-type: upper-alpha;">$2</ul><p>', $text);
|
$text = preg_replace("/\[list=((?-i)A)\](.*?)\[\/list\]/ism", '</p><ul class="listupperalpha" style="list-style-type: upper-alpha;">$2</ul><p>', $text);
|
||||||
$text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '</p><ul class="listbullet" style="list-style-type: circle;">$1</ul><p>', $text);
|
$text = preg_replace("/\[ul\](.*?)\[\/ul\]/ism", '</p><ul>$1</ul><p>', $text);
|
||||||
$text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '</p><ul class="listdecimal" style="list-style-type: decimal;">$1</ul><p>', $text);
|
$text = preg_replace("/\[ol\](.*?)\[\/ol\]/ism", '</p><ol>$1</ol><p>', $text);
|
||||||
$text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>', $text);
|
$text = preg_replace("/\[li\](.*?)\[\/li\]/ism", '<li>$1</li>', $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,8 +281,8 @@ class HTML
|
||||||
self::tagToBBCode($doc, 'div', [], "\r", "\r");
|
self::tagToBBCode($doc, 'div', [], "\r", "\r");
|
||||||
self::tagToBBCode($doc, 'p', [], "\n", "\n");
|
self::tagToBBCode($doc, 'p', [], "\n", "\n");
|
||||||
|
|
||||||
self::tagToBBCode($doc, 'ul', [], "[list]", "[/list]");
|
self::tagToBBCode($doc, 'ul', [], "[ul]", "[/ul]");
|
||||||
self::tagToBBCode($doc, 'ol', [], "[list=1]", "[/list]");
|
self::tagToBBCode($doc, 'ol', [], "[ol]", "[/ol]");
|
||||||
self::tagToBBCode($doc, 'li', [], "[*]", "");
|
self::tagToBBCode($doc, 'li', [], "[*]", "");
|
||||||
|
|
||||||
self::tagToBBCode($doc, 'hr', [], "[hr]", "");
|
self::tagToBBCode($doc, 'hr', [], "[hr]", "");
|
||||||
|
|
|
@ -158,21 +158,21 @@ class BBCodeTest extends FixtureTest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bug-7271-condensed-space' => [
|
'bug-7271-condensed-space' => [
|
||||||
'expectedHtml' => '<ul class="listdecimal" style="list-style-type:decimal;"><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
'expectedHtml' => '<ol><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ol>',
|
||||||
'text' => '[ol][*] http://example.com/[/ol]',
|
'text' => '[ol][*] http://example.com/[/ol]',
|
||||||
],
|
],
|
||||||
'bug-7271-condensed-nospace' => [
|
'bug-7271-condensed-nospace' => [
|
||||||
'expectedHtml' => '<ul class="listdecimal" style="list-style-type:decimal;"><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
'expectedHtml' => '<ol><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ol>',
|
||||||
'text' => '[ol][*]http://example.com/[/ol]',
|
'text' => '[ol][*]http://example.com/[/ol]',
|
||||||
],
|
],
|
||||||
'bug-7271-indented-space' => [
|
'bug-7271-indented-space' => [
|
||||||
'expectedHtml' => '<ul class="listbullet" style="list-style-type:circle;"><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
'expectedHtml' => '<ul><li> <a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
||||||
'text' => '[ul]
|
'text' => '[ul]
|
||||||
[*] http://example.com/
|
[*] http://example.com/
|
||||||
[/ul]',
|
[/ul]',
|
||||||
],
|
],
|
||||||
'bug-7271-indented-nospace' => [
|
'bug-7271-indented-nospace' => [
|
||||||
'expectedHtml' => '<ul class="listbullet" style="list-style-type:circle;"><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
'expectedHtml' => '<ul><li><a href="http://example.com/" target="_blank" rel="noopener noreferrer">http://example.com/</a></li></ul>',
|
||||||
'text' => '[ul]
|
'text' => '[ul]
|
||||||
[*]http://example.com/
|
[*]http://example.com/
|
||||||
[/ul]',
|
[/ul]',
|
||||||
|
@ -259,7 +259,7 @@ Karl Marx - Die ursprüngliche Akkumulation
|
||||||
'text' => '[emoji=https://fedi.underscore.world/emoji/custom/custom/heart_nb.png]:heart_nb:[/emoji]',
|
'text' => '[emoji=https://fedi.underscore.world/emoji/custom/custom/heart_nb.png]:heart_nb:[/emoji]',
|
||||||
],
|
],
|
||||||
'task-12900-multiple-paragraphs' => [
|
'task-12900-multiple-paragraphs' => [
|
||||||
'expectedHTML' => '<h1>Header</h1><ul class="listbullet" style="list-style-type:circle;"><li>One</li><li>Two</li></ul><p>This is a paragraph<br>with a line feed.</p><p>Second Chapter</p>',
|
'expectedHTML' => '<h1>Header</h1><ul><li>One</li><li>Two</li></ul><p>This is a paragraph<br>with a line feed.</p><p>Second Chapter</p>',
|
||||||
'text' => "[h1]Header[/h1][ul][*]One[*]Two[/ul]\n\nThis is a paragraph\nwith a line feed.\n\nSecond Chapter",
|
'text' => "[h1]Header[/h1][ul][*]One[*]Two[/ul]\n\nThis is a paragraph\nwith a line feed.\n\nSecond Chapter",
|
||||||
],
|
],
|
||||||
'task-12900-header-with-paragraphs' => [
|
'task-12900-header-with-paragraphs' => [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user