diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-context.lua | 4 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 65 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 65 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 65 |
4 files changed, 165 insertions, 34 deletions
diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 3fa4a094c..e5016d3eb 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['mtx-context'] = { -- todo: more local functions -- todo: pass jobticket/ctxdata table around +local type, next, tostring, tonumber = type, next, tostring, tonumber local format, gmatch, match, gsub, find = string.format, string.gmatch, string.match, string.gsub, string.find local quote, validstring = string.quote, string.valid local concat = table.concat @@ -1403,7 +1404,8 @@ elseif getargument("extras") then elseif getargument("extra") then scripts.context.extra() elseif getargument("exporthelp") then - application.export(getargument("exporthelp"),environment.files[1]) + -- application.export(getargument("exporthelp"),environment.files[1]) + application.export() elseif getargument("help") then if environment.files[1] == "extras" then scripts.context.extras() diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 0207724dd..bf5235f55 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -6102,7 +6102,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21724, stripped down to: 14189 +-- original size: 21607, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6111,6 +6111,49 @@ if not modules then modules={} end modules ['trac-log']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +if tex and (tex.jobname or tex.formatname) then + local texio_write_nl=texio.write_nl + local texio_write=texio.write + local io_write=io.write + local write_nl=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + elseif target=="log" then + texio_write_nl("log",...) + elseif target=="term" then + texio_write_nl("term","") + io_write(...) + else + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + end + end + local write=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write("log",...) + io_write(...) + elseif target=="log" then + texio_write("log",...) + elseif target=="term" then + io_write(...) + else + texio_write("log",...) + io_write(...) + end + end + texio.write=write + texio.write_nl=write_nl +else +end local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write local format,gmatch,find=string.format,string.gmatch,string.find local concat,insert,remove=table.concat,table.insert,table.remove @@ -11168,7 +11211,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 5959, stripped down to: 4592 +-- original size: 5959, stripped down to: 4594 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11286,16 +11329,15 @@ 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"] + method=environment.arguments["exporthelp"] end if not filename or filename=="" then filename=environment.files[1] end + if not exporters or not method then + return exporthelp(t) + end if method=="all" then method=table.keys(exporters) else @@ -11304,9 +11346,10 @@ function reporters.export(t,method,filename) 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 + t.report("export file %a will not be saved on the current path (safeguard)",filename) + return end + dofile(resolvers.findfile("trac-exp.lua","tex")) for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15571,8 +15614,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 : 644541 --- stripped bytes : 233681 +-- original bytes : 644424 +-- stripped bytes : 232539 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 0207724dd..bf5235f55 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -6102,7 +6102,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21724, stripped down to: 14189 +-- original size: 21607, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6111,6 +6111,49 @@ if not modules then modules={} end modules ['trac-log']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +if tex and (tex.jobname or tex.formatname) then + local texio_write_nl=texio.write_nl + local texio_write=texio.write + local io_write=io.write + local write_nl=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + elseif target=="log" then + texio_write_nl("log",...) + elseif target=="term" then + texio_write_nl("term","") + io_write(...) + else + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + end + end + local write=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write("log",...) + io_write(...) + elseif target=="log" then + texio_write("log",...) + elseif target=="term" then + io_write(...) + else + texio_write("log",...) + io_write(...) + end + end + texio.write=write + texio.write_nl=write_nl +else +end local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write local format,gmatch,find=string.format,string.gmatch,string.find local concat,insert,remove=table.concat,table.insert,table.remove @@ -11168,7 +11211,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 5959, stripped down to: 4592 +-- original size: 5959, stripped down to: 4594 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11286,16 +11329,15 @@ 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"] + method=environment.arguments["exporthelp"] end if not filename or filename=="" then filename=environment.files[1] end + if not exporters or not method then + return exporthelp(t) + end if method=="all" then method=table.keys(exporters) else @@ -11304,9 +11346,10 @@ function reporters.export(t,method,filename) 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 + t.report("export file %a will not be saved on the current path (safeguard)",filename) + return end + dofile(resolvers.findfile("trac-exp.lua","tex")) for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15571,8 +15614,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 : 644541 --- stripped bytes : 233681 +-- original bytes : 644424 +-- stripped bytes : 232539 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 0207724dd..bf5235f55 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -6102,7 +6102,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21724, stripped down to: 14189 +-- original size: 21607, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6111,6 +6111,49 @@ if not modules then modules={} end modules ['trac-log']={ copyright="PRAGMA ADE / ConTeXt Development Team", license="see context related readme files" } +if tex and (tex.jobname or tex.formatname) then + local texio_write_nl=texio.write_nl + local texio_write=texio.write + local io_write=io.write + local write_nl=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + elseif target=="log" then + texio_write_nl("log",...) + elseif target=="term" then + texio_write_nl("term","") + io_write(...) + else + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + end + end + local write=function(target,...) + if not io_write then + io_write=io.write + end + if target=="term and log" then + texio_write("log",...) + io_write(...) + elseif target=="log" then + texio_write("log",...) + elseif target=="term" then + io_write(...) + else + texio_write("log",...) + io_write(...) + end + end + texio.write=write + texio.write_nl=write_nl +else +end local write_nl,write=texio and texio.write_nl or print,texio and texio.write or io.write local format,gmatch,find=string.format,string.gmatch,string.find local concat,insert,remove=table.concat,table.insert,table.remove @@ -11168,7 +11211,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 5959, stripped down to: 4592 +-- original size: 5959, stripped down to: 4594 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11286,16 +11329,15 @@ 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"] + method=environment.arguments["exporthelp"] end if not filename or filename=="" then filename=environment.files[1] end + if not exporters or not method then + return exporthelp(t) + end if method=="all" then method=table.keys(exporters) else @@ -11304,9 +11346,10 @@ function reporters.export(t,method,filename) 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 + t.report("export file %a will not be saved on the current path (safeguard)",filename) + return end + dofile(resolvers.findfile("trac-exp.lua","tex")) for i=1,#method do local m=method[i] local result=exporters[m](t,m) @@ -15571,8 +15614,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 : 644541 --- stripped bytes : 233681 +-- original bytes : 644424 +-- stripped bytes : 232539 -- end library merge |