<s> """<STR_LIT>""" <EOL> from django import template <EOL> from django . conf import settings <EOL> register = template . Library ( ) <EOL> def textile ( value ) : <EOL> try : <EOL> import textile <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" <EOL> return value <EOL> else : <EOL> return textile . textile ( value , encoding = settings . DEFAULT_CHARSET , output = settings . DEFAULT_CHARSET ) <EOL> def markdown ( value ) : <EOL> try : <EOL> import markdown <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" <EOL> return value <EOL> else : <EOL> return markdown . markdown ( value ) <EOL> def restructuredtext ( value ) : <EOL> try : <EOL> from docutils . core import publish_parts <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError , "<STR_LIT>" <EOL> return value <EOL> else : <EOL> docutils_settings = getattr ( settings , "<STR_LIT>" , { } ) <EOL> parts = publish_parts ( source = value , writer_name = "<STR_LIT>" , settings_overrides = docutils_settings ) <EOL> return parts [ "<STR_LIT>" ] <EOL> register . filter ( textile ) <EOL> register . filter ( markdown ) <EOL> register . filter ( restructuredtext ) </s>
