defaults.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. from ._compat import range_type
  3. from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
  4. from .tests import TESTS as DEFAULT_TESTS # noqa: F401
  5. from .utils import Cycler
  6. from .utils import generate_lorem_ipsum
  7. from .utils import Joiner
  8. from .utils import Namespace
  9. # defaults for the parser / lexer
  10. BLOCK_START_STRING = "{%"
  11. BLOCK_END_STRING = "%}"
  12. VARIABLE_START_STRING = "{{"
  13. VARIABLE_END_STRING = "}}"
  14. COMMENT_START_STRING = "{#"
  15. COMMENT_END_STRING = "#}"
  16. LINE_STATEMENT_PREFIX = None
  17. LINE_COMMENT_PREFIX = None
  18. TRIM_BLOCKS = False
  19. LSTRIP_BLOCKS = False
  20. NEWLINE_SEQUENCE = "\n"
  21. KEEP_TRAILING_NEWLINE = False
  22. # default filters, tests and namespace
  23. DEFAULT_NAMESPACE = {
  24. "range": range_type,
  25. "dict": dict,
  26. "lipsum": generate_lorem_ipsum,
  27. "cycler": Cycler,
  28. "joiner": Joiner,
  29. "namespace": Namespace,
  30. }
  31. # default policies
  32. DEFAULT_POLICIES = {
  33. "compiler.ascii_str": True,
  34. "urlize.rel": "noopener",
  35. "urlize.target": None,
  36. "truncate.leeway": 5,
  37. "json.dumps_function": None,
  38. "json.dumps_kwargs": {"sort_keys": True},
  39. "ext.i18n.trimmed": False,
  40. }