summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-tab.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-05-29 18:43:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-05-29 18:43:00 +0200
commit48e2f23903816dbe8843329bfcd3e6658f22b139 (patch)
tree922c6efc858e94853d103694603f9468c167168f /tex/context/base/lxml-tab.lua
parentc99d2bf28d96648c7d1852c9f5705d58655baeab (diff)
downloadcontext-48e2f23903816dbe8843329bfcd3e6658f22b139.tar.gz
beta 2012.05.29 18:43
Diffstat (limited to 'tex/context/base/lxml-tab.lua')
-rw-r--r--tex/context/base/lxml-tab.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index fddd55a09..b5c860787 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -1338,3 +1338,31 @@ function xml.makestandalone(root)
end
return root
end
+
+function xml.kind(e)
+ local dt = e and e.dt
+ if dt then
+ local n = #dt
+ if n == 1 then
+ local d = dt[1]
+ if d.special then
+ local tg = d.tg
+ if tg == "@cd@" then
+ return "cdata"
+ elseif tg == "@cm" then
+ return "comment"
+ elseif tg == "@pi@" then
+ return "instruction"
+ elseif tg == "@dt@" then
+ return "declaration"
+ end
+ elseif type(d) == "string" then
+ return "text"
+ end
+ return "element"
+ elseif n > 0 then
+ return "mixed"
+ end
+ end
+ return "empty"
+end