• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修訂18942da373e012fa46ffd15a2d234a12dc2559bb (tree)
時間2010-07-07 00:10:53
作者Rick Copeland <rcopeland@geek...>
CommiterRick Copeland

Log Message

[#684] - Do html sanitization before relative link rewriting so we don't crash on malformed html

Change Summary

差異

--- a/pyforge/pyforge/lib/markdown_extensions.py
+++ b/pyforge/pyforge/lib/markdown_extensions.py
@@ -35,8 +35,8 @@ class ForgeExtension(markdown.Extension):
3535 if self._use_wiki:
3636 md.treeprocessors['wiki'] = ClassifyWikiLinks(md)
3737 md.postprocessors['macro'] = macro_engine.postprocessor
38- md.postprocessors['rewrite_relative_links'] = RelativeLinkRewriter()
3938 md.postprocessors['sanitize_html'] = HTMLSanitizer()
39+ md.postprocessors['rewrite_relative_links'] = RelativeLinkRewriter()
4040
4141 class RelativeLinkRewriter(markdown.postprocessors.Postprocessor):
4242
--- a/pyforge/pyforge/tests/test_globals.py
+++ b/pyforge/pyforge/tests/test_globals.py
@@ -40,6 +40,7 @@ def test_markdown():
4040 assert '<div id="foo">' in r, r
4141 assert 'href="../foo"' in g.markdown.convert('[My foo](foo)')
4242 assert 'href="..' not in g.markdown.convert('[My foo](./foo)')
43+ g.markdown.convert("<class 'foo'>") # should not raise an exception
4344 assert '<br>' not in g.markdown.convert('''# Header
4445
4546 Some text in a regular paragraph