diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-timing.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-timing.lua | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua b/Master/texmf-dist/scripts/context/lua/mtx-timing.lua index 40e33cdaef0..03100e991af 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-timing.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-timing.lua @@ -8,8 +8,22 @@ if not modules then modules = { } end modules ['mtx-timing'] = { local format, gsub, concat = string.format, string.gsub, table.concat -dofile(resolvers.find_file("trac-tim.lua","tex")) -dofile(resolvers.find_file("trac-lmx.lua","tex")) +local helpinfo = [[ +--xhtml make xhtml file +--launch launch after conversion +--remove remove after launching +]] + +local application = logs.application { + name = "mtx-timing", + banner = "ConTeXt Timing Tools 0.10", + helpinfo = helpinfo, +} + +local report = application.report + +dofile(resolvers.findfile("trac-tim.lua","tex")) +dofile(resolvers.findfile("trac-lmx.lua","tex")) local meta = [[ beginfig(%s) ; @@ -57,6 +71,8 @@ local directrun = true local what = { "parameters", "nodes" } +plugins = plugins or { } -- brrr, will become moduledata as well + function plugins.progress.make_svg(filename,other) local metadata, menudata, c = { }, { }, 0 metadata[#metadata+1] = 'outputformat := "svg" ;' @@ -74,9 +90,9 @@ function plugins.progress.make_svg(filename,other) metadata[#metadata+1] = "end ." metadata = concat(metadata,"\n\n") if directrun then - dofile(resolvers.find_file("mlib-run.lua","tex")) + dofile(resolvers.findfile("mlib-run.lua","tex")) commands = commands or { } - commands.writestatus = logs.report + commands.writestatus = report local result = metapost.directrun("metafun","timing data","svg",true,metadata) return menudata, result else @@ -138,7 +154,7 @@ function plugins.progress.make_lmx_page(name,launch,remove) local htmldata = plugins.progress.makehtml(filename,other,menudata,metadata) lmx.htmfile = function(name) return name .. "-timing.xhtml" end - lmx.lmxfile = function(name) return resolvers.find_file(name,'tex') end + lmx.lmxfile = function(name) return resolvers.findfile(name,'tex') end local variables = { ['title-default'] = 'ConTeXt Timing Information', @@ -167,9 +183,9 @@ scripts.timings = scripts.timings or { } function scripts.timings.xhtml(filename) if filename == "" then - logs.simple("provide filename") + report("provide filename") elseif not plugins.progress.valid_file(filename) then - logs.simple("first run context again with the --timing option") + report("first run context again with the --timing option") else local basename = file.removesuffix(filename) local launch = environment.argument("launch") @@ -178,16 +194,8 @@ function scripts.timings.xhtml(filename) end end -logs.extendbanner("ConTeXt Timing Tools 0.10",true) - -messages.help = [[ ---xhtml make xhtml file ---launch launch after conversion ---remove remove after launching -]] - if environment.argument("xhtml") then scripts.timings.xhtml(environment.files[1] or "") else - logs.help(messages.help) + application.help() end |