class Marten::Template::Tag::Capture
- Marten::Template::Tag::Capture
- Marten::Template::Tag::Base
- Reference
- Object
Overview
The capture
template tag.
The capture
template tags allows to define that the output of a block of code should be stored in a variable:
{% capture my_var %}
Hello World, {{ name }}!
{% endcapture %}
It is also possible to use the unless defined
modifier to only assign the variable if it is not already
defined in the template context. For example:
{% capture my_var unless defined %}
Hello World, {{ name }}!
{% endcapture %}
Included Modules
Defined in:
marten/template/tag/capture.crConstructors
Instance Method Summary
-
#render(context : Context) : String
Render the template tag for a given context.
Instance methods inherited from module Marten::Template::Tag::CanSplitSmartly
split_smartly(expression : String) : Array(String)
split_smartly
Instance methods inherited from class Marten::Template::Tag::Base
render(context : Context) : String
render
Constructor methods inherited from class Marten::Template::Tag::Base
new(parser : Parser, source : String)
new
Constructor Detail
Instance Method Detail
Description copied from class Marten::Template::Tag::Base
Render the template tag for a given context.