Skip to content

Commit

Permalink
resolves #1806 hide print annotation for bare email address (PR #1808)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Oct 27, 2020
1 parent e1e9fd9 commit 20edd91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -135,6 +135,7 @@ Bug Fixes::
* correctly scale down SVG that only marginally exceeds bounds of page when fit=scale-down
* don't suppress actual error message when theme cannot be loaded; may contain information about theme being extended
* force inline image to fit within table cell when width is larger than available space (#1798)
* hide print annotation for bare email address (#1806)

Compliance::

Expand Down
6 changes: 3 additions & 3 deletions lib/asciidoctor/pdf/converter.rb
Expand Up @@ -2436,9 +2436,9 @@ def convert_inline_anchor node
if (role = node.role)
attrs << %( class="#{role}")
end
if (@media ||= doc.attr 'media', 'screen') != 'screen' && (target.start_with? 'mailto:') && (doc.attr? 'hide-uri-scheme')
bare_target = target.slice 7, target.length
node.add_role 'bare' if (text = node.text) == bare_target
if (@media ||= doc.attr 'media', 'screen') != 'screen' && (target.start_with? 'mailto:')
node.add_role 'bare' if (bare_target = target.slice 7, target.length) == (text = node.text)
bare_target = target unless doc.attr? 'hide-uri-scheme'
else
bare_target = target
text = node.text
Expand Down
2 changes: 1 addition & 1 deletion spec/link_spec.rb
Expand Up @@ -183,7 +183,7 @@
(expect link_annotation[:A][:URI]).to eql 'mailto:doc.writer@example.org'

pdf = to_pdf input, attribute_overrides: { 'media' => 'prepress' }, analyze: true
(expect pdf.lines[0]).to eql 'Send message to doc.writer@example.org [mailto:doc.writer@example.org].'
(expect pdf.lines[0]).to eql 'Send message to doc.writer@example.org.'
end

it 'should show mailto address of email link when media=prepress' do
Expand Down

0 comments on commit 20edd91

Please sign in to comment.