FIX: Email cooker should link links that don't begin a line

This commit is contained in:
Robin Ward 2016-07-18 13:46:13 -04:00
parent 57f1bf1ddd
commit 6db50b820d
2 changed files with 5 additions and 1 deletions

View file

@ -3,7 +3,7 @@
class EmailCook
def self.url_regexp
/^((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/
/((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/
end
def initialize(raw)

View file

@ -30,4 +30,8 @@ LONG_COOKED
it 'autolinks' do
expect(EmailCook.new("https://www.eviltrout.com").cook).to eq("<a href='https://www.eviltrout.com'>https://www.eviltrout.com</a><br>")
end
it 'autolinks without the beginning of a line' do
expect(EmailCook.new("my site: https://www.eviltrout.com").cook).to eq("my site: <a href='https://www.eviltrout.com'>https://www.eviltrout.com</a><br>")
end
end