class Crinja::Config::Autoescape

Overview

This class holds configuration values for autoescape config.

It accepts the same settings as [select_autoescape](http://jinja.pocoo.org/docs/2.9/api/#jinja2.select_autoescape) in Jinja 2.9. It intelligently sets the initial value of autoescaping based on the filename of the template.

Defined in:

config.cr

Constant Summary

DISABLED = Autoescape.new(enabled_extensions: [] of String, default_for_string: false, default: false)

Configuration settings where autoescape is deactivated by default for any kind of template.

ENABLED = Autoescape.new(disabled_extensions: [] of String, default_for_string: true, default: true)

Configuration settings where autoescape is activated by default for any kind of template.

Constructors

Instance Method Summary

Constructor Detail

def self.new(enabled_extensions = ["html", "htm", "xml"], disabled_extensions = [] of String, default_for_string : Bool = false, default : Bool = false) #

Initializes the default autoescape configuration.


[View source]

Instance Method Detail

def autoescape?(filename : String? = nil) #

Determines if a template with filename should have autoescape enabled or not.


[View source]
def default : Bool #

If nothing matches, this will be the default autoescape value.


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

If nothing matches, this will be the default autoescape value.


[View source]
def default_for_string : Bool #

Determines autoescape default value for templates loaded from a string (without a filename).


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

Determines autoescape default value for templates loaded from a string (without a filename).


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

List of filename extensions that autoescape should be disabled for.


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

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

List of filename extensions that autoescape should be enabled for.


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

[View source]