Josef-Friedrich / luakeys

LuaTeX package to parse key value options in Lua only, like keyval, kvsetkeys, kvoptions, xkeyval, pgfkeys but in Lua

Home Page:https://www.ctan.org/pkg/luakeys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: convert booleans with aliases like on/yes or off/no

kalekje opened this issue · comments

It's common for many kv interfaces to have aliases for booleans. I would propose that this be an option, and if present, yes or on is converted to true, and no or off is converted to false.

something like this?

local result = luakeys.parse('key=yes', {
  true_aliases = { 'true', 'TRUE', 'True', 'on', 'yes' },
  false_aliases = { 'false', 'FALSE', 'False', 'off', 'no' },
})
luakeys.debug(result) -- { key = true }

Yes I think an interface like that would be great!