diff options
-rw-r--r-- | markdown/blockprocessors.py | 4 | ||||
-rw-r--r-- | markdown/core.py | 2 | ||||
-rw-r--r-- | markdown/extensions/sane_lists.py | 1 | ||||
-rw-r--r-- | tests/extensions/sane_lists.html | 13 | ||||
-rw-r--r-- | tests/extensions/sane_lists.txt | 10 | ||||
-rw-r--r-- | tests/options/lazy_ol_off.html | 18 | ||||
-rw-r--r-- | tests/options/lazy_ol_off.txt | 17 | ||||
-rw-r--r-- | tests/test_legacy.py | 2 |
8 files changed, 26 insertions, 41 deletions
diff --git a/markdown/blockprocessors.py b/markdown/blockprocessors.py index 378c7c7..f3e1fa7 100644 --- a/markdown/blockprocessors.py +++ b/markdown/blockprocessors.py @@ -325,6 +325,8 @@ class OListProcessor(BlockProcessor): # 3. Item # The ol tag will get starts="3" attribute STARTSWITH = '1' + # Lazy ol - ignore startswith + LAZY_OL = True # List of allowed sibling tags. SIBLING_TAGS = ['ol', 'ul'] @@ -385,7 +387,7 @@ class OListProcessor(BlockProcessor): # This is a new list so create parent with appropriate tag. lst = util.etree.SubElement(parent, self.TAG) # Check if a custom start integer is set - if not self.parser.md.lazy_ol and self.STARTSWITH != '1': + if not self.LAZY_OL and self.STARTSWITH != '1': lst.attrib['start'] = self.STARTSWITH self.parser.state.set('list') diff --git a/markdown/core.py b/markdown/core.py index b031715..2144f00 100644 --- a/markdown/core.py +++ b/markdown/core.py @@ -50,7 +50,6 @@ class Markdown(object): option_defaults = { 'tab_length': 4, 'smart_emphasis': True, - 'lazy_ol': True, } output_formats = { @@ -75,7 +74,6 @@ class Markdown(object): * "html": Outputs HTML style tags. * tab_length: Length of tabs in the source. Default: 4 * smart_emphasis: Treat `_connected_words_` intelligently Default: True - * lazy_ol: Ignore number of first item of ordered lists. Default: True """ diff --git a/markdown/extensions/sane_lists.py b/markdown/extensions/sane_lists.py index 7fb4fd6..479da04 100644 --- a/markdown/extensions/sane_lists.py +++ b/markdown/extensions/sane_lists.py @@ -25,6 +25,7 @@ import re class SaneOListProcessor(OListProcessor): SIBLING_TAGS = ['ol'] + LAZY_OL = False def __init__(self, parser): super(SaneOListProcessor, self).__init__(parser) diff --git a/tests/extensions/sane_lists.html b/tests/extensions/sane_lists.html index b9fe007..ed51b4d 100644 --- a/tests/extensions/sane_lists.html +++ b/tests/extensions/sane_lists.html @@ -18,4 +18,15 @@ <ul> <li>Unordered again 1. not a list item</li> -</ul>
\ No newline at end of file +</ul> +<ol start="3"> +<li>Bird</li> +<li>McHale</li> +<li>Parish</li> +</ol> +<p>Not a list</p> +<ol start="3"> +<li>Bird</li> +<li>McHale</li> +<li>Parish</li> +</ol>
\ No newline at end of file diff --git a/tests/extensions/sane_lists.txt b/tests/extensions/sane_lists.txt index 51981b3..464149f 100644 --- a/tests/extensions/sane_lists.txt +++ b/tests/extensions/sane_lists.txt @@ -14,3 +14,13 @@ Paragraph * Unordered again 1. not a list item + +3. Bird +1. McHale +8. Parish + +Not a list + +3. Bird +1. McHale +8. Parish
\ No newline at end of file diff --git a/tests/options/lazy_ol_off.html b/tests/options/lazy_ol_off.html deleted file mode 100644 index bff1970..0000000 --- a/tests/options/lazy_ol_off.html +++ /dev/null @@ -1,18 +0,0 @@ -<p>A numbered list from daringfireball:</p> -<ol start="3"> -<li>Bird</li> -<li>McHale</li> -<li>Parish</li> -</ol> -<p>Again:</p> -<ol start="3"> -<li>Bird</li> -<li>McHale</li> -<li>Parish</li> -</ol> -<p>Now starting with 1:</p> -<ol> -<li>Bird</li> -<li>McHale</li> -<li>Parish</li> -</ol>
\ No newline at end of file diff --git a/tests/options/lazy_ol_off.txt b/tests/options/lazy_ol_off.txt deleted file mode 100644 index 611f3a6..0000000 --- a/tests/options/lazy_ol_off.txt +++ /dev/null @@ -1,17 +0,0 @@ -A numbered list from daringfireball: - -3. Bird -1. McHale -8. Parish - -Again: - -3. Bird -1. McHale -8. Parish - -Now starting with 1: - -1. Bird -1. McHale -8. Parish diff --git a/tests/test_legacy.py b/tests/test_legacy.py index 2e0c982..976a84e 100644 --- a/tests/test_legacy.py +++ b/tests/test_legacy.py @@ -44,8 +44,6 @@ class TestMisc(LegacyTestCase): class TestOptions(LegacyTestCase): location = os.path.join(parent_test_dir, 'options') - lazy_ol_off = Kwargs(lazy_ol=False) - html4 = Kwargs(output_format='html4') no_smart_emphasis = Kwargs(smart_emphasis=False) |