Update Util
Updated Util convert_html_to_bbcode() to fix p tags.
This commit is contained in:
parent
199f2cdc9d
commit
95345fc50b
1 changed files with 5 additions and 1 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue