mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Vanilla importer: add an option for whether vanilla_mysql.rb should convert html markup into literals
This commit is contained in:
parent
7b755c3280
commit
6e3d52901a
@ -7,6 +7,7 @@ class ImportScripts::VanillaSQL < ImportScripts::Base
|
|||||||
VANILLA_DB = "vanilla_mysql"
|
VANILLA_DB = "vanilla_mysql"
|
||||||
TABLE_PREFIX = "GDN_"
|
TABLE_PREFIX = "GDN_"
|
||||||
BATCH_SIZE = 1000
|
BATCH_SIZE = 1000
|
||||||
|
CONVERT_HTML = true
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@ -189,17 +190,19 @@ class ImportScripts::VanillaSQL < ImportScripts::Base
|
|||||||
# [SAMP]...[/SAMP]
|
# [SAMP]...[/SAMP]
|
||||||
raw.gsub!(/\[\/?samp\]/i, "`")
|
raw.gsub!(/\[\/?samp\]/i, "`")
|
||||||
|
|
||||||
# replace all chevrons with HTML entities
|
unless CONVERT_HTML
|
||||||
# NOTE: must be done
|
# replace all chevrons with HTML entities
|
||||||
# - AFTER all the "code" processing
|
# NOTE: must be done
|
||||||
# - BEFORE the "quote" processing
|
# - AFTER all the "code" processing
|
||||||
raw = raw.gsub(/`([^`]+)`/im) { "`" + $1.gsub("<", "\u2603") + "`" }
|
# - BEFORE the "quote" processing
|
||||||
.gsub("<", "<")
|
raw = raw.gsub(/`([^`]+)`/im) { "`" + $1.gsub("<", "\u2603") + "`" }
|
||||||
.gsub("\u2603", "<")
|
.gsub("<", "<")
|
||||||
|
.gsub("\u2603", "<")
|
||||||
|
|
||||||
raw = raw.gsub(/`([^`]+)`/im) { "`" + $1.gsub(">", "\u2603") + "`" }
|
raw = raw.gsub(/`([^`]+)`/im) { "`" + $1.gsub(">", "\u2603") + "`" }
|
||||||
.gsub(">", ">")
|
.gsub(">", ">")
|
||||||
.gsub("\u2603", ">")
|
.gsub("\u2603", ">")
|
||||||
|
end
|
||||||
|
|
||||||
# [URL=...]...[/URL]
|
# [URL=...]...[/URL]
|
||||||
raw.gsub!(/\[url="?(.+?)"?\](.+)\[\/url\]/i) { "[#{$2}](#{$1})" }
|
raw.gsub!(/\[url="?(.+?)"?\](.+)\[\/url\]/i) { "[#{$2}](#{$1})" }
|
||||||
|
Loading…
Reference in New Issue
Block a user