<s> """<STR_LIT>""" <EOL> from django import template <EOL> from django . conf import settings <EOL> from django . utils . encoding import force_bytes , force_text <EOL> from django . utils . safestring import mark_safe <EOL> register = template . Library ( ) <EOL> @ register . filter ( is_safe = True ) <EOL> def textile ( value ) : <EOL> try : <EOL> import textile <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" ) <EOL> return force_text ( value ) <EOL> else : <EOL> return mark_safe ( force_text ( textile . textile ( force_bytes ( value ) , encoding = '<STR_LIT:utf-8>' , output = '<STR_LIT:utf-8>' ) ) ) <EOL> @ register . filter ( is_safe = True ) <EOL> def markdown ( value , arg = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> import warnings <EOL> warnings . warn ( '<STR_LIT>' , <EOL> category = DeprecationWarning ) <EOL> try : <EOL> import markdown <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" ) <EOL> return force_text ( value ) <EOL> else : <EOL> markdown_vers = getattr ( markdown , "<STR_LIT>" , <NUM_LIT:0> ) <EOL> if markdown_vers < ( <NUM_LIT:2> , <NUM_LIT:1> ) : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError ( <EOL> "<STR_LIT>" ) <EOL> return force_text ( value ) <EOL> else : <EOL> extensions = [ e for e in arg . split ( "<STR_LIT:U+002C>" ) if e ] <EOL> if extensions and extensions [ <NUM_LIT:0> ] == "<STR_LIT>" : <EOL> extensions = extensions [ <NUM_LIT:1> : ] <EOL> return mark_safe ( markdown . markdown ( <EOL> force_text ( value ) , extensions , safe_mode = True , enable_attributes = False ) ) <EOL> else : <EOL> return mark_safe ( markdown . markdown ( <EOL> force_text ( value ) , extensions , safe_mode = False ) ) <EOL> @ register . filter ( is_safe = True ) <EOL> def restructuredtext ( value ) : <EOL> import warnings <EOL> warnings . warn ( '<STR_LIT>' , <EOL> category = DeprecationWarning ) <EOL> try : <EOL> from docutils . core import publish_parts <EOL> except ImportError : <EOL> if settings . DEBUG : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" ) <EOL> return force_text ( value ) <EOL> else : <EOL> docutils_settings = getattr ( settings , "<STR_LIT>" , { } ) <EOL> parts = publish_parts ( source = force_bytes ( value ) , writer_name = "<STR_LIT>" , settings_overrides = docutils_settings ) <EOL> return mark_safe ( force_text ( parts [ "<STR_LIT>" ] ) ) </s>
