aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/util.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2010-10-29 22:00:28 -0400
committerWaylan Limberg <waylan@gmail.com>2010-10-29 22:00:28 -0400
commitca6a0e7d735746ca947f99f590b19ad1121b9800 (patch)
tree56310bffb35b695f121b7146b1fc8d577614fbee /markdown/util.py
parentd4294e1250fac05645ffabb998245c5870a4af8c (diff)
downloadmarkdown-ca6a0e7d735746ca947f99f590b19ad1121b9800.tar.gz
markdown-ca6a0e7d735746ca947f99f590b19ad1121b9800.tar.bz2
markdown-ca6a0e7d735746ca947f99f590b19ad1121b9800.zip
Improved previous commit. isBlockLevel is now more foolproof and will no longer crash on other non-string ElemetTree tags (like processing instructions).
Diffstat (limited to 'markdown/util.py')
-rw-r--r--markdown/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/markdown/util.py b/markdown/util.py
index fa50e83..9ae523f 100644
--- a/markdown/util.py
+++ b/markdown/util.py
@@ -51,9 +51,13 @@ AUXILIARY GLOBAL FUNCTIONS
def isBlockLevel(tag):
"""Check if the tag is a block level HTML tag."""
+ if isinstance(tag, basestring):
+ return BLOCK_LEVEL_ELEMENTS.match(tag)
+ # Some ElementTree tags are not strings, so return True for Comments
+ # and False for anything else.
if tag is etree.Comment:
return True
- return BLOCK_LEVEL_ELEMENTS.match(tag)
+ return False
"""
MISC AUXILIARY CLASSES