aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2015-03-28 20:55:21 -0400
committerWaylan Limberg <waylan.limberg@icloud.com>2018-01-11 19:04:49 -0500
commitd4de20b77ae2e522fe1a5c730b426a5b60ac86f5 (patch)
tree18a15b43c0537243527957d22e0d68309ef26530
parent11270135194922e0f5cfc739b69fe39f7337a0f9 (diff)
downloadmarkdown-d4de20b77ae2e522fe1a5c730b426a5b60ac86f5.tar.gz
markdown-d4de20b77ae2e522fe1a5c730b426a5b60ac86f5.tar.bz2
markdown-d4de20b77ae2e522fe1a5c730b426a5b60ac86f5.zip
Removed some Py2.4-2.6 specific code.
-rw-r--r--markdown/extensions/attr_list.py8
-rw-r--r--markdown/inlinepatterns.py15
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)