From 7ecbcaaf68d152851591dbb5931a6eb15d155019 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 25 Nov 2019 23:15:50 +0100 Subject: 2019-11-25 17:37:00 --- tex/context/base/mkiv/data-lst.lua | 42 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'tex/context/base/mkiv/data-lst.lua') diff --git a/tex/context/base/mkiv/data-lst.lua b/tex/context/base/mkiv/data-lst.lua index f061393e5..8e0061c4d 100644 --- a/tex/context/base/mkiv/data-lst.lua +++ b/tex/context/base/mkiv/data-lst.lua @@ -9,46 +9,44 @@ if not modules then modules = { } end modules ['data-lst'] = { -- used in mtxrun, can be loaded later .. todo local type = type -local concat, sortedhash = table.concat,table.sortedhash +local sortedhash = table.sortedhash +local isdir = lfs.isdir -local resolvers = resolvers -local listers = resolvers.listers or { } -resolvers.listers = listers +local resolvers = resolvers +local listers = resolvers.listers or { } +resolvers.listers = listers -local resolveprefix = resolvers.resolve +local resolveprefix = resolvers.resolve +local configurationfiles = resolvers.configurationfiles +local expandedpathfromlist = resolvers.expandedpathfromlist +local splitpath = resolvers.splitpath +local knownvariables = resolvers.knownvariables -local report_lists = logs.reporter("resolvers","lists") -local report_resolved = logs.reporter("system","resolved") - -local function tabstr(str) - if type(str) == 'table' then - return concat(str," | ") - else - return str - end -end +local report_lists = logs.reporter("resolvers","lists") +local report_resolved = logs.reporter("system","resolved") function listers.variables(pattern) local result = resolvers.knownvariables(pattern) + local unset = { "unset" } for key, value in sortedhash(result) do report_lists(key) - report_lists(" env: %s",tabstr(value.environment or "unset")) - report_lists(" var: %s",tabstr(value.variable or "unset")) - report_lists(" exp: %s",tabstr(value.expansion or "unset")) - report_lists(" res: %s",tabstr(value.resolved or "unset")) + report_lists(" env: % | t",value.environment or unset) + report_lists(" var: % | t",value.variable or unset) + report_lists(" exp: % | t",value.expansion or unset) + report_lists(" res: % | t",value.resolved or unset) end end function listers.configurations() - local configurations = resolvers.configurationfiles() + local configurations = configurationfiles() for i=1,#configurations do report_resolved("file : %s",resolveprefix(configurations[i])) end report_resolved("") - local list = resolvers.expandedpathfromlist(resolvers.splitpath(resolvers.luacnfspec)) + local list = expandedpathfromlist(splitpath(resolvers.luacnfspec)) for i=1,#list do local li = resolveprefix(list[i]) - if lfs.isdir(li) then + if isdir(li) then report_resolved("path - %s",li) else report_resolved("path + %s",li) -- cgit v1.2.3