mirror of
https://github.com/moebooru/moebooru
synced 2025-08-30 13:37:48 +00:00
Fix url match.
This commit is contained in:
parent
77f4cda49d
commit
407bf21ff9
@ -98,11 +98,13 @@ module DText
|
||||
|
||||
def parseurl(str)
|
||||
url = /(h?ttps?:\/\/\[?(:{0,2}[\w\-]+)((:{1,2}|\.)[\w\-]+)*\]?(:\d+)*(\/[^\s\n]*)*)/
|
||||
str = str.gsub(/<<\s*([^\s]+?)\s*\|\s*(.+?)\s*>>/) do
|
||||
str = str.gsub(/<<\s*([^\s]+?)\s*\|\s*(.+?)\s*>>/) do |match|
|
||||
link = $1
|
||||
name = $2
|
||||
if link =~ url
|
||||
if link =~ /\A#{url}/
|
||||
"<a href=\"#{link}\">#{name}</a>"
|
||||
else
|
||||
match
|
||||
end
|
||||
end
|
||||
str = str.gsub(/(^|\s+)"(.+?)":#{url}/, '\1<a href="\3">\2</a>')
|
||||
|
Loading…
x
Reference in New Issue
Block a user