diff --git a/.travis.yml b/.travis.yml index 93208f8f..9367b46b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python python: - "2.7" - "pypy" - - "3.4" - "3.5" - "3.6" - "3.7-dev" diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index bd8deb15..d12afcd2 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -42,4 +42,4 @@ Sym Roe (github.com/symroe) Alex Elzenaar (github.com/aelzenaar) Francisco Saldaña (github.com/FrankSalad) Shivam Kumar Jha (github.com/thealphadollar) -ryanvilbrandt (github.com/ryanvilbrandt) +Ryan Vilbrandt (github.com/ryanvilbrandt) diff --git a/lib/markdown2.py b/lib/markdown2.py index 3a5d5d9b..4c0654c0 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -1682,15 +1682,14 @@ def _do_lists(self, text): (.*) # list item text = \2 ''', re.M | re.X | re.S) - _task_list_warpper_str = r' %s' + _task_list_warpper_str = r' %s' def _task_list_item_sub(self, match): marker = match.group(1) item_text = match.group(2) - if marker in ['[x]','[X]']: - return self._task_list_warpper_str % ('checked ', item_text) - elif marker == '[ ]': - return self._task_list_warpper_str % ('', item_text) + checked_str = "" if marker == '[ ]' else "checked " + disabled_str = "" if "task_list_checkable" in self.extras else "disabled" + return self._task_list_warpper_str % (checked_str, disabled_str, item_text) _last_li_endswith_two_eols = False def _list_item_sub(self, match): @@ -2293,17 +2292,19 @@ def calculate_toc_html(toc): This expects the `_toc` attribute to have been set on this instance. """ - if toc is None: + if not toc: return None def indent(): return ' ' * (len(h_stack) - 1) lines = [] h_stack = [0] # stack of header-level numbers + # Build TOC for level, id, name in toc: if level > h_stack[-1]: - lines.append("%s