1# -*- coding: utf-8 -*- 2""" 3 jinja2.defaults 4 ~~~~~~~~~~~~~~~ 5 6 Jinja default filters and tags. 7 8 :copyright: (c) 2017 by the Jinja Team. 9 :license: BSD, see LICENSE for more details. 10""" 11from jinja2._compat import range_type 12from jinja2.utils import generate_lorem_ipsum, Cycler, Joiner, Namespace 13 14 15# defaults for the parser / lexer 16BLOCK_START_STRING = '{%' 17BLOCK_END_STRING = '%}' 18VARIABLE_START_STRING = '{{' 19VARIABLE_END_STRING = '}}' 20COMMENT_START_STRING = '{#' 21COMMENT_END_STRING = '#}' 22LINE_STATEMENT_PREFIX = None 23LINE_COMMENT_PREFIX = None 24TRIM_BLOCKS = False 25LSTRIP_BLOCKS = False 26NEWLINE_SEQUENCE = '\n' 27KEEP_TRAILING_NEWLINE = False 28 29 30# default filters, tests and namespace 31from jinja2.filters import FILTERS as DEFAULT_FILTERS 32from jinja2.tests import TESTS as DEFAULT_TESTS 33DEFAULT_NAMESPACE = { 34 'range': range_type, 35 'dict': dict, 36 'lipsum': generate_lorem_ipsum, 37 'cycler': Cycler, 38 'joiner': Joiner, 39 'namespace': Namespace 40} 41 42 43# default policies 44DEFAULT_POLICIES = { 45 'compiler.ascii_str': True, 46 'urlize.rel': 'noopener', 47 'urlize.target': None, 48 'truncate.leeway': 5, 49 'json.dumps_function': None, 50 'json.dumps_kwargs': {'sort_keys': True}, 51 'ext.i18n.trimmed': False, 52} 53 54 55# export all constants 56__all__ = tuple(x for x in locals().keys() if x.isupper()) 57