class Crinja::Config

Overview

This class holds configuration values for a Crinja environment.

Defined in:

config.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(autoescape : Crinja::Config::Autoescape = Autoescape.new, keep_trailing_newline : Bool = false, trim_blocks : Bool = false, lstrip_blocks : Bool = false) #

Initializes a configuration object.


[View source]

Instance Method Detail

def autoescape : Autoescape #

This setting configures autoescape behaviour. See Autoescape for details.

When set to a boolean value, false deactivates any autoescape and true activates autoescape for any template.

NOTE The default configuration of Crinja differs from that of Jinja 2.9, that autoescape is activated by default for XML and HTML files. This will most likely be changed by Jinja2 in the future, too.


[View source]
def autoescape=(flag : Bool) #

[View source]
def autoescape=(autoescape : Autoescape) #

This setting configures autoescape behaviour. See Autoescape for details.

When set to a boolean value, false deactivates any autoescape and true activates autoescape for any template.

NOTE The default configuration of Crinja differs from that of Jinja 2.9, that autoescape is activated by default for XML and HTML files. This will most likely be changed by Jinja2 in the future, too.


[View source]
def autoescape?(*args, **options) #

[View source]
def autoescape?(*args, **options, &) #

[View source]
def disabled_filters : Array(String) #

A list of disabled_filters that will raise a SecurityError when invoked.


[View source]
def disabled_filters=(disabled_filters : Array(String)) #

A list of disabled_filters that will raise a SecurityError when invoked.


[View source]
def disabled_functions : Array(String) #

A list of disabled_functions that will raise a SecurityError when invoked.


[View source]
def disabled_functions=(disabled_functions : Array(String)) #

A list of disabled_functions that will raise a SecurityError when invoked.


[View source]
def disabled_operators : Array(String) #

A list of disabled_operators that will raise a SecurityError when invoked.


[View source]
def disabled_operators=(disabled_operators : Array(String)) #

A list of disabled_operators that will raise a SecurityError when invoked.


[View source]
def disabled_tags : Array(String) #

A list of disabled_tags that will raise a SecurityError when invoked.


[View source]
def disabled_tags=(disabled_tags : Array(String)) #

A list of disabled_tags that will raise a SecurityError when invoked.


[View source]
def disabled_tests : Array(String) #

A list of disabled_test that will raise a SecurityError when invoked.


[View source]
def disabled_tests=(disabled_tests : Array(String)) #

A list of disabled_test that will raise a SecurityError when invoked.


[View source]
def keep_trailing_newline : Bool #

Preserve the trailing newline when rendering templates. If set to false, a single newline, if present, willl be stripped from the end of the template.


[View source]
def keep_trailing_newline=(keep_trailing_newline : Bool) #

Preserve the trailing newline when rendering templates. If set to false, a single newline, if present, willl be stripped from the end of the template.


[View source]
def liquid_compatibility_mode : Bool #

Enables liquid compatibility mode. The parser will additionally parse tags and expressions with liquid/django syntax:

  • filter: val | filter: arg, arg
  • tag include: {% include file.name %}

[View source]
def liquid_compatibility_mode=(liquid_compatibility_mode : Bool) #

Enables liquid compatibility mode. The parser will additionally parse tags and expressions with liquid/django syntax:

  • filter: val | filter: arg, arg
  • tag include: {% include file.name %}

[View source]
def lstrip_blocks : Bool #

If this is set to true, leading spaces and tabs are stripped from the start of a line to a block.


[View source]
def lstrip_blocks=(lstrip_blocks : Bool) #

If this is set to true, leading spaces and tabs are stripped from the start of a line to a block.


[View source]
def register_defaults : Bool #

If register_defaults is set to true, all feature libraries will be populated with the defaults (Crinja standards and registered custom features). Otherwise the libraries will be empty. They can be manually populated with library.register_defaults. This setting needs to be set at the creation of an environment.


[View source]
def register_defaults=(register_defaults : Bool) #

If register_defaults is set to true, all feature libraries will be populated with the defaults (Crinja standards and registered custom features). Otherwise the libraries will be empty. They can be manually populated with library.register_defaults. This setting needs to be set at the creation of an environment.


[View source]
def trim_blocks : Bool #

If this is set to `true``, the first newline after a block is removed. This only applies to blocks, not expression tags.


[View source]
def trim_blocks=(trim_blocks : Bool) #

If this is set to `true``, the first newline after a block is removed. This only applies to blocks, not expression tags.


[View source]