Skip to content

Commit 5178741

Browse files
committed
Implement :explicitlist flag from upstream
Fixes #137
1 parent 353e058 commit 5178741

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

ext/rdiscount.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static AccessorFlagPair ACCESSOR_2_FLAG[] = {
3535
{ "no_superscript", MKD_NOSUPERSCRIPT },
3636
{ "no_strikethrough", MKD_NOSTRIKETHROUGH },
3737
{ "latex", MKD_LATEX },
38+
{ "explicitlist", MKD_EXPLICITLIST },
3839
{ NULL, 0 } /* sentinel */
3940
};
4041

lib/rdiscount.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class RDiscount
7878
# Keep LaTeX inside $$ intact.
7979
attr_accessor :latex
8080

81+
# Don't merge adjacent list into a single list.
82+
attr_accessor :explicitlist
83+
8184
# Create a RDiscount Markdown processor. The +text+ argument
8285
# should be a string containing Markdown text. Additional arguments may be
8386
# supplied to set various processing options:
@@ -99,6 +102,7 @@ class RDiscount
99102
# * <tt>:no_superscript</tt> - Disable superscript processing.
100103
# * <tt>:no_strikethrough</tt> - Disable strikethrough processing.
101104
# * <tt>:latex</tt> - Keep LaTeX inside $$ intact.
105+
# * <tt>:explicitlist</tt> - Don't merge adjacent list into a single list.
102106
#
103107
def initialize(text, *extensions)
104108
@text = text

test/rdiscount_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,30 @@ def test_that_emphasis_beside_international_characters_detected
260260
assert_equal %(<p><em>foobar ä</em></p>\n), rd.to_html
261261
end
262262

263+
def test_taht
264+
rd = RDiscount.new(<<EOS, :explicitlist)
265+
- Bullet
266+
- Bullet
267+
268+
1. Numbered
269+
2. Numbered
270+
EOS
271+
272+
assert_equal <<EOS, rd.to_html
273+
<ul>
274+
<li>Bullet</li>
275+
<li>Bullet</li>
276+
</ul>
277+
278+
279+
<ol>
280+
<li>Numbered</li>
281+
<li>Numbered</li>
282+
</ol>
283+
284+
EOS
285+
end
286+
263287
def test_that_extra_definition_lists_work
264288
rd = RDiscount.new(<<EOS)
265289
tag1

0 commit comments

Comments
 (0)