From 690c595285ba89968a8af887cf2a074ebc943402 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 19 Apr 2011 16:38:00 +0200 Subject: beta 2011.04.19 16:38 --- tex/context/base/lxml-xml.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'tex/context/base/lxml-xml.lua') 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 -- cgit v1.2.3