mochiweb_html

Loosely tokenizes and generates parse trees for HTML 4.

Loosely tokenizes and generates parse trees for HTML 4.

DATA TYPES

end_tag() = {end_tag, Name}
html_attr() = {string(), string()}
html_comment() = {comment, Comment}
html_data() = {data, string(), Whitespace::boolean()}
html_doctype() = {doctype, [Doctype]}
html_node() = {string(), [html_attr()], [html_node() | string()]}
html_token() = html_data() | start_tag() | end_tag() | inline_html() | html_comment() | html_doctype()
inline_html() = {'=', iolist()}
start_tag() = {start_tag, Name, [html_attr()], Singleton::boolean()}

Functions


escape(B::string() | atom() | binary()) -> binary()

Escape a string such that it's safe for HTML (amp; lt; gt;).

escape_attr(B::string() | binary() | atom() | integer() | float()) -> binary()

Escape a string such that it's safe for HTML attrs (amp; lt; gt; quot;).

parse(Input::string() | binary()) -> html_node()

tokenize and then transform the token stream into a HTML tree.

parse_tokens(Tokens::[html_token()]) -> html_node()

Transform the output of tokens(Doc) into a HTML tree.

to_html(Node::[html_token()] | html_node()) -> iolist()

Convert a list of html_token() to a HTML document.

to_tokens(T::html_node()) -> [html_token()]

Convert a html_node() tree to a list of tokens.

tokens(Input::StringOrBinary) -> [html_token()]

Transform the input UTF-8 HTML into a token stream.

Bob Ippolito bob@mochimedia.com
View Functions