Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 448x | /**
* @module Infrastructure/Rss/Escape
* @category Intelligence Operations / Supporting Infrastructure
* @name XML escaper for RSS payloads
*
* @description
* Pure-string XML escaper used by every `<item>` field in `rss.xml`.
* Preserves valid pre-encoded entities (`&`, `'`, `<`, etc.)
* by only escaping `&` when it is not already part of an entity.
*
* Round-6 split: extracted from `scripts/generate-rss.ts`.
*
* @author Hack23 AB (Infrastructure Team)
* @license Apache-2.0
*/
/**
* Escape XML special characters while preserving valid pre-encoded
* entities. Used for both attribute values and text content.
*/
export function escapeXml(text: string): string {
return text
.replace(/&(?!(?:#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);)/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
|