Skip to content

Commit

Permalink
backport fix for #4401 manify alt text of block image in manpage output
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Apr 17, 2023
1 parent 7db62f1 commit 349fd87
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 @@ -32,6 +32,7 @@ Bug Fixes::

* 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 in manpage output (#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 @@ -236,7 +236,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 @@ -765,6 +765,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 349fd87

Please sign in to comment.