AUTO_LINK_RE = %r{
( # leading text
<\w+.*?>| # leading HTML tag, or
- [^=<>!:'"/]| # leading punctuation, or
+ [\s\(\[,;]| # leading punctuation, or
^ # beginning of line
)
(
# invalid urls
'http://' => 'http://',
'www.' => 'www.',
+ 'test-www.bar.com' => 'test-www.bar.com',
}
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
end
def test_auto_mailto
- assert_equal '<p><a class="email" href="mailto:test@foo.bar">test@foo.bar</a></p>',
- textilizable('test@foo.bar')
+ to_test = {
+ 'test@foo.bar' => '<a class="email" href="mailto:test@foo.bar">test@foo.bar</a>',
+ 'test@www.foo.bar' => '<a class="email" href="mailto:test@www.foo.bar">test@www.foo.bar</a>',
+ }
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
def test_inline_images