From e26b6af09b5277711a89ebada8118bd7ab259de3 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 7 Oct 2007 21:37:05 +0000 Subject: Added `safe` & `inline` tags to htmlStash to fix a few bugs --- markdown.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/markdown.py b/markdown.py index 3263252..adcce81 100644 --- a/markdown.py +++ b/markdown.py @@ -445,7 +445,7 @@ class LinePreprocessor (Preprocessor): def run (self, lines) : for i in range(len(lines)) : if self._isLine(lines[i]) : - lines[i] = "
" + lines[i] = self.stash.store("
", safe=True) return lines def _isLine(self, block) : @@ -471,7 +471,7 @@ class LineBreaksPreprocessor (Preprocessor): for i in range(len(lines)) : if (lines[i].endswith(" ") and not RE.regExp['tabbed'].match(lines[i]) ): - lines[i] += "
" + lines[i] += self.stash.store("
", safe=True) return lines LINE_BREAKS_PREPROCESSOR = LineBreaksPreprocessor() @@ -735,7 +735,11 @@ class DoubleTagPattern (SimpleTagPattern) : class HtmlPattern (Pattern): def handleMatch (self, m, doc) : - place_holder = self.stash.store(m.group(2)) + rawhtml = m.group(2) + inline = True + if rawhtml.startswith("%s\n

" % (HTML_PLACEHOLDER % i), - html + "\n") + if not inline: + xml = xml.replace("

%s\n

" % (HTML_PLACEHOLDER % i), + html + "\n") xml = xml.replace(HTML_PLACEHOLDER % i, html) -- cgit v1.2.3