summaryrefslogtreecommitdiff
path: root/tex/context/base/util-tab.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2011-04-11 16:45:00 +0200
committerHans Hagen <pragma@wxs.nl>2011-04-11 16:45:00 +0200
commit612f23ed1b01240fdc9ca5132dbd3164e96ed570 (patch)
tree8eafde3944b1b46eae32e68b240a5eb9cf5f71fc /tex/context/base/util-tab.lua
parent0bd8dee4e7e38cfb027bf788505de24aca28261c (diff)
downloadcontext-612f23ed1b01240fdc9ca5132dbd3164e96ed570.tar.gz
beta 2011.04.11 16:45
Diffstat (limited to 'tex/context/base/util-tab.lua')
-rw-r--r--tex/context/base/util-tab.lua19
1 files changed, 9 insertions, 10 deletions
diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua
index f8422c626..818266d3c 100644
--- a/tex/context/base/util-tab.lua
+++ b/tex/context/base/util-tab.lua
@@ -12,7 +12,7 @@ local tables = utilities.tables
local format, gmatch = string.format, string.gmatch
local concat, insert, remove = table.concat, table.insert, table.remove
-local setmetatable, tonumber, tostring = setmetatable, tonumber, tostring
+local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatable, tonumber, tostring
function tables.definetable(target) -- defines undefined tables
local composed, t, n = nil, { }, 0
@@ -77,12 +77,6 @@ function tables.insertaftervalue(t,value,extra)
insert(t,#t+1,extra)
end
-local _empty_table_ = { __index = function(t,k) return "" end }
-
-function table.setemptymetatable(t)
- setmetatable(t,_empty_table_)
-end
-
-- experimental
local function toxml(t,d,result)
@@ -99,8 +93,13 @@ local function toxml(t,d,result)
end
end
-function table.toxml(t,name)
- local result = { "<?xml version='1.0' standalone='yes' ?>" }
- toxml( { [name or "root"] = t }, "", result)
+function table.toxml(t,name,nobanner)
+ local noroot = name == false
+ local result = (nobanner or noroot) and { } or { "<?xml version='1.0' standalone='yes' ?>" }
+ if noroot then
+ toxml( t, "", result)
+ else
+ toxml( { [name or "root"] = t }, "", result)
+ end
return concat(result,"\n")
end