summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-03-02 03:15:53 -0700
committerGitHub <noreply@github.com>2019-03-02 03:15:53 -0700
commit7fec779e66da113347bb65af73a84ea7da75d564 (patch)
treeaac3a0fd2ef7e01b434f3bdec9e64ad5cc40c5d6
parentab1addcaee8b3b2f0da64b92175bd98f99d02638 (diff)
resolves #2553 allow ampersand in implicit email address (PR #2936)
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor.rb2
-rw-r--r--test/substitutions_test.rb2
3 files changed, 4 insertions, 1 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 502180e6..33481140 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -67,6 +67,7 @@ Enhancements / Compliance::
* allow backend to delegate to a registered backend using the syntax synthetic:delegate when using custom templates (e.g., slides:html) (#891)
* AbstractBlock#find_by looks inside AsciiDoc table cells if traverse_documents selector option is true (#3101)
* AbstractBlock#find_by finds table cells, which can be selected using the :table_cell context in the selector (#2524)
+ * allow ampersand to be used in e-mail address (#2553)
Improvements::
diff --git a/lib/asciidoctor.rb b/lib/asciidoctor.rb
index aa112999..380309c1 100644
--- a/lib/asciidoctor.rb
+++ b/lib/asciidoctor.rb
@@ -828,7 +828,7 @@ module Asciidoctor
#
# doc.writer@example.com
#
- InlineEmailRx = %r(([\\>:/])?#{CG_WORD}[#{CC_WORD}.%+-]*@#{CG_ALNUM}[#{CC_ALNUM}.-]*\.#{CG_ALPHA}{2,4}\b)
+ InlineEmailRx = %r(([\\>:/])?#{CG_WORD}(?:&amp;|[#{CC_WORD}.%+-])*@#{CG_ALNUM}[#{CC_ALNUM}.-]*\.#{CG_ALPHA}{2,4}\b)
# Matches an inline footnote macro, which is allowed to span multiple lines.
#
diff --git a/test/substitutions_test.rb b/test/substitutions_test.rb
index f63336be..905d3bec 100644
--- a/test/substitutions_test.rb
+++ b/test/substitutions_test.rb
@@ -626,6 +626,8 @@ context 'Substitutions' do
assert_equal %q{<a href="mailto:author+website@4fs.no">author+website@4fs.no</a>}, para.sub_macros(para.source)
para = block_from_string('john@domain.uk.co')
assert_equal %q{<a href="mailto:john@domain.uk.co">john@domain.uk.co</a>}, para.sub_macros(para.source)
+ para = block_from_string('bert&ernie@sesamestreet.com')
+ assert_equal %q{<a href="mailto:bert&amp;ernie@sesamestreet.com">bert&amp;ernie@sesamestreet.com</a>}, para.apply_subs(para.source)
end
test 'should ignore escaped inline email address' do