From 84591a31c39887dbf582df5d535f1de1a115fd62 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 17 Jan 2018 13:51:05 +0100 Subject: 2018-01-17 13:16:00 --- scripts/context/lua/mtx-interface.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'scripts') diff --git a/scripts/context/lua/mtx-interface.lua b/scripts/context/lua/mtx-interface.lua index 7ffdd924e..85ccb3ca0 100644 --- a/scripts/context/lua/mtx-interface.lua +++ b/scripts/context/lua/mtx-interface.lua @@ -35,6 +35,7 @@ local helpinfo = [[ create text files for commands and environments report commands to the console generate check file + report the mening of commands replace named characters by utf @@ -44,6 +45,9 @@ local helpinfo = [[ use given suffix for output files force action even when in doubt + + a pattern for meaning lookups + @@ -666,12 +670,34 @@ function scripts.interface.toutf() end end +function scripts.interface.meaning() + local runner = "mtxrun --silent --script context --extra=meaning --once --noconsole --nostatistics" + local pattern = environment.arguments.pattern + local files = environment.files + if type(pattern) == "string" then + runner = runner .. ' --pattern="' .. pattern .. '"' + elseif files and #files > 0 then + for i=1,#files do + runner = runner .. ' "' .. files[i] .. '"' + end + else + return + end + local r = os.resultof(runner) + if type(r) == "string" then + r = gsub(r,"^.-(meaning%s+>)","\n%1") + print(r) + end +end + local ea = environment.argument if ea("mkii") then scripts.interface.mkii() elseif ea("preprocess") then scripts.interface.preprocess() +elseif ea("meaning") then + scripts.interface.meaning() elseif ea("toutf") then scripts.interface.toutf() elseif ea("bidi") then -- cgit v1.2.3