Skip to content

Commit

Permalink
resolves #4490 style cells in head row as bold in manpage output (PR #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Nov 26, 2023
1 parent 50b4620 commit 8c02de1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Bug Fixes::

* Nested dlist attached using list continuation should not consume detached paragraph (#3535)
* 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
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,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
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,13 @@
EOS
expected_coda = <<~'EOS'.chop
allbox tab(:);
lt.
ltB.
T{
.sp
Header
T}
.T&
lt.
T{
.sp
Body 1
Expand Down Expand Up @@ -765,7 +767,7 @@
.B Table 1. Table of options
.TS
allbox tab(:);
lt lt lt.
ltB ltB ltB.
T{
.sp
Name
Expand All @@ -776,6 +778,8 @@
.sp
Default
T}
.T&
lt lt lt.
T{
.sp
dim
Expand Down

0 comments on commit 8c02de1

Please sign in to comment.