summaryrefslogtreecommitdiff
path: root/tex/context/base/lxml-tab.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-05-29 20:00:14 +0300
committerMarius <mariausol@gmail.com>2012-05-29 20:00:14 +0300
commit250c6bdd3d89cde9d2401172ea0310536eb58db8 (patch)
tree300039199138996ceb060b458fe45288ae0b6b17 /tex/context/base/lxml-tab.lua
parent100f67d68d6026d0d6ff2cfd79f03b3f32c0c0f3 (diff)
downloadcontext-250c6bdd3d89cde9d2401172ea0310536eb58db8.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