fix for #699
This commit is contained in:
parent
390587777f
commit
1284fcc92d
2 changed files with 8 additions and 2 deletions
|
|
@ -193,8 +193,8 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:autolinks]
|
if options[:autolinks]
|
||||||
message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2')
|
message.gsub!(/( |^)(www\.[^\s]+\.[^\s])/, '\1http://\2')
|
||||||
message.gsub!(/(<a target="\\?_blank" href=")?(https|http|ftp):\/\/([^ ]+)/) do |m|
|
message.gsub!(/(<a target="\\?_blank" href=")?(https|http|ftp):\/\/([^\s]+)/) do |m|
|
||||||
if !$1.nil?
|
if !$1.nil?
|
||||||
m
|
m
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,12 @@ describe ApplicationHelper do
|
||||||
res = markdownify(message)
|
res = markdownify(message)
|
||||||
res.should == "These<br /\>are<br /\>some<br /\>new<br /\>lines"
|
res.should == "These<br /\>are<br /\>some<br /\>new<br /\>lines"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should render newlines and basic http links correctly' do
|
||||||
|
message = "Some text, then a line break and a link\nhttp://joindiaspora.com\nsome more text"
|
||||||
|
res = markdownify(message)
|
||||||
|
res.should == 'Some text, then a line break and a link<br /><a target="_blank" href="http://joindiaspora.com">joindiaspora.com</a><br />some more text'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'performance' do
|
context 'performance' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue