Fix dtext.parse_strip failing for nil (closes #2662)
This commit is contained in:
@@ -219,7 +219,7 @@ class DText
|
|||||||
else
|
else
|
||||||
"<#{tag}>" + parse_inline(content, options) + "</#{tag}>"
|
"<#{tag}>" + parse_inline(content, options) + "</#{tag}>"
|
||||||
end
|
end
|
||||||
when /\A(h[1-6])\#([A-z][_A-z0-9-]+)\.\s*(.+)\Z/
|
when /\A(h[1-6])\#([A-z][_A-z0-9-]+)\.\s*(.+)\Z/
|
||||||
tag = $1
|
tag = $1
|
||||||
header_id = $2
|
header_id = $2
|
||||||
content = $3
|
content = $3
|
||||||
@@ -339,6 +339,8 @@ class DText
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.strip(s)
|
def self.strip(s)
|
||||||
|
return "" if s.blank?
|
||||||
|
|
||||||
s.gsub!(/[\r\n]+/m, " ")
|
s.gsub!(/[\r\n]+/m, " ")
|
||||||
s.gsub!(/\[\/?(?:b|i|s|u|tn|tr|td|th|thead|tbody|quote|code|spoilers|spoiler|expand|table)\]/, "")
|
s.gsub!(/\[\/?(?:b|i|s|u|tn|tr|td|th|thead|tbody|quote|code|spoilers|spoiler|expand|table)\]/, "")
|
||||||
s.gsub!(/\[\[([^\|\]]+)\|([^\]]+)\]\]/m, '\2')
|
s.gsub!(/\[\[([^\|\]]+)\|([^\]]+)\]\]/m, '\2')
|
||||||
|
|||||||
Reference in New Issue
Block a user