class
Marten::Template::Tag::QueryString
Overview
The querystring template tag.
The querystring template tag builds a URL-encoded query string that always starts with ?. Without
arguments, it starts from the query string of the current HTTP request. Keyword arguments add or replace
parameters. For example the following lines are valid usages of the querystring tag:
{% querystring %}
{% querystring color: "red", size: "S" %}
{% querystring color: nil %}
A nil value removes a parameter, and an array value is expanded into repeated parameters. Keyword argument
values can be resolved as template variables too, but they can also be defined as literal values if necessary.
Optionally, the query string can be assigned to a specific variable using the as keyword:
{% querystring page: records.next_page_number as next_page %}
Included Modules
- Marten::Template::Tag::CanEscapeValues
- Marten::Template::Tag::CanExtractKwargs
- Marten::Template::Tag::CanSplitSmartly
Defined in:
marten/template/tag/query_string.crConstructors
Instance Method Summary
-
#render(context : Context) : String
Render the template tag for a given context.
Instance methods inherited from module Marten::Template::Tag::CanEscapeValues
escape_value(value : String, context : Context) : String
escape_value
Instance methods inherited from module Marten::Template::Tag::CanSplitSmartly
split_smartly(expression : String) : Array(String)
split_smartly
Instance methods inherited from module Marten::Template::Tag::CanExtractKwargs
extract_kwargs(source : String)
extract_kwargs
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.