Avoid autolinking Markdown URIs (ticket:177)
This commit is contained in:
parent
ebe0af1dfc
commit
79eb882a31
|
@ -71,7 +71,7 @@ class URIChunk < Chunk::Abstract
|
|||
'(?=\.?(?:\s|\)|\z))' # ends only with optional dot + space or ")"
|
||||
# or end of the string
|
||||
|
||||
SUSPICIOUS_PRECEDING_CHARACTER = '(!|\"\:|\"|\\\')?' # any of !, ":, ", '
|
||||
SUSPICIOUS_PRECEDING_CHARACTER = '(!|\"\:|\"|\\\'|\]\()?' # any of !, ":, ", ', ](
|
||||
|
||||
INTERNET_URI_REGEXP =
|
||||
Regexp.new(SUSPICIOUS_PRECEDING_CHARACTER + INTERNET_URI, Regexp::EXTENDED, 'N')
|
||||
|
|
|
@ -141,7 +141,9 @@ class WikiContent < String
|
|||
@options[:engine] = Engines::MAP[@web.markup]
|
||||
@options[:engine_opts] = [:filter_html, :filter_styles] if @web.safe_mode
|
||||
@options[:active_chunks] = (ACTIVE_CHUNKS - [WikiChunk::Word] ) if @web.brackets_only
|
||||
|
||||
|
||||
@not_rendered = @pre_rendered = nil
|
||||
|
||||
super(@revision.content)
|
||||
init_chunk_manager
|
||||
build_chunks
|
||||
|
|
|
@ -72,6 +72,15 @@ class RevisionTest < Test::Unit::TestCase
|
|||
%{return ThatWay\n</code></pre>\n\n<p>Nice!</p>},
|
||||
code_block)
|
||||
end
|
||||
|
||||
def test_markdown_hyperlink_with_slash
|
||||
# in response to a bug, see http://dev.instiki.org/attachment/ticket/177
|
||||
@web.markup = :markdown
|
||||
|
||||
assert_markup_parsed_as(
|
||||
'<p><a href="http://example/with/slash">text</a></p>',
|
||||
'[text](http://example/with/slash)')
|
||||
end
|
||||
|
||||
def test_mixed_formatting
|
||||
|
||||
|
|
Loading…
Reference in a new issue