summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-xml.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-04-19 17:40:15 +0300
committerMarius <mariausol@gmail.com>2011-04-19 17:40:15 +0300
commit865b5da32dfab508db87744c7542a59c192dd459 (patch)
tree59d82bdb555d95cd5734743d9259662fd5c16c62 /tex/context/base/lxml-xml.lua
parent930f95164ea82514ff24bf71c6baddd40a569766 (diff)
downloadcontext-865b5da32dfab508db87744c7542a59c192dd459.tar.gz
beta 2011.04.19 16:38
Diffstat (limited to 'tex/context/base/lxml-xml.lua')
-rw-r--r--tex/context/base/lxml-xml.lua25
1 files changed, 24 insertions, 1 deletions
diff --git a/tex/context/base/lxml-xml.lua b/tex/context/base/lxml-xml.lua
index 2053d2353..89fcba871 100644
--- a/tex/context/base/lxml-xml.lua
+++ b/tex/context/base/lxml-xml.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['lxml-xml'] = {
license = "see context related readme files"
}
+local concat = string.concat
+
local xml = xml
local finalizers = xml.finalizers.xml
@@ -130,7 +132,7 @@ local function texts(collected)
if collected then
local t, n = { }, 0
for c=1,#collected do
- local e = collection[c]
+ local e = collected[c]
if e and e.dt then
n = n + 1
t[n] = e.dt
@@ -307,3 +309,24 @@ end
xml.table = totable
finalizers.table = totable
+
+local function textonly(e,t)
+ if e then
+ local edt = e.dt
+ if edt then
+ for i=1,#edt do
+ local e = edt[i]
+ if type(e) == "table" then
+ textonly(e,t)
+ else
+ t[#t+1] = e
+ end
+ end
+ end
+ end
+ return t
+end
+
+function xml.textonly(e) -- no pattern
+ return concat(textonly(e,{}))
+end