diff options
author | Marius <mariausol@gmail.com> | 2012-01-16 20:00:36 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2012-01-16 20:00:36 +0200 |
commit | 6371f988d54dd0bec1c613110df77e5be103591f (patch) | |
tree | 152abee7f55b3f6d1ed52a0f2a9cd81d57019f34 /tex/context/base/lxml-xml.lua | |
parent | 84d94e9754958d12711a8f07086a3d815d305d40 (diff) | |
download | context-6371f988d54dd0bec1c613110df77e5be103591f.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.lua | 11 |
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 |