Otera.HTML (otera v0.1.0)

Copy Markdown View Source

HTML text like Python: escape/1 of markupsafe, unescape/1 of html.unescape, and striptags/1 of Markup.striptags.

The character references come from priv/html_entities.json, which scripts/generate_html_entities.py writes from the HTML5 table of Python.

Summary

Functions

Escapes &, <, >, ' and ", like markupsafe.escape.

Removes the tags and comments of text, joins the whitespace into single spaces, and unescapes the references, like Markup.striptags of markupsafe.

Replaces the named and numeric character references, like html.unescape.

Functions

escape(text)

@spec escape(String.t()) :: String.t()

Escapes &, <, >, ' and ", like markupsafe.escape.

striptags(text)

@spec striptags(String.t()) :: String.t()

Removes the tags and comments of text, joins the whitespace into single spaces, and unescapes the references, like Markup.striptags of markupsafe.

unescape(text)

@spec unescape(String.t()) :: String.t()

Replaces the named and numeric character references, like html.unescape.