diff options
| author | Dan Allen <dallen@redhat.com> | 2013-04-25 20:29:07 -0600 |
|---|---|---|
| committer | Dan Allen <dallen@redhat.com> | 2013-04-25 20:29:07 -0600 |
| commit | ebb591afa0029cd96fa2a9086e06fc879c028edd (patch) | |
| tree | 7835b33e16b9f940e7416ecb54e63fd445a7286e | |
| parent | 5bb2e756032809079ef25d38369471b5f34413f1 (diff) | |
resolves #280 trailing comma shouldn't be included in link
| -rwxr-xr-x | lib/asciidoctor.rb | 2 | ||||
| -rw-r--r-- | test/substitutions_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb index f880ce7b..87813b39 100755 --- a/lib/asciidoctor.rb +++ b/lib/asciidoctor.rb @@ -371,7 +371,7 @@ module Asciidoctor # inline link and some inline link macro # FIXME revisit! - :link_inline => %r{(^|link:|\s|>|<|[\(\)\[\]])(\\?(?:https?|ftp)://[^\s\[<]*[^\s.\[<])(?:\[((?:\\\]|[^\]])*?)\])?}, + :link_inline => %r{(^|link:|\s|>|<|[\(\)\[\]])(\\?(?:https?|ftp)://[^\s\[<]*[^\s.,\[<])(?:\[((?:\\\]|[^\]])*?)\])?}, # inline link macro # link:path[label] diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb index d8d2f4db..91a1f6ef 100644 --- a/test/substitutions_test.rb +++ b/test/substitutions_test.rb @@ -348,6 +348,11 @@ context 'Substitutions' do assert_equal %q{http://google.com}, para.sub_macros(para.buffer.join) end + test 'a comma separated list of links should not include commas in links' do + para = block_from_string('http://foo.com, http://bar.com, http://example.org') + assert_equal %q{<a href="http://foo.com">http://foo.com</a>, <a href="http://bar.com">http://bar.com</a>, <a href="http://example.org">http://example.org</a>}, para.sub_macros(para.buffer.join) + end + test 'a single-line image macro should be interpreted as an image' do para = block_from_string('image:tiger.png[]') assert_equal %{<span class="image"><img src="tiger.png" alt="tiger"></span>}, para.sub_macros(para.buffer.join).gsub(/>\s+</, '><') |
