From d4de20b77ae2e522fe1a5c730b426a5b60ac86f5 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sat, 28 Mar 2015 20:55:21 -0400 Subject: Removed some Py2.4-2.6 specific code. --- markdown/extensions/attr_list.py | 8 +------- markdown/inlinepatterns.py | 15 +-------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py index 894e545..6ce73a6 100644 --- a/markdown/extensions/attr_list.py +++ b/markdown/extensions/attr_list.py @@ -24,12 +24,6 @@ from ..treeprocessors import Treeprocessor from ..util import isBlockLevel import re -try: - Scanner = re.Scanner -except AttributeError: # pragma: no cover - # must be on Python 2.4 - from sre import Scanner - def _handle_double_quote(s, t): k, v = t.split('=', 1) @@ -53,7 +47,7 @@ def _handle_word(s, t): return t, t -_scanner = Scanner([ +_scanner = re.Scanner([ (r'[^ =]+=".*?"', _handle_double_quote), (r"[^ =]+='.*?'", _handle_single_quote), (r'[^ =]+=[^ =]+', _handle_key_value), diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index 478b55f..dbb4d06 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -229,19 +229,6 @@ class Pattern(object): except KeyError: # pragma: no cover return text - def itertext(el): # pragma: no cover - ' Reimplement Element.itertext for older python versions ' - tag = el.tag - if not isinstance(tag, util.string_type) and tag is not None: - return - if el.text: - yield el.text - for e in el: - for s in itertext(e): - yield s - if e.tail: - yield e.tail - def get_stash(m): id = m.group(1) if id in stash: @@ -250,7 +237,7 @@ class Pattern(object): return value else: # An etree Element - return text content only - return ''.join(itertext(value)) + return ''.join(value.itertext()) return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text) -- cgit v1.2.3