From 05a22240a1730a9e3bf3fc5e5a87befe7b823d85 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 22 Mar 2013 22:21:00 +0100 Subject: beta 2013.03.22 22:21 --- scripts/context/lua/mtx-context.lua | 191 +-------------------------------- scripts/context/lua/mtx-context.xml | 187 ++++++++++++++++++++++++++++++++ scripts/context/lua/mtxrun.lua | 58 ++++++++-- scripts/context/stubs/mswin/mtxrun.lua | 58 ++++++++-- scripts/context/stubs/unix/mtxrun | 58 ++++++++-- 5 files changed, 345 insertions(+), 207 deletions(-) create mode 100644 scripts/context/lua/mtx-context.xml (limited to 'scripts') diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 1035267e0..3fa4a094c 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -19,198 +19,11 @@ local lpegpatterns, lpegmatch, Cs, P = lpeg.patterns, lpeg.match, lpeg.Cs, lpeg. local getargument = environment.getargument or environment.argument local setargument = environment.setargument -local helpinfo = [[ - - - - mtx-context - ConTeXt Process Management - 0.60 - - - - - - process (one or more) files (default action) - - - create context formats - - - - - use ctx file (process management specification) - - - use specified user interface (default: en) - - - - - close pdf file in viewer and start pdf viewer afterwards - - - purge files either or not after a run (=...) - - - purge all files either or not after a run (=...) - - - - - load the given module or style, normally part of the distribution - - - load the given environment file first (document styles) - - - enable given the modes (conditional processing in styles) - - - also consult the given paths when files are looked for - - - set variables that can be consulted during a run (key/value pairs) - - - set the randomseed - - - rename the resulting output to the given name - - - set tracker variables (show list with ) - - - set directive variables (show list with ) - - - disable logcatgories (show list with ) - - - disable logging to the console (logfile only) - - - purge result file before run - - - - - force xml stub - - - force cld (context lua document) stub - - - force lua stub (like texlua) - - - force mp stub - - - - - run extra imposition pass, given that the style sets up imposition - - - ignore imposition specifications in the style - - - - - use luajittex with jit turned off (only use the faster virtual machine) - - - use luajittex with jit turned on (in most cases not faster, even slower) - - - - - only run once (no multipass data file is produced) - - - run without stopping and do not show messages on the console - - - run without stopping - - - run with synctex enabled (optional value: zipped, unzipped, 1, -1) - - - - - generate file database etc. (as luatools does) - - - do not descend to .. and ../.. - - - report installed context version - - - - - assume given file present elsewhere - - - use dummy file as jobname - - - - - - - update context version number (remake needed afterwards, also provide ) - - - omit runtime statistics at the end of the run - - - update context from website (not to be confused with contextgarden) - - - profile job (use: mtxrun profile ) - - - generate timing and statistics overview - - - - - process extra (mtx-context-... in distribution) - - - show extras - - - - - - - process file with texexec using pdftex - - - process file with texexec using xetex - - - process file with texexec - - - - - do not check for file and enter scroll mode (=whatever.tmp) - - - - - -]] - local application = logs.application { name = "mtx-context", banner = "ConTeXt Process Management 0.60", - helpinfo = helpinfo, + -- helpinfo = helpinfo, -- table with { category_a = text_1, category_b = text_2 } or helpstring or xml_blob + helpinfo = "mtx-context.xml", } -- local luatexflags = { diff --git a/scripts/context/lua/mtx-context.xml b/scripts/context/lua/mtx-context.xml new file mode 100644 index 000000000..6eb8afeb1 --- /dev/null +++ b/scripts/context/lua/mtx-context.xml @@ -0,0 +1,187 @@ + + + + + mtx-context + ConTeXt Process Management + 0.60 + external helpinfo file + + + + + + process (one or more) files (default action) + + + create context formats + + + + + use ctx file (process management specification) + + + use specified user interface (default: en) + + + + + close pdf file in viewer and start pdf viewer afterwards + + + purge files either or not after a run (=...) + + + purge all files either or not after a run (=...) + + + + + load the given module or style, normally part of the distribution + + + load the given environment file first (document styles) + + + enable given the modes (conditional processing in styles) + + + also consult the given paths when files are looked for + + + set variables that can be consulted during a run (key/value pairs) + + + set the randomseed + + + rename the resulting output to the given name + + + set tracker variables (show list with ) + + + set directive variables (show list with ) + + + disable logcatgories (show list with ) + + + disable logging to the console (logfile only) + + + purge result file before run + + + + + force xml stub + + + force cld (context lua document) stub + + + force lua stub (like texlua) + + + force mp stub + + + + + run extra imposition pass, given that the style sets up imposition + + + ignore imposition specifications in the style + + + + + use luajittex with jit turned off (only use the faster virtual machine) + + + use luajittex with jit turned on (in most cases not faster, even slower) + + + + + only run once (no multipass data file is produced) + + + run without stopping and do not show messages on the console + + + run without stopping + + + run with synctex enabled (optional value: zipped, unzipped, 1, -1) + + + + + generate file database etc. (as luatools does) + + + do not descend to .. and ../.. + + + report installed context version + + + + + assume given file present elsewhere + + + use dummy file as jobname + + + + + + + update context version number (remake needed afterwards, also provide ) + + + omit runtime statistics at the end of the run + + + update context from website (not to be confused with contextgarden) + + + profile job (use: mtxrun profile ) + + + generate timing and statistics overview + + + + + process extra (mtx-context-... in distribution) + + + show extras + + + + + + + process file with texexec using pdftex + + + process file with texexec using xetex + + + process file with texexec + + + + + do not check for file and enter scroll mode (=whatever.tmp) + + + + + diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index e8de4ee70..0207724dd 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -11168,7 +11168,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 4104, stripped down to: 3380 +-- original size: 5959, stripped down to: 4592 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11241,9 +11241,41 @@ local function showhelp(specification,...) end local reporthelp=reporters.help local exporthelp=reporters.export -function reporters.help(t,...) +local function xmlfound(t) local helpinfo=t.helpinfo - if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + if type(helpinfo)=="table" then + return false + end + if type(helpinfo)~="string" then + helpinfo="Warning: no helpinfo found." + t.helpinfo=helpinfo + return false + end + if string.find(helpinfo,".xml$") then + local ownscript=environment.ownscript + local helpdata=false + if ownscript then + local helpfile=file.join(file.pathpart(ownscript),helpinfo) + helpdata=io.loaddata(helpfile) + if helpdata=="" then + helpdata=false + end + end + if not helpdata then + local helpfile=resolvers.findfile(helpinfo,"tex") + helpdata=helpfile and io.loaddata(helpfile) + end + if helpdata and helpdata~="" then + helpinfo=helpdata + else + helpinfo=formatters["Warning: help file %a is not found."](helpinfo) + end + end + t.helpinfo=helpinfo + return string.find(t.helpinfo,"^<%?xml") and true or false +end +function reporters.help(t,...) + if xmlfound(t) then showhelp(t,...) else reporthelp(t,...) @@ -11251,16 +11283,30 @@ function reporters.help(t,...) end local exporters=logs.exporters function reporters.export(t,method,filename) + if not xmlfound(t) then + return exporthelp(t) + end dofile(resolvers.findfile("trac-exp.lua","tex")) if not exporters or not method then return exporthelp(t) end + if not method or method=="" then + method=environment.argument["exporthelp"] + end + if not filename or filename=="" then + filename=environment.files[1] + end if method=="all" then method=table.keys(exporters) else method={ method } end - filename=type(filename)=="string" and filename~="" and filename or false + if type(filename)~="string" or filename=="" then + filename=false + elseif file.pathpart(filename)=="" then + t.report("export file %a will not be saved on the current path (safeguard)") + filename=false + end for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15525,8 +15571,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 642686 --- stripped bytes : 233038 +-- original bytes : 644541 +-- stripped bytes : 233681 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index e8de4ee70..0207724dd 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -11168,7 +11168,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 4104, stripped down to: 3380 +-- original size: 5959, stripped down to: 4592 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11241,9 +11241,41 @@ local function showhelp(specification,...) end local reporthelp=reporters.help local exporthelp=reporters.export -function reporters.help(t,...) +local function xmlfound(t) local helpinfo=t.helpinfo - if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + if type(helpinfo)=="table" then + return false + end + if type(helpinfo)~="string" then + helpinfo="Warning: no helpinfo found." + t.helpinfo=helpinfo + return false + end + if string.find(helpinfo,".xml$") then + local ownscript=environment.ownscript + local helpdata=false + if ownscript then + local helpfile=file.join(file.pathpart(ownscript),helpinfo) + helpdata=io.loaddata(helpfile) + if helpdata=="" then + helpdata=false + end + end + if not helpdata then + local helpfile=resolvers.findfile(helpinfo,"tex") + helpdata=helpfile and io.loaddata(helpfile) + end + if helpdata and helpdata~="" then + helpinfo=helpdata + else + helpinfo=formatters["Warning: help file %a is not found."](helpinfo) + end + end + t.helpinfo=helpinfo + return string.find(t.helpinfo,"^<%?xml") and true or false +end +function reporters.help(t,...) + if xmlfound(t) then showhelp(t,...) else reporthelp(t,...) @@ -11251,16 +11283,30 @@ function reporters.help(t,...) end local exporters=logs.exporters function reporters.export(t,method,filename) + if not xmlfound(t) then + return exporthelp(t) + end dofile(resolvers.findfile("trac-exp.lua","tex")) if not exporters or not method then return exporthelp(t) end + if not method or method=="" then + method=environment.argument["exporthelp"] + end + if not filename or filename=="" then + filename=environment.files[1] + end if method=="all" then method=table.keys(exporters) else method={ method } end - filename=type(filename)=="string" and filename~="" and filename or false + if type(filename)~="string" or filename=="" then + filename=false + elseif file.pathpart(filename)=="" then + t.report("export file %a will not be saved on the current path (safeguard)") + filename=false + end for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15525,8 +15571,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 642686 --- stripped bytes : 233038 +-- original bytes : 644541 +-- stripped bytes : 233681 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index e8de4ee70..0207724dd 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -11168,7 +11168,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 4104, stripped down to: 3380 +-- original size: 5959, stripped down to: 4592 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11241,9 +11241,41 @@ local function showhelp(specification,...) end local reporthelp=reporters.help local exporthelp=reporters.export -function reporters.help(t,...) +local function xmlfound(t) local helpinfo=t.helpinfo - if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + if type(helpinfo)=="table" then + return false + end + if type(helpinfo)~="string" then + helpinfo="Warning: no helpinfo found." + t.helpinfo=helpinfo + return false + end + if string.find(helpinfo,".xml$") then + local ownscript=environment.ownscript + local helpdata=false + if ownscript then + local helpfile=file.join(file.pathpart(ownscript),helpinfo) + helpdata=io.loaddata(helpfile) + if helpdata=="" then + helpdata=false + end + end + if not helpdata then + local helpfile=resolvers.findfile(helpinfo,"tex") + helpdata=helpfile and io.loaddata(helpfile) + end + if helpdata and helpdata~="" then + helpinfo=helpdata + else + helpinfo=formatters["Warning: help file %a is not found."](helpinfo) + end + end + t.helpinfo=helpinfo + return string.find(t.helpinfo,"^<%?xml") and true or false +end +function reporters.help(t,...) + if xmlfound(t) then showhelp(t,...) else reporthelp(t,...) @@ -11251,16 +11283,30 @@ function reporters.help(t,...) end local exporters=logs.exporters function reporters.export(t,method,filename) + if not xmlfound(t) then + return exporthelp(t) + end dofile(resolvers.findfile("trac-exp.lua","tex")) if not exporters or not method then return exporthelp(t) end + if not method or method=="" then + method=environment.argument["exporthelp"] + end + if not filename or filename=="" then + filename=environment.files[1] + end if method=="all" then method=table.keys(exporters) else method={ method } end - filename=type(filename)=="string" and filename~="" and filename or false + if type(filename)~="string" or filename=="" then + filename=false + elseif file.pathpart(filename)=="" then + t.report("export file %a will not be saved on the current path (safeguard)") + filename=false + end for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15525,8 +15571,8 @@ end -- of closure -- used libraries : l-lua.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-md5.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-sto.lua util-prs.lua util-fmt.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-mrg.lua util-tpl.lua util-env.lua luat-env.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 642686 --- stripped bytes : 233038 +-- original bytes : 644541 +-- stripped bytes : 233681 -- end library merge -- cgit v1.2.3