FIX: smf1 importer was swallowing some data
This commit is contained in:
parent
14a0879658
commit
5434cf02a3
|
@ -561,8 +561,8 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
IGNORED_BBCODE ||= %w{
|
IGNORED_BBCODE ||= %w{
|
||||||
black blue center color email flash font glow green img iurl left list move
|
black blue center color email flash font glow green iurl left list move red
|
||||||
red right shadown size table time white
|
right shadown size table time white
|
||||||
}
|
}
|
||||||
|
|
||||||
def pre_process_raw(raw)
|
def pre_process_raw(raw)
|
||||||
|
@ -571,7 +571,7 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
raw = @htmlentities.decode(raw)
|
raw = @htmlentities.decode(raw)
|
||||||
|
|
||||||
# [acronym]
|
# [acronym]
|
||||||
raw.gsub!(/\[acronym=([^\]]+)\](.*?)\[\/acronym\]/im, %{<abbr title="#{$1}">#{$2}</abbr>})
|
raw.gsub!(/\[acronym=([^\]]+)\](.*?)\[\/acronym\]/im) { %{<abbr title="#{$1}">#{$2}</abbr>} }
|
||||||
|
|
||||||
# [br]
|
# [br]
|
||||||
raw.gsub!(/\[br\]/i, "\n")
|
raw.gsub!(/\[br\]/i, "\n")
|
||||||
|
@ -580,9 +580,9 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
raw.gsub!(/\[hr\]/i, "<hr/>")
|
raw.gsub!(/\[hr\]/i, "<hr/>")
|
||||||
|
|
||||||
# [sub]
|
# [sub]
|
||||||
raw.gsub!(/\[sub\](.*?)\[\/sub\]/im, "<sub>#{$1}</sub>")
|
raw.gsub!(/\[sub\](.*?)\[\/sub\]/im) { "<sub>#{$1}</sub>" }
|
||||||
# [sup]
|
# [sup]
|
||||||
raw.gsub!(/\[sup\](.*?)\[\/sup\]/im, "<sup>#{$1}</sup>")
|
raw.gsub!(/\[sup\](.*?)\[\/sup\]/im) { "<sup>#{$1}</sup>" }
|
||||||
|
|
||||||
# [html]
|
# [html]
|
||||||
raw.gsub!(/\[html\]/i, "\n```html\n")
|
raw.gsub!(/\[html\]/i, "\n```html\n")
|
||||||
|
@ -606,13 +606,16 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
raw.gsub!(/\[\/ftp\]/i, "[/url]")
|
raw.gsub!(/\[\/ftp\]/i, "[/url]")
|
||||||
|
|
||||||
# [me]
|
# [me]
|
||||||
raw.gsub!(/\[me=([^\]]*)\](.*?)\[\/me\]/im, "_\\* #{$1} #{$2}_")
|
raw.gsub!(/\[me=([^\]]*)\](.*?)\[\/me\]/im) { "_\\* #{$1} #{$2}_" }
|
||||||
|
|
||||||
# [li]
|
# [li]
|
||||||
raw.gsub!(/\[li\](.*?)\[\/li\]/im, "- #{$1}")
|
raw.gsub!(/\[li\](.*?)\[\/li\]/im) { "- #{$1}" }
|
||||||
|
|
||||||
|
# puts [img] on their own line
|
||||||
|
raw.gsub!(/\[img\](.*?)\[\/img\]/im) { "\n#{$1}\n" }
|
||||||
|
|
||||||
# puts [youtube] on their own line
|
# puts [youtube] on their own line
|
||||||
raw.gsub!(/\[youtube\](.*?)\[\/youtube\]/im, "\n#{$1}\n")
|
raw.gsub!(/\[youtube\](.*?)\[\/youtube\]/im) { "\n#{$1}\n" }
|
||||||
|
|
||||||
IGNORED_BBCODE.each { |code| raw.gsub!(/\[#{code}[^\]]*\](.*?)\[\/#{code}\]/im, '\1') }
|
IGNORED_BBCODE.each { |code| raw.gsub!(/\[#{code}[^\]]*\](.*?)\[\/#{code}\]/im, '\1') }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue