summaryrefslogtreecommitdiff
path: root/src/luaotfload-configuration.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-07-24 22:51:06 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-07-24 22:51:06 +0200
commitb8dcba5de882bd04b27472a3fdc3a562c55d1ad8 (patch)
tree9b48a03ec440a67d96c85db248d359bbc8cccb42 /src/luaotfload-configuration.lua
parent1df81cbdd55a0e40b4f8c7ee9e4a6d836a6d8562 (diff)
downloadluaotfload-b8dcba5de882bd04b27472a3fdc3a562c55d1ad8.tar.gz
[conf] dump default features along with config
Diffstat (limited to 'src/luaotfload-configuration.lua')
-rw-r--r--src/luaotfload-configuration.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index 10e791a..0b2da64 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -494,6 +494,25 @@ local format_boolean = function (var, val)
return stringformat (indent .. "%s = %s", var, val == true and "true" or "false")
end
+local format_keyval = function (var, val)
+ local list = { }
+ local keys = table.sortedkeys (val)
+ for i = 1, #keys do
+ local key = keys[i]
+ local subval = val[key]
+ if subval == true then
+ list[#list + 1] = stringformat ("%s", key)
+ else
+ list[#list + 1] = stringformat ("%s=%s", key, val[key])
+ end
+ end
+ if next (list) then
+ return stringformat (indent .. "%s = %s",
+ var,
+ tableconcat (list, ","))
+ end
+end
+
local format_section = function (title)
return stringformat ("[%s]", title)
end
@@ -543,6 +562,9 @@ local formatters = {
strip = { false, format_boolean },
update_live = { false, format_boolean },
},
+ default_features = {
+ __default = { true, format_keyval },
+ },
misc = {
bisect = { false, format_boolean },
statistics = { false, format_boolean },
@@ -792,6 +814,10 @@ local dump = function ()
local var = varnames[j]
local val = vars[var]
local comment, sformat = unpack (sformats[var] or { })
+ if not sformat then
+ comment, sformat = unpack (sformats.__default or { })
+ end
+
if sformat then
local dashedvar = dashed (var)
if comment then
@@ -800,6 +826,7 @@ local dump = function ()
confdata[#confdata + 1] = sformat (dashedvar, val)
end
end
+
end
confdata[#confdata + 1] = ""
end