Still.Compiler.TemplateHelpers.ContentTag (Still v0.8.0) View Source

Implements an arbitrary content tag with the given content.

Link to this section Summary

Functions

Renders an arbitrary HTML tag with the given content.

Link to this section Functions

Link to this function

render(tag, content, opts)

View Source

Renders an arbitrary HTML tag with the given content.

If content is nil, the rendered tag is self-closing.

opts should contain the relevant HTML attributes (e.g class: "myelem").

aria attributes should be in the aria_name format (e.g: aria_label: "Label").

All data attributes should be within a data array (e.g: data: [method: "POST", foo: "bar"]).

Examples

iex> content_tag("a", "My link", href: "https://example.org", data: [method: "POST", something: "value"], aria_label: "Label")
"<a href=\"https://example.org\" data-method=\"POST\" data-something=\"value\" aria-label=\"Label\">My link</a>"