summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-xml.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-01-16 18:33:00 +0100
committerHans Hagen <pragma@wxs.nl>2012-01-16 18:33:00 +0100
commit2c97049c16bd99dc7226b879c171246e34ec219c (patch)
treeb0608851e05083bd413fa35f8c65e8536dafd013 /tex/context/base/lxml-xml.lua
parent5b13bdfca0e081ef26d49ba405b7fb62d7724c24 (diff)
downloadcontext-2c97049c16bd99dc7226b879c171246e34ec219c.tar.gz
beta 2012.01.16 18:33
Diffstat (limited to 'tex/context/base/lxml-xml.lua')
-rw-r--r--tex/context/base/lxml-xml.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/tex/context/base/lxml-xml.lua b/tex/context/base/lxml-xml.lua
index 7ecb69196..7e7922cfb 100644
--- a/tex/context/base/lxml-xml.lua
+++ b/tex/context/base/lxml-xml.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['lxml-xml'] = {
}
local concat = table.concat
+local find = string.find
local xml = xml
@@ -256,7 +257,7 @@ local function tags(collected,nonamespace)
return t
end
-local function empty(collected)
+local function empty(collected,spacesonly)
if not collected then
return true
end
@@ -275,7 +276,9 @@ local function empty(collected)
local typ = type(edk)
if typ == "table" then
return false
- elseif edk ~= "" then -- maybe an extra tester for spacing only
+ elseif edk ~= "" then
+ return false
+ elseif spacesonly and not find(edk,"%S") then
return false
end
elseif n > 1 then
@@ -359,8 +362,8 @@ function xml.match(id,pattern) -- number
return match(xmlfilter(id,pattern))
end
-function xml.empty(id,pattern)
- return empty(xmlfilter(id,pattern))
+function xml.empty(id,pattern,spacesonly)
+ return empty(xmlfilter(id,pattern),spacesonly)
end
xml.all = xml.filter