Combo.HTMLTest (combo v0.10.0)

View Source

Provides helpers for testing HTML.

All these helpers converts different data structure into a tree structure, which represents the essential structure of HTML.

The tree structure is abbreviated as "x". That's the reason why these helpers are named like this.

Summary

Functions

Parses and normalizes HTML into a tree structure at compile-time.

Parses and normalizes HTML into a tree structure at runtime.

Renders template into a tree structure.

Functions

sigil_X(arg, list)

(macro)

Parses and normalizes HTML into a tree structure at compile-time.

Examples

iex> ~X|<a href="#{href}">text</a>|
[{"a", [{"href", "\#{href}"}], ["text"]}]

sigil_x(term, list)

(macro)

Parses and normalizes HTML into a tree structure at runtime.

Different from ~X, the content between ~x is evaluated before parsing and normalizing.

Examples

iex> href = "https://example.com"
iex> ~x|<a href="#{href}">text</a>|
[{"a", [{"href", "https://example.com"}], ["text"]}]

to_x(template)

Renders template into a tree structure.