Skip to content

Commit

Permalink
resolves asciidoctor#4490 style cells in head row as bold in manpage …
Browse files Browse the repository at this point in the history
…output
  • Loading branch information
mojavelinux committed Sep 18, 2023
1 parent 7328ac3 commit 37dda71
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -66,6 +66,7 @@ Improvements::
Bug Fixes::

* Preserve paragraph breaks in normal table cell in manpage output (#4481)
* Style cells in head row as bold in manpage output (#4490)
* Escape spaces in include target (using inline passthrough) when generating link from include directive (#4461)

== 2.0.20 (2023-05-18) - @mojavelinux
Expand Down
12 changes: 7 additions & 5 deletions lib/asciidoctor/converter/manpage.rb
Expand Up @@ -474,12 +474,14 @@ def convert_table node
end unless rows.empty?
end

# NOTE set number of columns and cell defaults
result << %(#{LF}#{row_header[0].map { 'lt' }.join ' '}.)
result << LF
row_text.each do |row|
result << row.join
if node.has_header_option && (header_row_text = row_text[0])
result << %(#{LF}#{row_header[0].join ' '}.)
result << %(#{LF}#{header_row_text.join})
result << '.T&'
row_text = row_text.slice 1, row_text.length
end
result << %(#{LF}#{row_header[0].map { 'lt' }.join ' '}.#{LF})
row_text.each {|row| result << row.join }
result << %(.TE#{LF}.sp)
result.join
end
Expand Down
8 changes: 6 additions & 2 deletions test/manpage_test.rb
Expand Up @@ -758,10 +758,12 @@
EOS
expected_coda = <<~'EOS'.chop
allbox tab(:);
lt.
ltB.
T{
Header
T}
.T&
lt.
T{
Body 1
T}
Expand Down Expand Up @@ -814,14 +816,16 @@
.B Table 1. Table of options
.TS
allbox tab(:);
lt lt lt.
ltB ltB ltB.
T{
Name
T}:T{
Description
T}:T{
Default
T}
.T&
lt lt lt.
T{
dim
T}:T{
Expand Down

0 comments on commit 37dda71

Please sign in to comment.