summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-07-16 18:33:07 -0600
committerGitHub <noreply@github.com>2020-07-16 18:33:07 -0600
commitef4e2f600b33674e7f3f342ed9650d9121fdcc8e (patch)
tree2be3e03622781af616f66262ed5714ab8954f07e
parentca5928d42d3178f0617164ad3a77f0bea317fe3c (diff)
resolves #3714 honor start attribute on ordered list in manpage output (PR #3715)
-rw-r--r--CHANGELOG.adoc1
-rw-r--r--lib/asciidoctor/converter/manpage.rb5
-rw-r--r--test/manpage_test.rb14
3 files changed, 18 insertions, 2 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc
index 6131b10a..351b5c1b 100644
--- a/CHANGELOG.adoc
+++ b/CHANGELOG.adoc
@@ -36,6 +36,7 @@ Bug Fixes::
* Don't activate global extensions if :extensions option is false (#3570)
* Escape ellipsis at start of line in manpage output (#3645) (*@jnavila*)
* Don't register footnote with ID if a footnote is already registered with that ID (#3690)
+ * Honor start attribute on ordered list in manpage output (#3714)
Compliance::
diff --git a/lib/asciidoctor/converter/manpage.rb b/lib/asciidoctor/converter/manpage.rb
index 2beee41a..867e3cff 100644
--- a/lib/asciidoctor/converter/manpage.rb
+++ b/lib/asciidoctor/converter/manpage.rb
@@ -288,15 +288,16 @@ r lw(\n(.lu*75u/100u).'
.B #{manify node.title}
.br) if node.title?
+ start = (node.attr 'start', 1).to_i
node.items.each_with_index do |item, idx|
result << %(.sp
.RS 4
.ie n \\{\\
-\\h'-04' #{idx + 1}.\\h'+01'\\c
+\\h'-04' #{numeral = idx + start}.\\h'+01'\\c
.\\}
.el \\{\\
. sp -1
-. IP " #{idx + 1}." 4.2
+. IP " #{numeral}." 4.2
.\\}
#{manify item.text, whitespace: :normalize})
result << item.content if item.blocks?
diff --git a/test/manpage_test.rb b/test/manpage_test.rb
index fd0923a7..6f768e7b 100644
--- a/test/manpage_test.rb
+++ b/test/manpage_test.rb
@@ -272,6 +272,20 @@ context 'Manpage' do
assert_includes output, %(Oh, here it goes again\nI should have known,\nshould have known,\nshould have known again)
end
+ test 'should honor start attribute on ordered list' do
+ input = <<~EOS.chop
+ #{SAMPLE_MANPAGE_HEADER}
+
+ [start=5]
+ . five
+ . six
+ EOS
+
+ output = Asciidoctor.convert input, backend: :manpage
+ assert_match %r/IP " 5\.".*five/m, output
+ assert_match %r/IP " 6\.".*six/m, output
+ end
+
test 'should collapse whitespace in the man manual and man source' do
input = <<~EOS.chop
#{SAMPLE_MANPAGE_HEADER}