FIX: BBcode edge case for `InlineUploads`.
This commit is contained in:
parent
f096c994de
commit
53efb7bd24
|
@ -177,7 +177,7 @@ class InlineUploads
|
|||
end
|
||||
|
||||
def self.match_bbcode_img(markdown, external_src: false)
|
||||
markdown.scan(/(\[img\]\s?(.+)\s?\[\/img\])/) do |match|
|
||||
markdown.scan(/(\[img\]\s*([^\[\]\s]+)\s*\[\/img\])/) do |match|
|
||||
if (matched_uploads(match[1]).present? && block_given?) || external_src
|
||||
yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0])
|
||||
end
|
||||
|
|
|
@ -163,6 +163,8 @@ RSpec.describe InlineUploads do
|
|||
[img]
|
||||
#{upload2.url}
|
||||
[/img]
|
||||
|
||||
[img]#{upload.url}[/img][img]#{upload2.url}[/img]
|
||||
MD
|
||||
|
||||
expect(InlineUploads.process(md)).to eq(<<~MD)
|
||||
|
@ -171,6 +173,8 @@ RSpec.describe InlineUploads do
|
|||
![](#{upload3.short_url})
|
||||
|
||||
![](#{upload2.short_url})
|
||||
|
||||
![](#{upload.short_url})![](#{upload2.short_url})
|
||||
MD
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue