mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-27 01:34:02 +00:00
Rewrite xmltools.innerText
Make it recursive, define for node types other than xnElement
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
discard """
|
||||
file: "txmltree.nim"
|
||||
output: "true"
|
||||
output: '''true
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
'''
|
||||
"""
|
||||
|
||||
import xmltree, strtabs
|
||||
@@ -9,5 +14,14 @@ var x = <>a(href="nim.de", newText("www.nim-test.de"))
|
||||
|
||||
echo($x == "<a href=\"nim.de\">www.nim-test.de</a>")
|
||||
|
||||
echo(newText("foo").innerText == "foo")
|
||||
echo(newEntity("bar").innerText == "bar")
|
||||
echo(newComment("baz").innerText == "")
|
||||
|
||||
|
||||
let y = newXmlTree("x", [
|
||||
newText("foo"),
|
||||
newXmlTree("y", [
|
||||
newText("bar")
|
||||
])
|
||||
])
|
||||
echo(y.innerText == "foobar")
|
||||
|
||||
Reference in New Issue
Block a user