htmlunescape

Port of Python's html.escape and html.unescape to Nim


Need help? Read Nimble

HTML (Un)escape is a port of Python's html.escape and html.unescape to Nim.

Installation

Install using nimble:

nimble install --accept 'htmlunescape'

Usage:

Escaping sequences:

import htmlunescape

assert escape(s = "'<script>\"&foo;\"</script>'") == "&#x27;&lt;script&gt;&quot;&amp;foo;&quot;&lt;/script&gt;&#x27;"
assert escape(s = "'<script>\"&foo;\"</script>'", quote = false) == "'&lt;script&gt;\"&amp;foo;\"&lt;/script&gt;'"

Unescaping sequences:

import htmlunescape

assert unescape(s = "&quot;&quot;&quot;") == "\"\"\""
assert unescape(s = "&amp;&amp;&amp;") == "&&&"

Contributing

If you have discovered a bug in this library and know how to fix it, fork this repository and open a Pull Request.

Author: AmanoTeam

Latest versions: 0.1 0.2

Licence: LGPL-3.0

Project website

Docs