summaryrefslogtreecommitdiff
path: root/src/luaotfload-configuration.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-08-08 07:03:29 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-08-08 07:03:29 +0200
commit5b4b1a58694f43504741ba798d383ae37d884c2a (patch)
tree4368e7a5ac5c78a0b8f9769ada8ea14a0b516ba6 /src/luaotfload-configuration.lua
parent3cf26fc9d8307fe780634b3876e13327d17e6ec5 (diff)
downloadluaotfload-5b4b1a58694f43504741ba798d383ae37d884c2a.tar.gz
[conf] substitute underscores in section names
Diffstat (limited to 'src/luaotfload-configuration.lua')
-rw-r--r--src/luaotfload-configuration.lua26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index bf841f7..ec38d90 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -483,6 +483,18 @@ local option_spec = {
--- FORMATTERS
-------------------------------------------------------------------------------
+local commented = function (str)
+ return ";" .. str
+end
+
+local underscore_replacer = lpeg.replacer ("_", "-", true)
+
+local dashed = function (var)
+ --- INI spec dictates that dashes are valid in variable names, not
+ --- underscores.
+ return underscore_replacer (var) or var
+end
+
local indent = " "
local format_string = function (var, val)
return stringformat (indent .. "%s = %s", var, val)
@@ -516,19 +528,7 @@ local format_keyval = function (var, val)
end
local format_section = function (title)
- return stringformat ("[%s]", title)
-end
-
-local commented = function (str)
- return ";" .. str
-end
-
-local underscore_replacer = lpeg.replacer ("_", "-", true)
-
-local dashed = function (var)
- --- INI spec dictates that dashes are valid in variable names, not
- --- underscores.
- return underscore_replacer (var) or var
+ return stringformat ("[%s]", dashed (title))
end
local conf_header = [==[