Fix the build.

This commit is contained in:
Guo Xiang Tan 2019-06-13 13:53:43 +08:00
parent 7a0d031bc4
commit 9daed05ad0
2 changed files with 3 additions and 3 deletions

View File

@ -105,7 +105,7 @@ module Jobs
InlineUploads.match_img(raw, external_src: true, &replace_raw) InlineUploads.match_img(raw, external_src: true, &replace_raw)
# BBCode tag - [img]http://...[/img] # BBCode tag - [img]http://...[/img]
InlineUploads.match_bbcode_img(raw, &replace_raw) InlineUploads.match_bbcode_img(raw, external_src: true, &replace_raw)
# Markdown linked image - [![alt](http://...)](http://...) # Markdown linked image - [![alt](http://...)](http://...)
# Markdown inline - ![alt](http://...) # Markdown inline - ![alt](http://...)

View File

@ -164,9 +164,9 @@ class InlineUploads
end end
end end
def self.match_bbcode_img(markdown) def self.match_bbcode_img(markdown, external_src: false)
markdown.scan(/(\[img\]\s?(.+)\s?\[\/img\])/) do |match| markdown.scan(/(\[img\]\s?(.+)\s?\[\/img\])/) do |match|
if matched_uploads(match[1]).present? && block_given? if (matched_uploads(match[1]).present? && block_given?) || external_src
yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0]) yield(match[0], match[1], +"![](#{PLACEHOLDER})", $~.offset(0)[0])
end end
end end