diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2005-08-10 18:31:33 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2005-08-10 18:31:33 +0000 |
| commit | 8e2d2753903dd0c9e2c5dd5b8fc61e0c613161a5 (patch) | |
| tree | 0aa825ad3742644bc7a2969ad5415e45abfe4bf9 /tests | |
| parent | f65350b197e7d61c2d049118cb8ebfea467839ab (diff) | |
Fixed #241 -- added django.contrib.markup app with markup templatetags for Textile, ReST and Markdown
git-svn-id: http://code.djangoproject.com/svn/django/trunk@467 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/othertests/markup.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/othertests/markup.py b/tests/othertests/markup.py new file mode 100644 index 0000000000..0489b16b30 --- /dev/null +++ b/tests/othertests/markup.py @@ -0,0 +1,45 @@ +# Quick tests for the markup templatetags (django.contrib.markup) +# +# Requires that all supported markup modules be installed +# (http://dealmeida.net/projects/textile/, +# http://www.freewisdom.org/projects/python-markdown, and +# http://docutils.sf.net/) + + +from django.core.template import Template, Context +import django.contrib.markup.templatetags.markup # this registers the filters + +# simple examples 'cause this isn't actually testing the markup, just +# that the filters work as advertised + +textile_content = """Paragraph 1 + +Paragraph 2 with "quotes" and @code@""" + +markdown_content = """Paragraph 1 + +## An h2 with *italics*""" + +rest_content = """Paragraph 1 + +Paragraph 2 with a link_ + +.. _link: http://www.example.com/""" + +t = Template("""{{ textile_content|textile }} +---- +{{ markdown_content|markdown }} +---- +{{ rest_content|restructuredtext }}""") + +rendered = t.render(Context(locals())) + +assert rendered.strip() == """<p>Paragraph 1</p> + +<p>Paragraph 2 with “quotes” and <code>code</code></p> +---- +<p>Paragraph 1</p><h2>An h2 with *italics*</h2> + +---- +<p>Paragraph 1</p> +<p>Paragraph 2 with a <a class="reference" href="http://www.example.com/">link</a></p>"""
\ No newline at end of file |
