Skip to content

Commit

Permalink
Fix ordered list with nest
Browse files Browse the repository at this point in the history
  • Loading branch information
thinca committed Oct 16, 2017
1 parent f163e4f commit 2354112
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/md2man/roff.rb
Expand Up @@ -80,6 +80,7 @@ def list contents, list_type

if list_type == :ordered
result << ".nr step#{@ordered_list_id} 0 1"
contents.gsub!(/^\.IP \\n\+\[step_tbd\]$/, ".IP \\n+[step#{@ordered_list_id}]")
@ordered_list_id += 1
end

Expand All @@ -91,7 +92,7 @@ def list_item text, list_type
designator =
case list_type
when :ordered
"\\n+[step#{@ordered_list_id}]"
"\\n+[step_tbd]"
when :unordered
"\\(bu 2"
end
Expand Down
9 changes: 6 additions & 3 deletions test/md2man/roff_test.rb
Expand Up @@ -739,17 +739,20 @@ def heredoc document
@markdown.render(heredoc(<<-INPUT)).must_equal(heredoc(<<-OUTPUT))
|Here is an ordered list:
|
|1. foo
|1. foo1
|2. foo2
| 1. bar
| 1. baz
|2. qux
|3. qux
INPUT
|.PP
|Here is an ordered list:
|.nr step2 0 1
|.RS
|.IP \\n+[step2]
|foo
|foo1
|.IP \\n+[step2]
|foo2
|.nr step1 0 1
|.RS
|.IP \\n+[step1]
Expand Down

0 comments on commit 2354112

Please sign in to comment.