Skip to content

Commit

Permalink
Fix for basic ordered lists
Browse files Browse the repository at this point in the history
  • Loading branch information
apjanke committed Feb 17, 2019
1 parent b43a2aa commit e91949f
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 24 deletions.
28 changes: 5 additions & 23 deletions .idea/ronn-ng.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ronn/roff.rb
Expand Up @@ -162,7 +162,7 @@ def block_filter(node)
when 'li'
case node.parent.name
when 'ol'
macro 'IP', %W["#{node.position + 1}." 4]
macro 'IP', %W["#{node.parent.children.index(node) + 1}." 4]
when 'ul'
macro 'IP', ['"\\[ci]"', '4']
else
Expand Down
30 changes: 30 additions & 0 deletions test/ordered_list.html
@@ -0,0 +1,30 @@
<div class='mp'>

<h1 id="Ordered-Lists">Ordered Lists</h1>
<h2 id="Simple-ordered-lists">Simple ordered lists</h2>

<h3 id="One-item-list">One-item list</h3>

<ol>
<li>Hello, world!</li>
</ol>


<h3 id="Three-item-list">Three-item list</h3>

<ol>
<li>Hello, world!</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>


<h3 id="Four-item-list-with-all-1s">Four-item list with all 1s</h3>

<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ol>
</div>
25 changes: 25 additions & 0 deletions test/ordered_list.roff
@@ -0,0 +1,25 @@
.TH "ORDERED_LIST" "" "January 1979" "" ""
.SH "Simple ordered lists"
.SS "One\-item list"
.IP "1." 4
Hello, world!
.IP "" 0
.SS "Three\-item list"
.IP "1." 4
Hello, world!
.IP "2." 4
Item 2
.IP "3." 4
Item 3
.IP "" 0
.SS "Four\-item list with all 1s"
.IP "1." 4
Item 1
.IP "2." 4
Item 2
.IP "3." 4
Item 3
.IP "4." 4
Item 4
.IP "" 0

21 changes: 21 additions & 0 deletions test/ordered_list.ronn
@@ -0,0 +1,21 @@
Ordered Lists
=============

## Simple ordered lists

### One-item list

1. Hello, world!

### Three-item list

1. Hello, world!
2. Item 2
3. Item 3

### Four-item list with all 1s

1. Item 1
1. Item 2
1. Item 3
1. Item 4

0 comments on commit e91949f

Please sign in to comment.