Module escape

Source
Expand description

Manage xml character escapes

Enums§

EscapeError
Error for XML escape / unescape.
ParseCharRefError
Error of parsing character reference (&#<dec-number>; or &#x<hex-number>;).

Functions§

escape
Escapes an &str and replaces all xml special characters (<, >, &, ', ") with their corresponding xml escaped value.
minimal_escape
XML standard requires that only < and & was escaped in text content or attribute value. All other characters not necessary to be escaped, although for compatibility with SGML they also should be escaped. Practically, escaping only those characters is enough.
partial_escape
Escapes an &str and replaces xml special characters (<, >, &) with their corresponding xml escaped value.
resolve_html5_entityescape-html
Resolves all HTML5 entities. For complete list see https://dev.w3.org/html5/html-author/charref.
resolve_predefined_entity
Resolves predefined XML entities or all HTML5 entities depending on the feature escape-html.
resolve_xml_entity
Resolves predefined XML entities. If specified entity is not a predefined XML entity, None is returned.
unescape
Unescape an &str and replaces all xml escaped characters (&...;) into their corresponding value.
unescape_with
Unescape an &str and replaces all xml escaped characters (&...;) into their corresponding value, using a resolver function for custom entities.