allura
修訂 | 18942da373e012fa46ffd15a2d234a12dc2559bb (tree) |
---|---|
時間 | 2010-07-07 00:10:53 |
作者 | Rick Copeland <rcopeland@geek...> |
Commiter | Rick Copeland |
[#684] - Do html sanitization before relative link rewriting so we don't crash on malformed html
@@ -35,8 +35,8 @@ class ForgeExtension(markdown.Extension): | ||
35 | 35 | if self._use_wiki: |
36 | 36 | md.treeprocessors['wiki'] = ClassifyWikiLinks(md) |
37 | 37 | md.postprocessors['macro'] = macro_engine.postprocessor |
38 | - md.postprocessors['rewrite_relative_links'] = RelativeLinkRewriter() | |
39 | 38 | md.postprocessors['sanitize_html'] = HTMLSanitizer() |
39 | + md.postprocessors['rewrite_relative_links'] = RelativeLinkRewriter() | |
40 | 40 | |
41 | 41 | class RelativeLinkRewriter(markdown.postprocessors.Postprocessor): |
42 | 42 |
@@ -40,6 +40,7 @@ def test_markdown(): | ||
40 | 40 | assert '<div id="foo">' in r, r |
41 | 41 | assert 'href="../foo"' in g.markdown.convert('[My foo](foo)') |
42 | 42 | assert 'href="..' not in g.markdown.convert('[My foo](./foo)') |
43 | + g.markdown.convert("<class 'foo'>") # should not raise an exception | |
43 | 44 | assert '<br>' not in g.markdown.convert('''# Header |
44 | 45 | |
45 | 46 | Some text in a regular paragraph |