summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-xml.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-04-19 16:38:00 +0200
committerHans Hagen <pragma@wxs.nl>2011-04-19 16:38:00 +0200
commit690c595285ba89968a8af887cf2a074ebc943402 (patch)
treeb9d823867647ca9fc8303bb7e940c78c6ceb39c9 /tex/context/base/lxml-xml.lua
parent6383acb525bc719bf958b490b97e87a8fccac44c (diff)
downloadcontext-690c595285ba89968a8af887cf2a074ebc943402.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