# Quick tests for the markup templatetags (django.contrib.markup) from django.template import Template, Context, add_to_builtins add_to_builtins('django.contrib.markup.templatetags.markup') # find out if markup modules are installed and tailor the test appropriately try: import textile except ImportError: textile = None try: import markdown except ImportError: markdown = None try: import docutils except ImportError: docutils = None # simple examples 'cause this isn't actually testing the markup, just # that the filters work as advertised ### test textile textile_content = """Paragraph 1 Paragraph 2 with "quotes" and @code@""" t = Template("{{ textile_content|textile }}") rendered = t.render(Context(locals())).strip() if textile: assert rendered == """
Paragraph 1
Paragraph 2 with “quotes” and code
Paragraph 1
Paragraph 1
Paragraph 2 with a link
""" else: assert rendered == rest_content