class Marten::Template::Tag::Url

Overview

The url template tag.

The url template tag allows to perform URL lookups. It must be take at least one argument (the name of the targeted handler) followed by optional keyword arguments. For example the following lines are valid usages of the url tag:

{% url "my_handler" %}
{% url "my_other_handler" arg1: var1, arg2: var2 %}

URL names and parameter values can be resolved as template variables too, but they can also be defined as literal values if necessary.

Optionally, resolved URLs can be assigned to a specific variable using the as keyword:

{% url "my_other_handler" arg1: var1, arg2: var2 as my_var %}

Included Modules

Defined in:

marten/template/tag/url.cr

Constructors

Instance Method Summary

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

def self.new(parser : Parser, source : String) #

[View source]

Instance Method Detail

def render(context : Context) : String #
Description copied from class Marten::Template::Tag::Base

Render the template tag for a given context.


[View source]