DEV: Fix some regexes in phpBB3 import script (#15829)
1. bbcode hashes don't always have exactly 8 characters. 2. colors aren't always hex values, it can be a color string ("red", "blue", etc). 3. The closing tag of smileys doesn't always include a `:` character (the start of the regex was already right for this particular issue)
This commit is contained in:
parent
492226a973
commit
ea2fd75d10
|
@ -18,7 +18,7 @@ module ImportScripts::PhpBB3
|
|||
|
||||
def replace_smilies(text)
|
||||
# :) is encoded as <!-- s:) --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
|
||||
text.gsub!(/<!-- s(\S+) --><img src="\{SMILIES_PATH\}\/.+?" alt=".*?" title=".*?" \/><!-- s?:\S+ -->/) do
|
||||
text.gsub!(/<!-- s(\S+) --><img src="\{SMILIES_PATH\}\/.+?" alt=".*?" title=".*?" \/><!-- s?\S+ -->/) do
|
||||
emoji($1)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,10 +78,10 @@ module ImportScripts::PhpBB3
|
|||
# Many phpbb bbcode tags have a hash attached to them. Examples:
|
||||
# [url=https://google.com:1qh1i7ky]click here[/url:1qh1i7ky]
|
||||
# [quote="cybereality":b0wtlzex]Some text.[/quote:b0wtlzex]
|
||||
text.gsub!(/:(?:\w{8})\]/, ']')
|
||||
text.gsub!(/:(?:\w{5,8})\]/, ']')
|
||||
|
||||
# remove color tags
|
||||
text.gsub!(/\[\/?color(=#[a-z0-9]*)?\]/i, "")
|
||||
text.gsub!(/\[\/?color(=#?[a-z0-9]*)?\]/i, "")
|
||||
end
|
||||
|
||||
def bbcode_to_md(text)
|
||||
|
|
Loading…
Reference in New Issue