aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-07-22 17:47:11 -0400
committerWaylan Limberg <waylan@gmail.com>2011-07-22 17:47:11 -0400
commit5c1eaf55cd635c96a3e263e19dd89c8e5667c43d (patch)
tree6204751e095e681fc3767ede756806b5135c9161
parent87f03a3c00c4b8cb86db4cfa9a7833b503952cb0 (diff)
downloadmarkdown-5c1eaf55cd635c96a3e263e19dd89c8e5667c43d.tar.gz
markdown-5c1eaf55cd635c96a3e263e19dd89c8e5667c43d.tar.bz2
markdown-5c1eaf55cd635c96a3e263e19dd89c8e5667c43d.zip
Fixed a few minor Python2.4 incompatabilities. Runs in 2.4-2.7 cleanly.
-rw-r--r--markdown/extensions/attr_list.py8
-rw-r--r--markdown/postprocessors.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 7a4014f..60287fe 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -22,6 +22,12 @@ import markdown
import re
from markdown.util import isBlockLevel
+try:
+ Scanner = re.Scanner
+except AttributeError:
+ # must be on Python 2.4
+ from sre import Scanner
+
def _handle_double_quote(s, t):
k, v = t.split('=')
return k, v.strip('"')
@@ -40,7 +46,7 @@ def _handle_word(s, t):
return u'id', t[1:]
return t, t
-_scanner = re.Scanner([
+_scanner = Scanner([
(r'[^ ]+=".*?"', _handle_double_quote),
(r"[^ ]+='.*?'", _handle_single_quote),
(r'[^ ]+=[^ ]*', _handle_key_value),
diff --git a/markdown/postprocessors.py b/markdown/postprocessors.py
index 8985fb8..b646027 100644
--- a/markdown/postprocessors.py
+++ b/markdown/postprocessors.py
@@ -82,7 +82,7 @@ class RawHtmlPostprocessor(Postprocessor):
def isblocklevel(self, html):
m = re.match(r'^\<\/?([^ ]+)', html)
if m:
- if m.group(1).startswith(('!', '?', '@', '%')):
+ if m.group(1)[0] in ('!', '?', '@', '%'):
# Comment, php etc...
return True
return util.isBlockLevel(m.group(1))