Unknown template variables always result in Marten::Template::Errors::UnknownVariable exceptions being raised. This doesn't make it easy to deal with "shared" templates where variables may or may not be defined in the specified context. Instead, the default behavior should involve rendering unknown variables as empty strings while also making it possible to raise Marten::Template::Errors::UnknownVariable exceptions if the Marten template engine is configured accordingly.
Default behavior for unknown template variables
Let's ensure that unknown template variables are rendered as nil values by default.
Configuration
Let's introduce a new templates.strict_variables setting allowing to configure whether unknown variables will result in Marten::Template::Errors::UnknownVariable exceptions being raised. The default value should be false.
Description
Unknown template variables always result in
Marten::Template::Errors::UnknownVariable
exceptions being raised. This doesn't make it easy to deal with "shared" templates where variables may or may not be defined in the specified context. Instead, the default behavior should involve rendering unknown variables as empty strings while also making it possible to raiseMarten::Template::Errors::UnknownVariable
exceptions if the Marten template engine is configured accordingly.Default behavior for unknown template variables
Let's ensure that unknown template variables are rendered as nil values by default.
Configuration
Let's introduce a new
templates.strict_variables
setting allowing to configure whether unknown variables will result inMarten::Template::Errors::UnknownVariable
exceptions being raised. The default value should befalse
.