Merge pull request #4586 from mabras/fix-nil-vb4-importer

fix nil for vb4 importer
This commit is contained in:
Guo Xiang Tan 2016-12-05 04:47:12 +01:00 committed by GitHub
commit c3745ee861
1 changed files with 9 additions and 9 deletions

View File

@ -516,15 +516,15 @@ class ImportScripts::VBulletin < ImportScripts::Base
# fix whitespaces # fix whitespaces
raw.gsub!(/(\\r)?\\n/, "\n") raw.gsub!(/(\\r)?\\n/, "\n")
.gsub!("\\t", "\t") raw.gsub!("\\t", "\t")
# [HTML]...[/HTML] # [HTML]...[/HTML]
raw.gsub!(/\[html\]/i, "\n```html\n") raw.gsub!(/\[html\]/i, "\n```html\n")
.gsub!(/\[\/html\]/i, "\n```\n") raw.gsub!(/\[\/html\]/i, "\n```\n")
# [PHP]...[/PHP] # [PHP]...[/PHP]
raw.gsub!(/\[php\]/i, "\n```php\n") raw.gsub!(/\[php\]/i, "\n```php\n")
.gsub!(/\[\/php\]/i, "\n```\n") raw.gsub!(/\[\/php\]/i, "\n```\n")
# [HIGHLIGHT="..."] # [HIGHLIGHT="..."]
raw.gsub!(/\[highlight="?(\w+)"?\]/i) { "\n```#{$1.downcase}\n" } raw.gsub!(/\[highlight="?(\w+)"?\]/i) { "\n```#{$1.downcase}\n" }
@ -532,7 +532,7 @@ class ImportScripts::VBulletin < ImportScripts::Base
# [CODE]...[/CODE] # [CODE]...[/CODE]
# [HIGHLIGHT]...[/HIGHLIGHT] # [HIGHLIGHT]...[/HIGHLIGHT]
raw.gsub!(/\[\/?code\]/i, "\n```\n") raw.gsub!(/\[\/?code\]/i, "\n```\n")
.gsub!(/\[\/?highlight\]/i, "\n```\n") raw.gsub!(/\[\/?highlight\]/i, "\n```\n")
# [SAMP]...[/SAMP] # [SAMP]...[/SAMP]
raw.gsub!(/\[\/?samp\]/i, "`") raw.gsub!(/\[\/?samp\]/i, "`")
@ -542,12 +542,12 @@ class ImportScripts::VBulletin < ImportScripts::Base
# - AFTER all the "code" processing # - AFTER all the "code" processing
# - BEFORE the "quote" processing # - BEFORE the "quote" processing
raw.gsub!(/`([^`]+)`/im) { "`" + $1.gsub("<", "\u2603") + "`" } raw.gsub!(/`([^`]+)`/im) { "`" + $1.gsub("<", "\u2603") + "`" }
.gsub!("<", "&lt;") raw.gsub!("<", "&lt;")
.gsub!("\u2603", "<") raw.gsub!("\u2603", "<")
raw.gsub!(/`([^`]+)`/im) { "`" + $1.gsub(">", "\u2603") + "`" } raw.gsub!(/`([^`]+)`/im) { "`" + $1.gsub(">", "\u2603") + "`" }
.gsub!(">", "&gt;") raw.gsub!(">", "&gt;")
.gsub!("\u2603", ">") raw.gsub!("\u2603", ">")
# [URL=...]...[/URL] # [URL=...]...[/URL]
raw.gsub!(/\[url="?([^"]+?)"?\](.*?)\[\/url\]/im) { "[#{$2.strip}](#{$1})" } raw.gsub!(/\[url="?([^"]+?)"?\](.*?)\[\/url\]/im) { "[#{$2.strip}](#{$1})" }
@ -556,7 +556,7 @@ class ImportScripts::VBulletin < ImportScripts::Base
# [URL]...[/URL] # [URL]...[/URL]
# [MP3]...[/MP3] # [MP3]...[/MP3]
raw.gsub!(/\[\/?url\]/i, "") raw.gsub!(/\[\/?url\]/i, "")
.gsub!(/\[\/?mp3\]/i, "") raw.gsub!(/\[\/?mp3\]/i, "")
# [MENTION]<username>[/MENTION] # [MENTION]<username>[/MENTION]
raw.gsub!(/\[mention\](.+?)\[\/mention\]/i) do raw.gsub!(/\[mention\](.+?)\[\/mention\]/i) do