mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: make markdown regexp patterns case insensitive.
This commit is contained in:
@@ -182,7 +182,7 @@ class InlineUploads
|
||||
end
|
||||
|
||||
def self.match_bbcode_img(markdown, external_src: false)
|
||||
markdown.scan(/(\[img\]\s*([^\[\]\s]+)\s*\[\/img\])/) do |match|
|
||||
markdown.scan(/(\[img\]\s*([^\[\]\s]+)\s*\[\/img\])/i) do |match|
|
||||
if (matched_uploads(match[1]).present? && block_given?) || external_src
|
||||
yield(match[0], match[1], +"", $~.offset(0)[0])
|
||||
end
|
||||
@@ -203,7 +203,7 @@ class InlineUploads
|
||||
end
|
||||
|
||||
def self.match_anchor(markdown, external_href: false)
|
||||
markdown.scan(/((<a[^<]+>)([^<\a>]*?)<\/a>)/) do |match|
|
||||
markdown.scan(/((<a[^<]+>)([^<\a>]*?)<\/a>)/i) do |match|
|
||||
node = Nokogiri::HTML::fragment(match[0]).children[0]
|
||||
href = node.attributes["href"]&.value
|
||||
|
||||
@@ -219,7 +219,7 @@ class InlineUploads
|
||||
end
|
||||
|
||||
def self.match_img(markdown, external_src: false)
|
||||
markdown.scan(/(([ ]*)<(?!img)[^<>]+\/?>)?([\r\n]*)(([ ]*)<img ([^>\n]+)>([ ]*))([\r\n]*)/) do |match|
|
||||
markdown.scan(/(([ ]*)<(?!img)[^<>]+\/?>)?([\r\n]*)(([ ]*)<img ([^>\n]+)>([ ]*))([\r\n]*)/i) do |match|
|
||||
node = Nokogiri::HTML::fragment(match[3].strip).children[0]
|
||||
src = node.attributes["src"]&.value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user