Implemented xescape symbol.
h3rald h3rald@h3rald.com
Sun, 05 May 2024 10:57:07 +0200
4 files changed,
12 insertions(+),
0 deletions(-)
M
minpkg/lib/min_xml.nim
→
minpkg/lib/min_xml.nim
@@ -126,6 +126,10 @@ # Strip & and ;
entity = entity[1..entity.len-2] i.push entity.entityToUtf8.newVal + def.symbol("xescape") do (i: In): + let vals = i.expect("'sym") + i.push vals[0].getString.escape.newVal + def.symbol("xelement") do (i: In): let vals = i.expect("'sym") i.push i.newXDict(newElement(vals[0].getString))
M
next-release.md
→
next-release.md
@@ -3,4 +3,5 @@
- Added a new `color` symbol to the `io` module to enable/disable terminal color output. - Added a new `from-html` symbol to the `xml` module to parse HTML documents and fragments. - Added a new `xentity2utf8` symbol to the `xml` module to convert an XML entity to its corresponding UTF-8 string. +- Added a new `xescape` symbol to the `xml` module to convert special XML characters into the corresponding XML entities.
M
site/contents/reference-xml.md
→
site/contents/reference-xml.md
@@ -41,6 +41,9 @@
{#op||xentity||{{sl}}||{{xentity}}|| Returns a {{xentity}} representing an XML entity. #} +{#op||xescape||{{sl}}||{{s}}|| +Converts any `<`, `>`, `&`, `'`, and `"` present in {{sl}} into the corresponding XML entities. #} + {#op||xentity2utf8||{{dict:xentity}}||{{s}}|| > Returns the UTF-8 symbol corresponding to the specified XML entity. >
M
tests/xml.min
→
tests/xml.min
@@ -44,5 +44,9 @@ (
">" xentity xentity2utf8 ">" == ) *test/assert + ( + "This is a <i>test</i>" xescape "This is a <i>test</i>" == + ) *test/assert + *test/report clear-stack