<s> """<STR_LIT>""" <EOL> from django import template <EOL> from django . conf import settings <EOL> try : <EOL> from creoleparser . dialects import Creole10 as Creole <EOL> from creoleparser . core import Parser as CreoleParser <EOL> dialect = Creole ( use_additions = True ) <EOL> except ImportError : <EOL> Creole = None <EOL> register = template . Library ( ) <EOL> @ register . filter <EOL> def creole ( text , ** kw ) : <EOL> """<STR_LIT>""" <EOL> if Creole is None and settings . DEBUG : <EOL> raise template . TemplateSyntaxError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> parser = CreoleParser ( dialect = dialect ) <EOL> return parser . render ( text ) <EOL> class CreoleTextNode ( template . Node ) : <EOL> def __init__ ( self , nodelist ) : <EOL> self . nodelist = nodelist <EOL> def render ( self , context ) : <EOL> return creole ( self . nodelist . render ( context ) ) <EOL> @ register . tag ( "<STR_LIT>" ) <EOL> def crl_tag ( parser , token ) : <EOL> """<STR_LIT>""" <EOL> nodelist = parser . parse ( ( '<STR_LIT>' , ) ) <EOL> parser . delete_first_token ( ) <EOL> return CreoleTextNode ( nodelist ) </s>
