Compare commits
2 Commits
9f1dcb3ee9
...
1885af1a34
Author | SHA1 | Date | |
---|---|---|---|
1885af1a34 | |||
a6df981cae |
@ -1049,12 +1049,12 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
# sanitized_message.sub!(/\n?\[signature\]\n?\z/, '')
|
# sanitized_message.sub!(/\n?\[signature\]\n?\z/, '')
|
||||||
# sanitized_message.gsub(/\n?\[signature\]\n?/, '')
|
# sanitized_message.gsub(/\n?\[signature\]\n?/, '')
|
||||||
sanitized_message.gsub!(/[\r\n]*\[signature\][\r\n]*/, '')
|
sanitized_message.gsub!(/[\r\n]*\[signature\][\r\n]*/, '')
|
||||||
|
|
||||||
|
# Remove [inline] style inlining.
|
||||||
sanitized_message.gsub!(/[\r\n]*\[inline.*\][\r\n]*/, '')
|
sanitized_message.gsub!(/[\r\n]*\[inline.*\][\r\n]*/, '')
|
||||||
|
|
||||||
# Ensure minimum length
|
# Remove ![http://data:image/, etc. as this is not supported.
|
||||||
if sanitized_message.strip.empty? || sanitized_message.length < 5
|
sanitized_message.gsub!(/!\[data:image\/[^\]]+\]\([^)]+\)/, '')
|
||||||
sanitized_message = "Empty post contents."
|
|
||||||
end
|
|
||||||
|
|
||||||
# Ensure sentence structure
|
# Ensure sentence structure
|
||||||
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
|
unless sanitized_message.match?(/[.!?]\s|[.!?]$/)
|
||||||
@ -1079,6 +1079,11 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
# Convert inline image syntax from `!(url)` to `![url](url)`
|
# Convert inline image syntax from `!(url)` to `![url](url)`
|
||||||
sanitized_message.gsub!(/!\((http[s]?:\/\/[^\)]+)\)/, '![\1](\1)')
|
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
|
sanitized_message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user