diff options
Diffstat (limited to 'Master/texmf/scripts/texdoc/functions.tlu')
-rw-r--r-- | Master/texmf/scripts/texdoc/functions.tlu | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Master/texmf/scripts/texdoc/functions.tlu b/Master/texmf/scripts/texdoc/functions.tlu index e93debafffc..22d44c9336a 100644 --- a/Master/texmf/scripts/texdoc/functions.tlu +++ b/Master/texmf/scripts/texdoc/functions.tlu @@ -8,8 +8,8 @@ See texdoc.tlu for details. local L = {} load_env(L, { 'export_symbols', - 'string', 'io', 'os', - 'pairs', 'ipairs', 'tonumber', + 'string', 'io', 'os', 'table', 'tostring', + 'print', 'pairs', 'ipairs', 'tonumber', 'C', 'config', }) @@ -91,10 +91,32 @@ function parse_zip(file) return file, nil end +-- print a usage message, with the proper 'active values' line +function print_usage() + local default, files = {}, {} + for _, param in ipairs(C.usage_settings) do + local display = param[config[param.name]] + if config[param.name..'_src'] == 'def' then + table.insert(default, display) + elseif config[param.name..'_src'] == 'file' then + table.insert(files, display) + end + end + def = table.concat(default, ', ') + conf = table.concat(files, ', ') + if not (def == '') then def = def..' (default)' end + if not (conf == '') then conf = conf..' (user config)' end + local sep = (def == '' or conf == '') and '' or '; ' + local settings = C.usage_settings_ph..' '..def..sep..conf..'.' + local usage_msg = string.gsub(C.usage_msg, C.usage_settings_ph, settings) + print(usage_msg) +end + -- finally export a few symbols export_symbols(L, { 'err_print', 'deb_print', 'win32_hook', 'parse_zip', + 'print_usage', }) |