Compare commits

...

2 Commits

View File

@ -1049,12 +1049,12 @@ class GossamerForumsImporter < ImportScripts::Base
# sanitized_message.sub!(/\n?\[signature\]\n?\z/, '')
# sanitized_message.gsub(/\n?\[signature\]\n?/, '')
sanitized_message.gsub!(/[\r\n]*\[signature\][\r\n]*/, '')
# Remove [inline] style inlining.
sanitized_message.gsub!(/[\r\n]*\[inline.*\][\r\n]*/, '')
# Ensure minimum length
if sanitized_message.strip.empty? || sanitized_message.length < 5
sanitized_message = "Empty post contents."
end
# Remove ![http://data:image/, etc. as this is not supported.
sanitized_message.gsub!(/!\[data:image\/[^\]]+\]\([^)]+\)/, '')
# Ensure sentence structure
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
@ -1079,6 +1079,11 @@ class GossamerForumsImporter < ImportScripts::Base
# Convert inline image syntax from `!(url)` to `![url](url)`
sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![\1](\1)')
# Ensure minimum length
if sanitized_message.strip.empty? || sanitized_message.length < 5
sanitized_message = "Empty post contents."
end
sanitized_message
end