Skip to content

Commit 11408e5

Browse files
committed
Removed laxy_ol keyword. Use sane_lists extension instead.
1 parent 0005d7a commit 11408e5

File tree

8 files changed

+27
-43
lines changed

8 files changed

+27
-43
lines changed

markdown/blockprocessors.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ class OListProcessor(BlockProcessor):
306306
CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.)|[*+-])[ ]+(.*)')
307307
# Detect indented (nested) items of either type
308308
INDENT_RE = re.compile(r'^[ ]{4,7}((\d+\.)|[*+-])[ ]+.*')
309-
# The integer (python string) with which the lists starts (default=1)
309+
# Lazy ol - ignore startswith
310+
LAZY_OL = True
311+
# The integer (if LAZY_OL = False) with which a list starts (default=1)
310312
# Eg: If list is intialized as)
311313
# 3. Item
312314
# The ol tag will get starts="3" attribute
@@ -360,7 +362,7 @@ def run(self, parent, blocks):
360362
# This is a new list so create parent with appropriate tag.
361363
lst = util.etree.SubElement(parent, self.TAG)
362364
# Check if a custom start integer is set
363-
if not self.parser.md.lazy_ol and self.STARTSWITH != '1':
365+
if not self.LAZY_OL and self.STARTSWITH != '1':
364366
lst.attrib['start'] = self.STARTSWITH
365367

366368
self.parser.state.set('list')

markdown/core.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class Markdown(object):
2727
option_defaults = {
2828
'tab_length': 4,
2929
'smart_emphasis': True,
30-
'lazy_ol': True,
3130
}
3231

3332
output_formats = {
@@ -54,7 +53,6 @@ def __init__(self, **kwargs):
5453
* "html": Outputs HTML style tags.
5554
* tab_length: Length of tabs in the source. Default: 4
5655
* smart_emphasis: Treat `_connected_words_` intelligently Default: True
57-
* lazy_ol: Ignore number of first item of ordered lists. Default: True
5856
5957
"""
6058

markdown/extensions/sane_lists.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SaneOListProcessor(OListProcessor):
2626

2727
CHILD_RE = re.compile(r'^[ ]{0,3}((\d+\.))[ ]+(.*)')
2828
SIBLING_TAGS = ['ol']
29+
LAZY_OL = False
2930

3031

3132
class SaneUListProcessor(UListProcessor):

tests/extensions/sane_lists.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@
1818
<ul>
1919
<li>Unordered again
2020
1. not a list item</li>
21-
</ul>
21+
</ul>
22+
<ol start="3">
23+
<li>Bird</li>
24+
<li>McHale</li>
25+
<li>Parish</li>
26+
</ol>
27+
<p>Not a list</p>
28+
<ol start="3">
29+
<li>Bird</li>
30+
<li>McHale</li>
31+
<li>Parish</li>
32+
</ol>

tests/extensions/sane_lists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ Paragraph
1414

1515
* Unordered again
1616
1. not a list item
17+
18+
3. Bird
19+
1. McHale
20+
8. Parish
21+
22+
Not a list
23+
24+
3. Bird
25+
1. McHale
26+
8. Parish

tests/options/lazy_ol_off.html

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/options/lazy_ol_off.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/options/test.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
lazy_ol_off:
2-
lazy_ol: False
3-
41
html4:
52
output_format: html4
63

0 commit comments

Comments
 (0)