hyper_ex v0.1.0 HyperEx View Source

The root HyperEx module contains all publically exposed functions of this package.

Link to this section Summary

Functions

Render an closing tag from an abbreviation

Render an abbreviation

Render an abbreviation with children (a binary or list) or attributes (a keyword list)

Render an abbreviation with attributes (a keyword list) and children (a binary or list)

Render an opening tag from an abbreviation

Render an opening tag from an abbreviation with attributes

Wrap children (a binary or list) in an abbreviation. Behaves like h/2 but expects children to be the first argument. Useful for piping

Wrap children (a binary or list) in an abbreviation with attributes. Behaves like h/3 but expects children to be the first argument. Useful for piping

Link to this section Functions

Render an closing tag from an abbreviation.

Examples

iex> HyperEx.close("div")
~s{</div>}

iex> HyperEx.close("div#foo")
~s{</div>}

Render an abbreviation.

Examples

iex> HyperEx.h("div")
~s{<div></div>}

iex> HyperEx.h("img")
~s{<img>}

iex> HyperEx.h("div#foo.bar")
~s{<div id="foo" class="bar"></div>}
Link to this function h(abbreviation, attrs_or_children) View Source

Render an abbreviation with children (a binary or list) or attributes (a keyword list).

Examples

iex> HyperEx.h("div", "Hello world!")
~s{<div>Hello world!</div>}

iex> HyperEx.h("div", ["Hello ", "world!"])
~s{<div>Hello world!</div>}

iex> HyperEx.h("div", [class: "foo"])
~s{<div class="foo"></div>}
Link to this function h(abbreviation, attrs, children) View Source

Render an abbreviation with attributes (a keyword list) and children (a binary or list).

Examples

iex> HyperEx.h("div.foo", [class: "bar"], "Hello world!")
~s{<div class="foo bar">Hello world!</div>}

Render an opening tag from an abbreviation.

Examples

iex> HyperEx.open("div")
~s{<div>}

iex> HyperEx.open("div#foo")
~s{<div id="foo">}
Link to this function open(abbreviation, attrs) View Source

Render an opening tag from an abbreviation with attributes.

Examples

iex> HyperEx.open("div#foo", [class: "bar"])
~s{<div id="foo" class="bar">}
Link to this function wrap(contents, abbreviation) View Source

Wrap children (a binary or list) in an abbreviation. Behaves like h/2 but expects children to be the first argument. Useful for piping.

Examples

iex> HyperEx.h("div#foo") |> HyperEx.wrap("div#bar")
~s{<div id="bar"><div id="foo"></div></div>}
Link to this function wrap(contents, abbreviation, attrs) View Source

Wrap children (a binary or list) in an abbreviation with attributes. Behaves like h/3 but expects children to be the first argument. Useful for piping.

Examples

iex> HyperEx.h("div#foo") |> HyperEx.wrap("div#bar", [class: "baz"])
~s{<div id="bar" class="baz"><div id="foo"></div></div>}