From ca6a0e7d735746ca947f99f590b19ad1121b9800 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 29 Oct 2010 22:00:28 -0400 Subject: Improved previous commit. isBlockLevel is now more foolproof and will no longer crash on other non-string ElemetTree tags (like processing instructions). --- .gitignore | 1 + markdown/util.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f921269..a00737a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/* dist/* tmp/* MANIFEST +.venv 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 -- cgit v1.2.3