mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
Merge pull request #4054 from ryantm/phpbb-import-script
phpbb-import-script: move bbcode_to_md to before other text processing
This commit is contained in:
commit
5741717322
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user