Skip to content

Commit

Permalink
resolves #4401 manify alt text of block image in manpage output (PR #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Apr 17, 2023
1 parent 95837f5 commit c76e0d5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Bug Fixes::
* Redo loop rather than using recursion to locate next line to process; prevents stack limit error (#4368)
* Use correct selector to collapse margin on first and last child of sidebar
* Don't allow target of include directive to start with a space (to distinguish it from a dlist item) or to end with a space
* Manify alt text of block image (#4401)

== 2.0.18 (2022-10-15) - @mojavelinux

Expand Down
2 changes: 1 addition & 1 deletion lib/asciidoctor/converter/manpage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def convert_image node
result << (node.title? ? %(.sp
.B #{manify node.captioned_title}
.br) : '.sp')
result << %([#{node.alt}])
result << %([#{manify node.alt}])
result.join LF
end

Expand Down
11 changes: 11 additions & 0 deletions test/manpage_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,17 @@
assert output.end_with? %(\n.sp\n[signs point to yes])
end

test 'should manify alt text of block image' do
input = <<~EOS.chop
#{SAMPLE_MANPAGE_HEADER}
image::rainbow.jpg["That's a double rainbow, otherwise known as rainbow{pp}!"]
EOS

output = Asciidoctor.convert input, backend: :manpage
assert output.end_with? %/\n.sp\n[That\\(cqs a double rainbow, otherwise known as rainbow++!]/
end

test 'should replace inline image with alt text enclosed in square brackets' do
input = <<~EOS.chop
#{SAMPLE_MANPAGE_HEADER}
Expand Down

0 comments on commit c76e0d5

Please sign in to comment.