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:
Ryan Mulligan 2016-03-02 15:11:33 -08:00
parent bff965327c
commit e1f7d05677
2 changed files with 16 additions and 1 deletions

View File

@ -172,8 +172,10 @@ module ImportScripts::PhpBB3
# no need for this since the importer sets last_seen_at for each user during the import
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?
@settings.use_bbcode_to_md
false
end
def batches

View File

@ -9,6 +9,7 @@ module ImportScripts::PhpBB3
@database = database
@smiley_processor = smiley_processor
@settings = settings
@new_site_prefix = settings.new_site_prefix
create_internal_link_regexps(settings.original_site_prefix)
end
@ -18,6 +19,9 @@ module ImportScripts::PhpBB3
text = CGI.unescapeHTML(text)
clean_bbcodes(text)
if @settings.use_bbcode_to_md
text = bbcode_to_md(text)
end
process_smilies(text)
process_links(text)
process_lists(text)
@ -46,6 +50,15 @@ module ImportScripts::PhpBB3
text.gsub!(/:(?:\w{8})\]/, ']')
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)
@smiley_processor.replace_smilies(text)
end