diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-01-16 18:33:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-01-16 18:33:00 +0100 |
commit | 2c97049c16bd99dc7226b879c171246e34ec219c (patch) | |
tree | b0608851e05083bd413fa35f8c65e8536dafd013 /tex/context/base/lxml-xml.lua | |
parent | 5b13bdfca0e081ef26d49ba405b7fb62d7724c24 (diff) | |
download | context-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.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 |