mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:21:55 +08:00
phpbb-import-script: move bbcode_to_md to before other text processing
This seems to fix the issue I reported at https://meta.discourse.org/t/import-script-phpbb/40424
This commit is contained in:
parent
bff965327c
commit
e1f7d05677
|
@ -172,8 +172,10 @@ module ImportScripts::PhpBB3
|
||||||
# no need for this since the importer sets last_seen_at for each user during the import
|
# no need for this since the importer sets last_seen_at for each user during the import
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Do not use the bbcode_to_md in base.rb. If enabled, it will be
|
||||||
|
# used in text_processor.rb instead.
|
||||||
def use_bbcode_to_md?
|
def use_bbcode_to_md?
|
||||||
@settings.use_bbcode_to_md
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def batches
|
def batches
|
||||||
|
|
|
@ -9,6 +9,7 @@ module ImportScripts::PhpBB3
|
||||||
@database = database
|
@database = database
|
||||||
@smiley_processor = smiley_processor
|
@smiley_processor = smiley_processor
|
||||||
|
|
||||||
|
@settings = settings
|
||||||
@new_site_prefix = settings.new_site_prefix
|
@new_site_prefix = settings.new_site_prefix
|
||||||
create_internal_link_regexps(settings.original_site_prefix)
|
create_internal_link_regexps(settings.original_site_prefix)
|
||||||
end
|
end
|
||||||
|
@ -18,6 +19,9 @@ module ImportScripts::PhpBB3
|
||||||
text = CGI.unescapeHTML(text)
|
text = CGI.unescapeHTML(text)
|
||||||
|
|
||||||
clean_bbcodes(text)
|
clean_bbcodes(text)
|
||||||
|
if @settings.use_bbcode_to_md
|
||||||
|
text = bbcode_to_md(text)
|
||||||
|
end
|
||||||
process_smilies(text)
|
process_smilies(text)
|
||||||
process_links(text)
|
process_links(text)
|
||||||
process_lists(text)
|
process_lists(text)
|
||||||
|
@ -46,6 +50,15 @@ module ImportScripts::PhpBB3
|
||||||
text.gsub!(/:(?:\w{8})\]/, ']')
|
text.gsub!(/:(?:\w{8})\]/, ']')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def bbcode_to_md(text)
|
||||||
|
begin
|
||||||
|
text.bbcode_to_md(false)
|
||||||
|
rescue e
|
||||||
|
puts "Problem converting \n#{text}\n using ruby-bbcode-to-md"
|
||||||
|
text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def process_smilies(text)
|
def process_smilies(text)
|
||||||
@smiley_processor.replace_smilies(text)
|
@smiley_processor.replace_smilies(text)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user