Tiny string-escaping helpers shared by the XML sitemap and
RSS-feed generators. Lifted out of sitemap.ts so the helpers can be
tested in isolation and so any future XML output (Atom, news-sitemap,
etc.) can reuse the same canonical escape function instead of growing a
fourth copy.
The single function below escapes the five predefined XML entities
(&, <, >, ", '). The order matters — & MUST be escaped first
so that subsequent </> etc. aren't double-encoded.
Description
Tiny string-escaping helpers shared by the XML sitemap and RSS-feed generators. Lifted out of
sitemap.tsso the helpers can be tested in isolation and so any future XML output (Atom, news-sitemap, etc.) can reuse the same canonical escape function instead of growing a fourth copy.The single function below escapes the five predefined XML entities (
&,<,>,",'). The order matters —&MUST be escaped first so that subsequent</>etc. aren't double-encoded.