Skip to main content

Module escape

Module escape 

Source
Expand description

HTML and XML escaping.

Winged-Swift has three distinct escapers and the golden fixtures depend on the differences between them. WINGED_RUST_SPEC.md §3.3 shows only one; following the spec here would break parity.

functionescapesnotes
escape_text& < > " '& first; ' becomes &#x27;
escape_attribute& " 'not < or >
escape_xml& < > " '' becomes &apos;, the XML spelling

Escaping is applied once, when content enters the tree — never at render time. That mirrors Winged-Swift, where HTMLTag.init stores already-escaped content, and it is why crate::core::Node::Raw exists as the documented escape hatch.

Functions§

escape_attribute
Escapes a value for use inside a double-quoted HTML attribute.
escape_text
Escapes text for use as HTML element content.
escape_text_with_slashes
Escapes text for HTML content, optionally escaping / as well.
escape_xml
Escapes text for XML content — used by the sitemap and RSS generators.