sneeze v1.2.0 Sneeze

Summary

Functions

Render a data-structure, containing ‘elements’ to html. An element is either:

  • [tag, attribute_map | body]
  • [tag, attribute_map]
  • [tag | body]
  • [tag]
  • [:@__raw_html, html_string]
  • [:script, attribute_map, script_text]
  • [:script, script_text]
  • [:style, attribute_map, style_text]
  • [:style, style_text]
  • A bare, stringable value (such as a string or number)
  • A list of elements

Functions

render(data)

Render a data-structure, containing ‘elements’ to html. An element is either:

  • [tag, attribute_map | body]
  • [tag, attribute_map]
  • [tag | body]
  • [tag]
  • [:@__raw_html, html_string]
  • [:script, attribute_map, script_text]
  • [:script, script_text]
  • [:style, attribute_map, style_text]
  • [:style, style_text]
  • A bare, stringable value (such as a string or number)
  • A list of elements

The content of :__@raw_html, :style and :script elements will not be escaped. All other elements content will be html-escaped.

Examples:

render([:p, %{class: "outlined"}, "hello"])
render([:br])
render([[:span, "one"], [:span, %{class: "highlight"}, "two"]])
render([:ul, %{id: "some-list"},
        [:li, [:a, %{href: "/"},      "Home"]],
        [:li, [:a, %{href: "/about"}, "About"]]])
render([:__@raw_html, "<!DOCTYPE html>"])
render([:script, "console.log(42 < 9);"])