PK!~2||*jinja2_ext_custom_autoescaping/__init__.pyfrom jinja2_ext_custom_autoescaping.ext import enable_custom_autoescaping, CustomAutoescapeExtension __version__ = '0.1.0' PK! {{%jinja2_ext_custom_autoescaping/ext.pyimport jinja2.ext from jinja2.lexer import Token def enable_custom_autoescaping(env: jinja2.Environment, custom_select_autoescape: callable, custom_autoescape_filter_name: str, custom_autoescape_filter_func: callable): # register the filter env.filters[custom_autoescape_filter_name] = custom_autoescape_filter_func env.extend(**{'custom_autoescape_filter_name': custom_autoescape_filter_name}) env.extend(**{'custom_select_autoescape': custom_select_autoescape}) class CustomAutoescapeExtension(jinja2.ext.Extension): def __init__(self, environment: jinja2.environment.Environment): super().__init__(environment) self.environment = environment self.custom_autoescape_enabled = False def parse(self, parser): pass # This is based on https://github.com/indico/indico/blob/master/indico/web/flask/templating.py. def filter_stream(self, stream): if not self.custom_autoescape_enabled: if hasattr(self.environment, 'custom_autoescape_filter_name'): if hasattr(self.environment, 'custom_select_autoescape'): self.custom_autoescape_enabled = True autoescape = self.custom_autoescape_enabled and self.environment.custom_select_autoescape(stream.name) for token in stream: if token.type == 'variable_end' and autoescape: yield Token(token.lineno, 'pipe', '|') yield Token(token.lineno, 'name', self.environment.custom_autoescape_filter_name) yield token PK!ɹ6jinja2_ext_custom_autoescaping-0.1.0.dist-info/LICENSECC0 LICENSE =========== To the extent possible under law, Marcelo Bello has waived all copyright and related or neighboring rights to jinja2-ext-custom-autoescaping. This work is published from: Brasil. PK!HڽTU4jinja2_ext_custom_autoescaping-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HR[IK 7jinja2_ext_custom_autoescaping-0.1.0.dist-info/METADATAVmoH_1 };qRDСB+w:QmIkvI-gmM"J/wgf7; 'XULܣkQ̷.<lGj,5 R0U>j5V^&Vb1)Sih,3dž%AI^b?nZ!gErX`٧ς\͵IzRuhZ{.T5Ϙs!_DiEV%s^J6\A '/ēLX+ǒa#!ЩPP絚;]oknu^qr `G.q<έ2rD"4郴= -gs\H9*i_dEZ jʰXΑT7]ZAMaq$0cC6N.0Z۔;Y{fhm;:OH=o hIBSˠLW3Y, #ϖGr pN+̚ (m[@Ts\4?r4.jBmXXw$:`;8f5hlZ.r`!,:h L|50zMt1zJ+z>=¡WW8? vQPK!HG>A5jinja2_ext_custom_autoescaping-0.1.0.dist-info/RECORDn@}]p Vr6\Fa(ucҤI۳ —H`w`ܓ:풸A8_@0"2DuE̯ju44Q?H}p oBW Csㅷ}''yɜ}(&Vϝ ;S gTJzRYcX:B#Ջh'ʭԆir7ɵ4<[)HG!kJ/@`H6N7vfRZUl94xի \Y] +E̋ ޑ-ԷqN3G-9agղ5zPK!~2||*jinja2_ext_custom_autoescaping/__init__.pyPK! {{%jinja2_ext_custom_autoescaping/ext.pyPK!ɹ6jinja2_ext_custom_autoescaping-0.1.0.dist-info/LICENSEPK!HڽTU4jinja2_ext_custom_autoescaping-0.1.0.dist-info/WHEELPK!HR[IK 7H jinja2_ext_custom_autoescaping-0.1.0.dist-info/METADATAPK!HG>A5 jinja2_ext_custom_autoescaping-0.1.0.dist-info/RECORDPK9w