Update Util

Updated Util convert_html_to_bbcode() to fix p tags.
This commit is contained in:
Mario Steele 2026-03-06 21:20:45 -06:00
parent 199f2cdc9d
commit 95345fc50b

View file

@ -41,10 +41,14 @@ static func convert_html_to_bbcode(html: String) -> String:
# NOTE: Replace <img ... src="..."> with [img]...[/img]
bb = _img_re.sub(bb, "[img]$1[/img]", true)
# NOTE: Remove <p> tags, convert </p> to newline
# NOTE: Replace <h2 ...>...</h2> tags, with [b]...[/b]
bb = _h2_open_re.sub(bb, "[b]", true)
bb = bb.replace("</h2>", "[/b]\n")
# NOTE: Remove <p> tags, convert </p> to new line
bb = _p_open_re.sub(bb, "", true)
bb = bb.replace("</p>", "\n")
# NOTE: List Items: <li> -> •, </li> -> newline
bb = bb.replace("<li>", "")
bb = bb.replace("</li>", "\n")