Avoid autolinking Markdown URIs (ticket:177)

This commit is contained in:
Alexey Verkhovsky 2005-06-09 20:24:14 +00:00
parent ebe0af1dfc
commit 79eb882a31
3 changed files with 13 additions and 2 deletions

View file

@ -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')

View file

@ -142,6 +142,8 @@ class WikiContent < String
@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

View file

@ -73,6 +73,15 @@ class RevisionTest < Test::Unit::TestCase
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
textile_and_markdown = [