diff options
Diffstat (limited to 'scripts')
36 files changed, 1175 insertions, 458 deletions
diff --git a/scripts/context/lua/mtx-babel.lua b/scripts/context/lua/mtx-babel.lua index 120e49092..8c11465de 100644 --- a/scripts/context/lua/mtx-babel.lua +++ b/scripts/context/lua/mtx-babel.lua @@ -9,9 +9,23 @@ if not modules then modules = { } end modules ['mtx-babel'] = { -- data tables by Thomas A. Schmitz local helpinfo = [[ ---language=string conversion language (e.g. greek) ---structure=string obey given structure (e.g. 'document', default: 'context') ---convert convert babel codes into utf +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-babel</entry> + <entry name="detail">Babel Input To UTF Conversion</entry> + <entry name="version">1.20</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="language" value="string"><short>conversion language (e.g. greek)</short></flag> + <flag name="structure" value="string"><short>obey given structure (e.g. 'document', default: 'context')</short></flag> + <flag name="convert"><short>convert babel codes into utf</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -431,6 +445,8 @@ end if environment.argument("convert") then scripts.babel.convert(environment.files[1] or "") +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-base.lua b/scripts/context/lua/mtx-base.lua index ab5bfe18a..e8bf991f4 100644 --- a/scripts/context/lua/mtx-base.lua +++ b/scripts/context/lua/mtx-base.lua @@ -7,29 +7,43 @@ if not modules then modules = { } end modules ['mtx-base'] = { } local helpinfo = [[ ---generate generate file database ---variables show configuration variables ---configurations show configuration order ---expand-braces expand complex variable ---expand-path expand variable (resolve paths) ---expand-var expand variable (resolve references) ---show-path show path expansion of ... ---var-value report value of variable ---find-file report file location ---find-path report path of file ---make or --ini make luatex format ---run or --fmt= run luatex format ---compile assemble and compile lua inifile ---verbose give a bit more info ---all show all found files ---format=str filter cf format specification (default 'tex', use 'any' for any match) ---pattern=str filter variables ---trackers=list enable given trackers +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-base</entry> + <entry name="detail">ConTeXt TDS Management Tool (aka luatools)</entry> + <entry name="version">1.35</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="generate"><short>generate file database</short></flag> + <flag name="variables"><short>show configuration variables</short></flag> + <flag name="configurations"><short>show configuration order</short></flag> + <flag name="expand-braces"><short>expand complex variable</short></flag> + <flag name="expand-path"><short>expand variable (resolve paths)</short></flag> + <flag name="expand-var"><short>expand variable (resolve references)</short></flag> + <flag name="show-path"><short>show path expansion of ...</short></flag> + <flag name="var-value"><short>report value of variable</short></flag> + <flag name="find-file"><short>report file location</short></flag> + <flag name="find-path"><short>report path of file</short></flag> + <flag name="make"><short>[or <ref name="ini]"/> make luatex format</short></flag> + <flag name="run"><short>[or <ref name="fmt"]"/> run luatex format</short></flag> + <flag name="compile"><short>assemble and compile lua inifile</short></flag> + <flag name="verbose"><short>give a bit more info</short></flag> + <flag name="all"><short>show all found files</short></flag> + <flag name="format" value="str"><short>filter cf format specification (default 'tex', use 'any' for any match)</short></flag> + <flag name="pattern" value="str"><short>filter variables</short></flag> + <flag name="trackers" value="list"><short>enable given trackers</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { name = "mtx-base", - banner = "ConTeXt TDS Management Tool 1.35 (aka luatools)", + banner = "ConTeXt TDS Management Tool (aka luatools) 1.35", helpinfo = helpinfo, } @@ -107,6 +121,8 @@ elseif environment.arguments["variables"] or environment.arguments["show-variabl elseif environment.arguments["configurations"] or environment.arguments["show-configurations"] then resolvers.load("nofiles") resolvers.listers.configurations() +elseif environment.arguments["exporthelp"] then + application.export(environment.arguments["exporthelp"],environment.files[1]) elseif environment.arguments["help"] or (environment.files[1]=='help') or (#environment.files==0) then application.help() elseif environment.files[1] == 'texmfcnf.lua' then diff --git a/scripts/context/lua/mtx-cache.lua b/scripts/context/lua/mtx-cache.lua index 08202bbf8..cd5512618 100644 --- a/scripts/context/lua/mtx-cache.lua +++ b/scripts/context/lua/mtx-cache.lua @@ -7,11 +7,26 @@ if not modules then modules = { } end modules ['mtx-cache'] = { } local helpinfo = [[ ---purge remove not used files ---erase completely remove cache ---list show cache - ---all all (not yet implemented) +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-cache</entry> + <entry name="detail">ConTeXt & MetaTeX Cache Management</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="purge"><short>remove not used files</short></flag> + <flag name="erase"><short>completely remove cache</short></flag> + <flag name="list"><short>show cache</short></flag> + </subcategory> + <subcategory> + <flag name="all"><short>all (not yet implemented)</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -114,6 +129,8 @@ elseif environment.argument("erase") then scripts.cache.erase() elseif environment.argument("list") then scripts.cache.list() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-chars.lua b/scripts/context/lua/mtx-chars.lua index ad2c499be..9f6852da2 100644 --- a/scripts/context/lua/mtx-chars.lua +++ b/scripts/context/lua/mtx-chars.lua @@ -9,9 +9,23 @@ if not modules then modules = { } end modules ['mtx-chars'] = { -- obsolete: --stix convert stix table to math table local helpinfo = [[ ---xtx generate xetx-*.tex (used by xetex) ---pdf generate pdfr-def.tex (used by pdftex) ---entities generate entities table +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-chars</entry> + <entry name="detail">MkII Character Table Generators</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="xtx"><short>generate xetx-*.tex (used by xetex)</short></flag> + <flag name="pdf"><short>generate pdfr-def.tex (used by pdftex)</short></flag> + <flag name="entities"><short>generate entities table</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -387,6 +401,8 @@ elseif environment.argument("xtx") then scripts.chars.makeencoutf() elseif environment.argument("pdf") then scripts.chars.makepdfr() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-check.lua b/scripts/context/lua/mtx-check.lua index 8307a02c6..9f52509ec 100644 --- a/scripts/context/lua/mtx-check.lua +++ b/scripts/context/lua/mtx-check.lua @@ -11,7 +11,21 @@ local gsub, sub, format = string.gsub, string.sub, string.format local insert, remove = table.insert, table.remove local helpinfo = [[ ---convert check tex file for errors +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-check</entry> + <entry name="detail">Basic ConTeXt Syntax Checking</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convert"><short>check tex file for errors</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -229,6 +243,8 @@ if environment.argument("check") then scripts.checker.check(environment.files[1]) elseif environment.argument("help") then application.help() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) elseif environment.files[1] then scripts.checker.check(environment.files[1]) else diff --git a/scripts/context/lua/mtx-colors.lua b/scripts/context/lua/mtx-colors.lua index 2a51d5099..7dd1b4ac4 100644 --- a/scripts/context/lua/mtx-colors.lua +++ b/scripts/context/lua/mtx-colors.lua @@ -9,11 +9,29 @@ if not modules then modules = { } end modules ['mtx-colors'] = { -- todo: fc-cache -v en check dirs, or better is: fc-cat -v | grep Directory local helpinfo = [[ ---table show icc table - -example: - -mtxrun --script color --table somename +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-colors</entry> + <entry name="detail">ConTeXt Color Management</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="table"><short>show icc table</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Example</title> + <subcategory> + <example><command>mtxrun --script color --table somename</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -52,6 +70,8 @@ end if environment.argument("table") then scripts.colors.table() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index ad25b52ce..43180ddae 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -134,6 +134,9 @@ local helpinfo = [[ <flag name="nonstopmode"> <short>run without stopping</short> </flag> + <flag name="synctex"> + <short>run with synctex enabled (optional value: zipped, unzipped, 1, -1)</short> + </flag> </subcategory> <subcategory> <flag name="generate"> @@ -680,6 +683,9 @@ function scripts.context.run(ctxdata,filename) local a_noarrange = getargument("noarrange") local a_jiton = getargument("jiton") -- + a_batchmode = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or nil + a_synctex = tonumber(a_synctex) or (toboolean(a_synctex,true) and 1) or (a_synctex == "zipped" and 1) or (a_synctex == "unzipped" and -1) or nil + -- for i=1,#filelist do -- local filename = filelist[i] @@ -701,6 +707,9 @@ function scripts.context.run(ctxdata,filename) formatname = formatofinterface[analysis.interface] or formatname formatfile, scriptfile = resolvers.locateformat(formatname) end + -- + a_jiton = (a_jiton or toboolean(analysis.jiton,true)) and true or nil + -- if not formatfile or not scriptfile then report("warning: no format found, forcing remake (source driven)") scripts.context.make(formatname,a_engine) @@ -741,11 +750,6 @@ function scripts.context.run(ctxdata,filename) scripts.context.make(formatname) end -- --- if a_engine and a_engine ~= "" and a_engine ~= "luatex" then --- formatfile = gsub(formatfile,"/luatex%-cache/",format("/%s-cache/",a_engine)) --- scriptfile = gsub(scriptfile,"/luatex%-cache/",format("/%s-cache/",a_engine)) --- end - -- local oldhash = multipass_hashfiles(jobname) local newhash = { } local maxnofruns = once and 1 or multipass_nofruns @@ -763,23 +767,23 @@ function scripts.context.run(ctxdata,filename) } -- for k, v in next, environment.arguments do + -- the raw arguments if c_flags[k] == nil then c_flags[k] = v end end -- - a_jiton = a_jiton or toboolean(analysis.jiton,true) -- local l_flags = { - ["interaction"] = (a_batchmode and "batchmode") or (a_nonstopmode and "nonstopmode") or nil, - ["synctex"] = a_synctex and 1 or nil, + ["interaction"] = a_batchmode, + ["synctex"] = a_synctex, ["no-parse-first-line"] = true, -- ["no-mktex"] = true, -- ["file-line-error-style"] = true, ["fmt"] = formatfile, ["lua"] = scriptfile, ["jobname"] = jobname, - ["jiton"] = a_jiton and true or false, + ["jiton"] = a_jiton, } -- if a_synctex then @@ -1118,7 +1122,7 @@ local temporary_runfiles = { "tui", "tua", "tup", "ted", "tes", "top", "log", "tmp", "run", "bck", "rlg", "mpt", "mpx", "mpd", "mpo", "mpb", "ctl", - "synctex.gz", "pgf", + "synctex", "synctex.gz", "pgf", "prep", } diff --git a/scripts/context/lua/mtx-convert.lua b/scripts/context/lua/mtx-convert.lua index 14ade611e..b76b3baaf 100644 --- a/scripts/context/lua/mtx-convert.lua +++ b/scripts/context/lua/mtx-convert.lua @@ -9,12 +9,26 @@ if not modules then modules = { } end modules ['mtx-convert'] = { -- todo: eps and svg local helpinfo = [[ ---convertall convert all graphics on path ---inputpath=string original graphics path ---outputpath=string converted graphics path ---watch watch folders ---force force conversion (even if older) ---delay time between sweeps +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-convert</entry> + <entry name="detail">ConTeXT Graphic Conversion Helpers</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convertall"><short>convert all graphics on path</short></flag> + <flag name="inputpath" value="string"><short>original graphics path</short></flag> + <flag name="outputpath" value="string"><short>converted graphics path</short></flag> + <flag name="watch"><short>watch folders</short></flag> + <flag name="force"><short>force conversion (even if older)</short></flag> + <flag name="delay"><short>time between sweeps</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -154,6 +168,8 @@ if environment.arguments.convertall then convert.convertall() elseif environment.files[1] then convert.convertgiven() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-epub.lua b/scripts/context/lua/mtx-epub.lua index 28a37fec2..11f0a2024 100644 --- a/scripts/context/lua/mtx-epub.lua +++ b/scripts/context/lua/mtx-epub.lua @@ -22,11 +22,29 @@ local format, gsub = string.format, string.gsub local concat = table.concat local helpinfo = [[ ---make create epub zip file - -example: - -mtxrun --script epub --make mydocument +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-epub</entry> + <entry name="detail">ConTeXt EPUB Helpers</entry> + <entry name="version">0.12</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="make"><short>create epub zip file</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Example</title> + <subcategory> + <example><command>mtxrun --script epub --make mydocument</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -353,6 +371,8 @@ end if environment.argument("make") then scripts.epub.make() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-fcd.lua b/scripts/context/lua/mtx-fcd.lua index d7e1d17a7..ba9299020 100644 --- a/scripts/context/lua/mtx-fcd.lua +++ b/scripts/context/lua/mtx-fcd.lua @@ -22,28 +22,46 @@ if not modules then modules = { } end modules ['mtx-fcd'] = { -- part if the same run, so that indeed we change. local helpinfo = [[ ---clear clear the cache ---clear --history [entry] clear the history ---scan clear the cache and add given path(s) ---add add given path(s) ---find file given path (can be substring) ---find --nohistory file given path (can be substring) but don't use history ---stub print platform stub file ---list show roots of cached dirs ---list --history show history of chosen dirs ---help show this help - -usage: - - fcd --scan t:\ - fcd --add f:\project - fcd [--find] whatever - fcd --list +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-fcd</entry> + <entry name="detail">Fast Directory Change</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="clear"><short>clear the cache</short></flag> + <flag name="clear"><short><ref name="history"/> [entry] clear the history</short></flag> + <flag name="scan"><short>clear the cache and add given path(s)</short></flag> + <flag name="add"><short>add given path(s)</short></flag> + <flag name="find"><short>find given path (can be substring)</short></flag> + <flag name="find"><short><ref name="nohistory"/> find given path (can be substring) but don't use history</short></flag> + <flag name="stub"><short>print platform stub file</short></flag> + <flag name="list"><short>show roots of cached dirs</short></flag> + <flag name="list"><short><ref name="history"/> show history of chosen dirs</short></flag> + <flag name="help"><short>show this help</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Example</title> + <subcategory> + <example><command>fcd --scan t:\</command></example> + <example><command>fcd --add f:\project</command></example> + <example><command>fcd [--find] whatever</command></example> + <example><command>fcd --list</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { name = "mtx-fcd", - banner = "Fast Directory Change", + banner = "Fast Directory Change 1.00", helpinfo = helpinfo, } @@ -358,6 +376,8 @@ elseif argument("list") then end elseif argument("help") then application.help() +elseif argument("exporthelp") then + application.export(argument("exporthelp"),environment.files[1]) else -- also argument("find") fcd_load() fcd_find() diff --git a/scripts/context/lua/mtx-flac.lua b/scripts/context/lua/mtx-flac.lua index 851fe6ea1..2155b24be 100644 --- a/scripts/context/lua/mtx-flac.lua +++ b/scripts/context/lua/mtx-flac.lua @@ -168,12 +168,30 @@ end -- local helpinfo = [[ ---collect collect albums in xml file - -example: - -mtxrun --script flac --collect somename.flac -mtxrun --script flac --collect --pattern="m:/music/**") +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-flac</entry> + <entry name="detail">ConTeXt Flac Helpers</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="collect"><short>collect albums in xml file</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Example</title> + <subcategory> + <example><command>mtxrun --script flac --collect somename.flac</command></example> + <example><command>mtxrun --script flac --collect --pattern="m:/music/**")</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -213,6 +231,8 @@ end if environment.argument("collect") then scripts.flac.collect() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 659059fa1..3f75a4fc6 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -45,7 +45,7 @@ local helpinfo = [[ </flags> <examples> <category> - <title>Examples of searches</title> + <title>Examples</title> <subcategory> <example><command>mtxrun --script font --list somename (== --pattern=*somename*)</command></example> </subcategory> diff --git a/scripts/context/lua/mtx-grep.lua b/scripts/context/lua/mtx-grep.lua index 98a97279d..dbcce67f6 100644 --- a/scripts/context/lua/mtx-grep.lua +++ b/scripts/context/lua/mtx-grep.lua @@ -7,12 +7,27 @@ if not modules then modules = { } end modules ['mtx-babel'] = { } local helpinfo = [[ ---pattern search for pattern (optional) ---count count matches only ---nocomment skip lines that start with %% or # ---xml pattern is lpath expression - -patterns are lua patterns and need to be escaped accordingly +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-grep</entry> + <entry name="detail">Simple Grepper</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="pattern"><short>search for pattern (optional)</short></flag> + <flag name="count"><short>count matches only</short></flag> + <flag name="nocomment"><short>skip lines that start with %% or #</short></flag> + <flag name="xml"><short>pattern is lpath expression</short></flag> + </subcategory> + </category> + </flags> + <comments> + <comment>patterns are lua patterns and need to be escaped accordingly</comment> + </comments> +</application> ]] local application = logs.application { @@ -144,7 +159,9 @@ end local pattern = environment.argument("pattern") local files = environment.files and #environment.files > 0 and environment.files -if pattern and files then +if environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),files[1]) +elseif pattern and files then scripts.grep.find(pattern, files) elseif files then scripts.grep.find(files[1], files, 2) diff --git a/scripts/context/lua/mtx-interface.lua b/scripts/context/lua/mtx-interface.lua index 2790e2669..82cefd638 100644 --- a/scripts/context/lua/mtx-interface.lua +++ b/scripts/context/lua/mtx-interface.lua @@ -11,25 +11,43 @@ local gsub, format, gmatch, find = string.gsub, string.format, string.gmatch, st local utfchar, utfgsub = utf.char, utf.gsub local helpinfo = [[ ---interfaces generate context interface files ---messages generate context message files ---labels generate context label files - ---context equals --interfaces --messages --languages - ---scite generate scite interface ---bbedit generate bbedit interface files ---jedit generate jedit interface files ---textpad generate textpad interface files ---text create text files for commands and environments ---raw report commands to the console ---check generate check file - ---toutf replace named characters by utf ---preprocess preprocess mkvi files to tex files [force,suffix] - ---suffix use given suffix for output files ---force force action even when in doubt +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-interface</entry> + <entry name="detail">ConTeXt Interface Related Goodies</entry> + <entry name="version">0.13</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="interfaces"><short>generate context interface files</short></flag> + <flag name="messages"><short>generate context message files</short></flag> + <flag name="labels"><short>generate context label files</short></flag> + </subcategory> + <subcategory> + <flag name="context"><short>equals <ref name="interfaces"/> <ref name="messages"/> <ref name="languages"/></short></flag> + </subcategory> + <subcategory> + <flag name="scite"><short>generate scite interface</short></flag> + <flag name="bbedit"><short>generate bbedit interface files</short></flag> + <flag name="jedit"><short>generate jedit interface files</short></flag> + <flag name="textpad"><short>generate textpad interface files</short></flag> + <flag name="text"><short>create text files for commands and environments</short></flag> + <flag name="raw"><short>report commands to the console</short></flag> + <flag name="check"><short>generate check file</short></flag> + </subcategory> + <subcategory> + <flag name="toutf"><short>replace named characters by utf</short></flag> + <flag name="preprocess"><short>preprocess mkvi files to tex files [force,suffix]</short></flag> + </subcategory> + <subcategory> + <flag name="suffix"><short>use given suffix for output files</short></flag> + <flag name="force"><short>force action even when in doubt</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -596,6 +614,8 @@ elseif ea("scite") or ea("bbedit") or ea("jedit") or ea("textpad") or ea("text") if ea("raw") then scripts.interface.editor("raw") end +elseif ea("exporthelp") then + application.export(ea("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-metapost.lua b/scripts/context/lua/mtx-metapost.lua index 44cf8205d..08daec978 100644 --- a/scripts/context/lua/mtx-metapost.lua +++ b/scripts/context/lua/mtx-metapost.lua @@ -7,19 +7,38 @@ if not modules then modules = { } end modules ['mtx-metapost'] = { -- this was m } local helpinfo = [[ ---rawmp raw metapost run ---metafun use metafun instead of plain ---latex force --tex=latex ---texexec force texexec usage (mkii) ---split split single result file into pages - -intended usage: - -mtxrun --script metapost yourfile.mp -mtxrun --script metapost --split yourfile.mp -mtxrun --script metapost yourfile.123 myfile.mps - -other usage resembles mptopdf.pl +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-metapost</entry> + <entry name="detail">MetaPost to PDF processor</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="rawmp"><short>raw metapost run</short></flag> + <flag name="metafun"><short>use metafun instead of plain</short></flag> + <flag name="latex"><short>force <ref name="tex=latex"/></short></flag> + <flag name="texexec"><short>force texexec usage (mkii)</short></flag> + <flag name="split"><short>split single result file into pages</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script metapost yourfile.mp</command></example> + <example><command>mtxrun --script metapost --split yourfile.mp</command></example> + <example><command>mtxrun --script metapost yourfile.123 myfile.mps</command></example> + </subcategory> + </category> + </examples> + <comments> + <comment>other usage resembles mptopdf.pl</comment> + </comments> +</application> ]] local application = logs.application { @@ -166,10 +185,12 @@ function scripts.mptopdf.convertall() end end -if environment.files[1] then +if environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) +elseif environment.files[1] then scripts.mptopdf.convertall() else - if not environment.arguments.help then + if not environment.argument("help") then report("provide MP output file (or pattern)") report() end diff --git a/scripts/context/lua/mtx-metatex.lua b/scripts/context/lua/mtx-metatex.lua index 0b66d59ef..455ecbd52 100644 --- a/scripts/context/lua/mtx-metatex.lua +++ b/scripts/context/lua/mtx-metatex.lua @@ -9,8 +9,22 @@ if not modules then modules = { } end modules ['mtx-metatex'] = { -- future versions will deal with specific variants of metatex local helpinfo = [[ ---run process (one or more) files (default action) ---make create metatex format(s) +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-metatex</entry> + <entry name="detail">MetaTeX Process Management</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="run"><short>process (one or more) files (default action)</short></flag> + <flag name="make"><short>create metatex format(s)</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -57,6 +71,8 @@ elseif environment.argument("make") then scripts.metatex.timed(scripts.metatex.make) elseif environment.argument("help") then logs.help(messages.help,false) +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) elseif environment.files[1] then scripts.metatex.timed(scripts.metatex.run) else diff --git a/scripts/context/lua/mtx-mkii-help.lua b/scripts/context/lua/mtx-mkii-help.lua new file mode 100644 index 000000000..e43f47bf0 --- /dev/null +++ b/scripts/context/lua/mtx-mkii-help.lua @@ -0,0 +1,376 @@ +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">texexec</entry> + <entry name="detail">TeXExec</entry> + <entry name="version">6.2.1</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="make"><short>make formats</short></flag> + <flag name="check"><short>check versions</short></flag> + <flag name="process"><short>process file</short></flag> + <flag name="mptex"><short>process mp file</short></flag> + <flag name="mpxtex"><short>process mpx file</short></flag> + <flag name="mpgraphic"><short>process mp file to stand-alone graphics</short></flag> + <flag name="mpstatic"><short>process mp/ctx file to stand-alone graphics</short></flag> + <flag name="listing"><short>list of file content</short></flag> + <flag name="figures"><short>generate overview of figures</short></flag> + <flag name="modules"><short>generate module documentation</short></flag> + <flag name="pdfarrange"><short>impose pages (booklets)</short></flag> + <flag name="pdfselect"><short>select pages from file(s)</short></flag> + <flag name="pdfcopy"><short>copy pages from file(s)</short></flag> + <flag name="pdftrim"><short>trim pages from file(s)</short></flag> + <flag name="pdfcombine"><short>combine multiple pages</short></flag> + <flag name="pdfsplit"><short>split file in pages</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + + +local texexec = logs.application { + name = "texexec", + banner = "TeXExec 6.2.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">texutil</entry> + <entry name="detail">TeXUtil</entry> + <entry name="version">9.1.0</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="references"><short>convert tui file into tuo file</short></flag> + <flag name="figures"><short>generate figure dimensions file</short></flag> + <flag name="logfile"><short>filter essential log messages</short></flag> + <flag name="purgefiles"><short>remove most temporary files</short></flag> + <flag name="purgeallfiles"><short>remove all temporary files</short></flag> + <flag name="documentation"><short>generate documentation file from source</short></flag> + <flag name="analyzefile"><short>analyze pdf file</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application>]] + +local texutil = logs.application { + name = "texutil", + banner = "TeXUtil 9.1.0", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">ctxtools</entry> + <entry name="detail">CtxTools</entry> + <entry name="version">1.3.5</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="touchcontextfile"><short>update context version</short></flag> + <flag name="contextversion"><short>report context version</short></flag> + <flag name="jeditinterface"><short>generate jedit syntax files [<ref name="pipe]"/></short></flag> + <flag name="bbeditinterface"><short>generate bbedit syntax files [<ref name="pipe]"/></short></flag> + <flag name="sciteinterface"><short>generate scite syntax files [<ref name="pipe]"/></short></flag> + <flag name="rawinterface"><short>generate raw syntax files [<ref name="pipe]"/></short></flag> + <flag name="translateinterface"><short>generate interface files (xml) [nl de ..]</short></flag> + <flag name="purgefiles"><short>remove temporary files [<ref name="all"/> <ref name="recurse]"/> [basename]</short></flag> + <flag name="documentation generate documentation [--type" value="]"><short>[filename]</short></flag> + <flag name="filterpages'"><short>) # no help, hidden temporary feature</short></flag> + <flag name="dpxmapfiles"><short>convert pdftex mapfiles to dvipdfmx [<ref name="force]"/> [texmfroot]</short></flag> + <flag name="listentities"><short>create doctype entity definition from enco-uc.tex</short></flag> + <flag name="brandfiles"><short>add context copyright notice [<ref name="force]"/></short></flag> + <flag name="platformize"><short>replace line-endings [<ref name="recurse"/> <ref name="force]"/> [pattern]</short></flag> + <flag name="dependencies analyze depedencies within context [--save --compact --filter" value="[macros|filenames] ]"><short>[filename]</short></flag> + <flag name="updatecontext"><short>download latest version and remake formats [<ref name="proxy]"/></short></flag> + <flag name="disarmutfbom"><short>remove utf bom [<ref name="force]"/></short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + +local ctxtools = logs.application { + name = "ctxtools", + banner = "CtxTools 1.3.5", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">textools</entry> + <entry name="detail">TeXTools</entry> + <entry name="version">1.3.1</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="removemapnames"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="restoremapnames"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="hidemapnames"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="videmapnames"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="findfile"><short>filename [<ref name="recurse]"/></short></flag> + <flag name="unzipfiles"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="fixafmfiles"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="mactodos"><short>[pattern] [<ref name="recurse]"/></short></flag> + <flag name="fixtexmftrees"><short>[texmfroot] [<ref name="force]"/></short></flag> + <flag name="replacefile"><short>filename [<ref name="force]"/></short></flag> + <flag name="updatetree"><short>fromroot toroot [<ref name="force"/> <ref name="nocheck"/> <ref name="merge"/> <ref name="delete]"/></short></flag> + <flag name="downcasefilenames"><short>[<ref name="recurse]"/> [<ref name="force]"/></short></flag> + <flag name="stripformfeeds"><short>[<ref name="recurse]"/> [<ref name="force]"/></short></flag> + <flag name="showfont"><short>filename</short></flag> + <flag name="encmake"><short>afmfile encodingname</short></flag> + <flag name="tpmmake"><short>tpm file (run in texmf root)</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + +local textools = logs.application { + name = "textools", + banner = "TeXTools 1.3.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">pdftools</entry> + <entry name="detail">PDFTools</entry> + <entry name="version">1.2.1</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="spotimage filename --colorspec" value=""><short><ref name="colorname="/> [<ref name="retain"/> <ref name="invert"/> <ref name="subpath=]"/></short></flag> + <flag name="colorimage filename --colorspec" value=""><short>[<ref name="retain"/> <ref name="invert"/> <ref name="colorname="/> ]</short></flag> + <flag name="convertimage"><short>filename [<ref name="retain"/> <ref name="subpath]"/></short></flag> + <flag name="downsampleimage"><short>filename [<ref name="retain"/> <ref name="subpath"/> <ref name="lowres"/> <ref name="normal]"/></short></flag> + <flag name="info"><short>filename</short></flag> + <flag name="countpages"><short>[<ref name="pattern"/> <ref name="threshold]"/></short></flag> + <flag name="checkembedded"><short>[<ref name="pattern]"/></short></flag> + <flag name="analyzefile"><short>filename</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + +local pdftools = logs.application { + name = "pdftools", + banner = "PDFTools 1.2.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">tmftools</entry> + <entry name="detail">TMFTools</entry> + <entry name="version">1.1.0</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="analyze"><short>[<ref name="strict"/> <ref name="sort"/> <ref name="rootpath"/> <ref name="treepath"/> <ref name="delete"/> <ref name="force"/>] [pattern]</short></flag> + </subcategory> + <subcategory> + <flag name="serve"><short>act as kpse server</short></flag> + </subcategory> + </category> + </flags> +</application> +]] + +local tmftools = logs.application { + name = "tmftools", + banner = "TMFTools 1.2.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">xmltools</entry> + <entry name="detail">XMLTools</entry> + <entry name="version">1.2.2</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="dir"><short>generate directory listing</short></flag> + <flag name="mmlpages"><short>generate graphic from mathml</short></flag> + <flag name="analyze"><short>report entities and elements [<ref name="utf"/> <ref name="process"/>]</short></flag> + <flag name="cleanup"><short>cleanup xml file [<ref name="force"/>]</short></flag> + <flag name="enhance"><short>enhance xml file (partial)</short></flag> + <flag name="filter"><short>filter elements from xml file [<ref name="element"/>]</short></flag> + <flag name="dir"><short>generate ddirectory listing</short></flag> + </subcategory> + </category> + </flags> +</application> +]] + +local xmltools = logs.application { + name = "xmltools", + banner = "XMLTools 1.2.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">pstopdf</entry> + <entry name="detail">PStoPDF</entry> + <entry name="version">2.0.1</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="request"><short>handles exa request file</short></flag> + <flag name="watch"><short>watch folders for conversions (untested)</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + +local pstopdf = logs.application { + name = "pstopdf", + banner = "PStoPDF 2.0.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">rlxtools</entry> + <entry name="detail">RlxTools</entry> + <entry name="version">1.0.1</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="manipulate"><short>[<ref name="test]"/> manipulatorfile resourselog</short></flag> + <flag name="identify"><short>[<ref name="collect]"/> filename</short></flag> + </subcategory> + </category> + </flags> + </category> + </flags> +</application> +]] + +local rlxtools = logs.application { + name = "rlxtools", + banner = "RlxTools 1.0.1", + helpinfo = helpinfo, +} + +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">imgtopdf</entry> + <entry name="detail">ImgToPdf</entry> + <entry name="version">1.1.2</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convert"><short>convert image into pdf</short></flag> + <flag name="compression"><short>level of compression in percent</short></flag> + <flag name="depth"><short>image depth in bits</short></flag> + <flag name="colorspace"><short> colorspace (rgb,cmyk,gray)</short></flag> + <flag name="quality"><short>quality in percent</short></flag> + <flag name="inputpath"><short>path where files are looked for</short></flag> + <flag name="outputpath"><short>path where files end up</short></flag> + <flag name="auto"><short>determine settings automatically</short></flag> + </subcategory> + </category> + </flags> +</application> +]] + +local imgtopdf = logs.application { + name = "imgtopdf", + banner = "ImgToPdf 1.1.2", + helpinfo = helpinfo, +} + +-- texmfstart.rb is normally replaced by mtxrun +-- runtools.rb is run from within context +-- concheck.rb is run from within editors +-- texsync.rb is no longer in the zip +-- mpstools.rb is no longer in the zip +-- rscortool.rb is only run indirectly +-- rsfiltool.rb is only run indirectly +-- rslibtool.rb is only run indirectly + + +local application = logs.application { + name = "mkii-help", + banner = "MkII Help generator 1.00", +} + +local filename = environment.files[1] + +if not filename then + application.report("no mkii script given") + return +end + +local mkiiapplication + +if filename == "texexec" then mkiiapplication = texexec +elseif filename == "texutil" then mkiiapplication = texutil +elseif filename == "ctxtools" then mkiiapplication = ctxtools +elseif filename == "textools" then mkiiapplication = textools +elseif filename == "pdftools" then mkiiapplication = pdftools +elseif filename == "tmftools" then mkiiapplication = tmftools +elseif filename == "xmltools" then mkiiapplication = xmltools +elseif filename == "pstopdf" then mkiiapplication = pstopdf +elseif filename == "rlxtools" then mkiiapplication = rlxtools +elseif filename == "imgtopdf" then mkiiapplication = imgtopdf end + +if not mkiiapplication then + application.report("no valid mkii script given") + return +end + +if environment.argument("exporthelp") then + mkiiapplication.export(environment.argument("exporthelp"),environment.files[2]) +else + mkiiapplication.help() +end diff --git a/scripts/context/lua/mtx-modules.lua b/scripts/context/lua/mtx-modules.lua index 902b12ac3..ef38a7156 100644 --- a/scripts/context/lua/mtx-modules.lua +++ b/scripts/context/lua/mtx-modules.lua @@ -10,9 +10,23 @@ scripts = scripts or { } scripts.modules = scripts.modules or { } local helpinfo = [[ ---convert convert source files (tex, mkii, mkiv, mp) to 'ted' files ---process process source files (tex, mkii, mkiv, mp) to 'pdf' files ---prep use original name with suffix 'prep' appended +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-modules</entry> + <entry name="detail">ConTeXt Module Documentation Generators</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convert"><short>convert source files (tex, mkii, mkiv, mp) to 'ted' files</short></flag> + <flag name="process"><short>process source files (tex, mkii, mkiv, mp) to 'pdf' files</short></flag> + <flag name="prep"><short>use original name with suffix 'prep' appended</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -181,6 +195,8 @@ if environment.argument("process") then scripts.modules.process(true) elseif environment.argument("convert") then scripts.modules.process(false) +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-package.lua b/scripts/context/lua/mtx-package.lua index 879dd5e3a..8c9e6b9fc 100644 --- a/scripts/context/lua/mtx-package.lua +++ b/scripts/context/lua/mtx-package.lua @@ -9,7 +9,21 @@ if not modules then modules = { } end modules ['mtx-package'] = { local format, gsub, gmatch = string.format, string.gsub, string.gmatch local helpinfo = [[ ---merge merge 'loadmodule' into merge file +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-package</entry> + <entry name="detail">Distribution Related Goodies</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="merge"><short>merge 'loadmodule' into merge file</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -63,6 +77,8 @@ end if environment.argument("merge") then scripts.package.merge_luatex_files(environment.files[1] or "") +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-patterns.lua b/scripts/context/lua/mtx-patterns.lua index 86f63bb16..7144da9b0 100644 --- a/scripts/context/lua/mtx-patterns.lua +++ b/scripts/context/lua/mtx-patterns.lua @@ -12,18 +12,36 @@ local addsuffix = file.addsuffix local lpegmatch, validutf8 = lpeg.match, lpeg.patterns.validutf8 local helpinfo = [[ ---convert generate context language files (mnemonic driven, if not given then all) ---check check pattern file (or those used by context when no file given) ---path source path where hyph-foo.tex files are stored ---destination destination path ---specification additional patterns: e.g.: =cy,hyph-cy,welsh - -examples of usage: - -mtxrun --script pattern --check hyph-*.tex -mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns -mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns -mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-patterns</entry> + <entry name="detail">ConTeXt Pattern File Management</entry> + <entry name="version">0.20</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="convert"><short>generate context language files (mnemonic driven, if not given then all)</short></flag> + <flag name="check"><short>check pattern file (or those used by context when no file given)</short></flag> + <flag name="path"><short>source path where hyph-foo.tex files are stored</short></flag> + <flag name="destination"><short>destination path</short></flag> + <flag name="specification"><short>additional patterns: e.g.: =cy,hyph-cy,welsh</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script pattern --check hyph-*.tex</command></example> + <example><command>mtxrun --script pattern --check --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns</command></example> + <example><command>mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/tex --destination=e:/tmp/patterns</command></example> + <example><command>mtxrun --script pattern --convert --path=c:/data/develop/svn-hyphen/trunk/hyph-utf8/tex/generic/hyph-utf8/patterns/txt --destination=e:/tmp/patterns</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -529,6 +547,8 @@ if environment.argument("check") then elseif environment.argument("convert") then scripts.patterns.prepare() scripts.patterns.convert() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-pdf.lua b/scripts/context/lua/mtx-pdf.lua index f37ee006a..3e4130344 100644 --- a/scripts/context/lua/mtx-pdf.lua +++ b/scripts/context/lua/mtx-pdf.lua @@ -13,9 +13,23 @@ local concat = table.concat local setmetatableindex, sortedhash, sortedkeys = table.setmetatableindex, table.sortedhash, table.sortedkeys local helpinfo = [[ ---info show some info about the given file ---metadata show metadata xml blob ---fonts show used fonts (--detail) +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-pdf</entry> + <entry name="detail">ConTeXt PDF Helpers</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="info"><short>show some info about the given file</short></flag> + <flag name="metadata"><short>show metadata xml blob</short></flag> + <flag name="fonts"><short>show used fonts (<ref name="detail)"/></short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -213,6 +227,8 @@ elseif environment.argument("metadata") then scripts.pdf.metadata(filename) elseif environment.argument("fonts") then scripts.pdf.fonts(filename) +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-profile.lua b/scripts/context/lua/mtx-profile.lua index 35cf1fc47..3550474f3 100644 --- a/scripts/context/lua/mtx-profile.lua +++ b/scripts/context/lua/mtx-profile.lua @@ -12,8 +12,22 @@ if not modules then modules = { } end modules ['mtx-profile'] = { local match, format, find = string.match, string.format, string.find local helpinfo = [[ ---analyze analyze lua calls ---trace analyze tex calls +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-profile</entry> + <entry name="detail">ConTeXt MkIV LuaTeX Profiler</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="analyze"><short>analyze lua calls</short></flag> + <flag name="trace"><short>analyze tex calls</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -166,6 +180,8 @@ if environment.argument("analyze") then scripts.profiler.analyze(environment.files[1] or "luatex-profile.log") elseif environment.argument("trace") then scripts.profiler.analyze(environment.files[1] or "temp.log") +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-rsync.lua b/scripts/context/lua/mtx-rsync.lua index 288419431..65f795ee5 100644 --- a/scripts/context/lua/mtx-rsync.lua +++ b/scripts/context/lua/mtx-rsync.lua @@ -46,9 +46,23 @@ if not modules then modules = { } end modules ['mtx-rsync'] = { -- } local helpinfo = [[ ---job use given file as specification ---dryrun show what would happen ---force force run +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-rsync</entry> + <entry name="detail">Rsync Helpers</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="job"><short>use given file as specification</short></flag> + <flag name="dryrun"><short>show what would happen</short></flag> + <flag name="force"><short>force run</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -164,7 +178,9 @@ elseif arguments.force then rsync.mode = "force" end -if arguments.job then +if arguments.exporthelp then + application.export(arguments.exporthelp,environment.files[1]) +elseif arguments.job then rsync.job(files[1]) elseif files[1] and files[2] then rsync.run(files[1],files[2]) diff --git a/scripts/context/lua/mtx-scite.lua b/scripts/context/lua/mtx-scite.lua index 3369c5f3b..972edbfe6 100644 --- a/scripts/context/lua/mtx-scite.lua +++ b/scripts/context/lua/mtx-scite.lua @@ -10,13 +10,22 @@ local P, R, S, C, Ct, Cf, Cc, Cg = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Ct, lpeg local lpegmatch = lpeg.match local format, lower, gmatch = string.format, string.lower, string.gmatch --- local helpinfo = [[ --- --start [--verbose] start scite --- --test report what will happen --- ]] - local helpinfo = [[ ---words convert spell-*.txt into spell-*.lua +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-scite</entry> + <entry name="detail">Scite Helper Script</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="words"><short>convert spell-*.txt into spell-*.lua</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -242,6 +251,8 @@ end if environment.argument("words") then scripts.scite.words() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-server.lua b/scripts/context/lua/mtx-server.lua index 766df8da8..5ec15de70 100644 --- a/scripts/context/lua/mtx-server.lua +++ b/scripts/context/lua/mtx-server.lua @@ -7,12 +7,26 @@ if not modules then modules = { } end modules ['mtx-server'] = { } local helpinfo = [[ ---start start server ---port port to listen to ---root server root ---scripts scripts sub path ---index index file ---auto start on own path +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-server</entry> + <entry name="detail">Simple Webserver For Helpers</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="start"><short>start server</short></flag> + <flag name="port"><short>port to listen to</short></flag> + <flag name="root"><short>server root</short></flag> + <flag name="scripts"><short>scripts sub path</short></flag> + <flag name="index"><short>index file</short></flag> + <flag name="auto"><short>start on own path</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -379,6 +393,8 @@ elseif environment.argument("start") then scripts = environment.argument("scripts"), script = environment.argument("script"), } +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-texworks.lua b/scripts/context/lua/mtx-texworks.lua index 33e56df46..ae5f2afa4 100644 --- a/scripts/context/lua/mtx-texworks.lua +++ b/scripts/context/lua/mtx-texworks.lua @@ -7,8 +7,22 @@ if not modules then modules = { } end modules ['mtx-texworks'] = { } local helpinfo = [[ ---start [--verbose] start texworks ---test report what will happen +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-texworks</entry> + <entry name="detail">TeXworks Startup Script</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="start"><short>[<ref name="verbose]"/> start texworks</short></flag> + <flag name="test"><short>report what will happen</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -100,6 +114,8 @@ if environment.argument("start") then scripts.texworks.start(true) elseif environment.argument("test") then scripts.texworks.start() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-timing.lua b/scripts/context/lua/mtx-timing.lua index 03100e991..7d1a220e4 100644 --- a/scripts/context/lua/mtx-timing.lua +++ b/scripts/context/lua/mtx-timing.lua @@ -9,9 +9,23 @@ if not modules then modules = { } end modules ['mtx-timing'] = { local format, gsub, concat = string.format, string.gsub, table.concat local helpinfo = [[ ---xhtml make xhtml file ---launch launch after conversion ---remove remove after launching +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-timing</entry> + <entry name="detail">ConTeXt Timing Tools</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="xhtml"><short>make xhtml file</short></flag> + <flag name="launch"><short>launch after conversion</short></flag> + <flag name="remove"><short>remove after launching</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -196,6 +210,8 @@ end if environment.argument("xhtml") then scripts.timings.xhtml(environment.files[1] or "") +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-tools.lua b/scripts/context/lua/mtx-tools.lua index 22a83e603..19b7458a1 100644 --- a/scripts/context/lua/mtx-tools.lua +++ b/scripts/context/lua/mtx-tools.lua @@ -9,22 +9,37 @@ if not modules then modules = { } end modules ['mtx-tools'] = { local find, format, sub, rep, gsub, lower = string.find, string.format, string.sub, string.rep, string.gsub, string.lower local helpinfo = [[ ---disarmutfbomb remove utf bomb if present - --force remove indeed - ---dirtoxml glob directory into xml - --pattern glob pattern (default: *) - --url url attribute (no processing) - --root the root of the globbed path (default: .) - --output output filename (console by default) - --recurse recurse into subdirecories - --stripname take pathpart of given pattern - --longname set name attributes to full path name - ---downcase - --pattern glob pattern (default: *) - --recurse recurse into subdirecories - --force downcase indeed +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-tools</entry> + <entry name="detail">Some File Related Goodies</entry> + <entry name="version">1.01</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="disarmutfbomb"><short>remove utf bomb if present</short></flag> + <flag name="force"><short>remove indeed</short></flag> + </subcategory> + <subcategory> + <flag name="dirtoxml"><short>glob directory into xml</short></flag> + <flag name="pattern"><short>glob pattern (default: *)</short></flag> + <flag name="url"><short>url attribute (no processing)</short></flag> + <flag name="root"><short>the root of the globbed path (default: .)</short></flag> + <flag name="output"><short>output filename (console by default)</short></flag> + <flag name="recurse"><short>recurse into subdirecories</short></flag> + <flag name="stripname"><short>take pathpart of given pattern</short></flag> + <flag name="longname"><short>set name attributes to full path name</short></flag> + </subcategory> + <subcategory> + <flag name="pattern"><short>glob pattern (default: *)</short></flag> + <flag name="recurse"><short>recurse into subdirecories</short></flag> + <flag name="force"><short>downcase indeed</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -177,6 +192,8 @@ elseif environment.argument("dirtoxml") then scripts.tools.dirtoxml() elseif environment.argument("downcase") then scripts.tools.downcase() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-unzip.lua b/scripts/context/lua/mtx-unzip.lua index 645863426..02d9676bc 100644 --- a/scripts/context/lua/mtx-unzip.lua +++ b/scripts/context/lua/mtx-unzip.lua @@ -11,9 +11,23 @@ if not modules then modules = { } end modules ['mtx-unzip'] = { local format = string.format local helpinfo = [[ ---list list files in archive ---junk flatten unzipped directory structure ---extract extract files +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-unzip</entry> + <entry name="detail">Simple Unzipper</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="list"><short>list files in archive</short></flag> + <flag name="junk"><short>flatten unzipped directory structure</short></flag> + <flag name="extract"><short>extract files</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -109,6 +123,8 @@ if environment.arguments["h"] or environment.arguments["help"] then application.help() elseif environment.arguments["l"] or environment.arguments["list"] then scripts.unzipper.list(zipfile) +elseif environment.arguments["exporthelp"] then + application.export(environment.arguments["exporthelp"],environment.files[1]) elseif environment.files[1] then -- implicit --extract scripts.unzipper.extract(zipfile) else diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index 8eee996b5..64203d3e3 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -12,24 +12,38 @@ if not modules then modules = { } end modules ['mtx-update'] = { -- platforms that matter. local helpinfo = [[ ---platform=string platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc) ---server=string repository url (rsync://contextgarden.net) ---module=string repository url (minimals) ---repository=string specify version (current, experimental) ---context=string specify version (current, latest, beta, yyyy.mm.dd) ---rsync=string rsync binary (rsync) ---texroot=string installation directory (not guessed for the moment) ---engine=string tex engine (luatex, pdftex, xetex) ---modules=string extra modules (can be list or 'all') ---fonts=string additional fonts (can be list or 'all') ---goodies=string extra binaries (like scite and texworks) ---force instead of a dryrun, do the real thing ---update update minimal tree ---make also make formats and generate file databases ---keep don't delete unused or obsolete files ---state update tree using saved state ---cygwin adapt drive specs to cygwin ---mingw assume mingw binaries being used +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-update</entry> + <entry name="detail">ConTeXt Minimals Updater</entry> + <entry name="version">0.31</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="platform" value="string"><short>platform (windows, linux, linux-64, osx-intel, osx-ppc, linux-ppc)</short></flag> + <flag name="server" value="string"><short>repository url (rsync://contextgarden.net)</short></flag> + <flag name="module" value="string"><short>repository url (minimals)</short></flag> + <flag name="repository" value="string"><short>specify version (current, experimental)</short></flag> + <flag name="context" value="string"><short>specify version (current, latest, beta, yyyy.mm.dd)</short></flag> + <flag name="rsync" value="string"><short>rsync binary (rsync)</short></flag> + <flag name="texroot" value="string"><short>installation directory (not guessed for the moment)</short></flag> + <flag name="engine" value="string"><short>tex engine (luatex, pdftex, xetex)</short></flag> + <flag name="modules" value="string"><short>extra modules (can be list or 'all')</short></flag> + <flag name="fonts" value="string"><short>additional fonts (can be list or 'all')</short></flag> + <flag name="goodies" value="string"><short>extra binaries (like scite and texworks)</short></flag> + <flag name="force"><short>instead of a dryrun, do the real thing</short></flag> + <flag name="update"><short>update minimal tree</short></flag> + <flag name="make"><short>also make formats and generate file databases</short></flag> + <flag name="keep"><short>don't delete unused or obsolete files</short></flag> + <flag name="state"><short>update tree using saved state</short></flag> + <flag name="cygwin"><short>adapt drive specs to cygwin</short></flag> + <flag name="mingw"><short>assume mingw binaries being used</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -646,6 +660,8 @@ if environment.argument("update") then end elseif environment.argument("make") then scripts.update.make() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtx-watch.lua b/scripts/context/lua/mtx-watch.lua index 4ed7b1575..95323f571 100644 --- a/scripts/context/lua/mtx-watch.lua +++ b/scripts/context/lua/mtx-watch.lua @@ -7,14 +7,28 @@ if not modules then modules = { } end modules ['mtx-watch'] = { } local helpinfo = [[ ---logpath optional path for log files ---watch watch given path [--delay] ---pipe use pipe instead of execute ---delay delay between sweeps ---automachine replace /machine/ in path /<servername>/ ---collect condense log files ---cleanup=delay remove files in given path [--force] ---showlog show log data +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-watch</entry> + <entry name="detail">ConTeXt Request Watchdog</entry> + <entry name="version">1.00</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="logpath"><short>optional path for log files</short></flag> + <flag name="watch"><short>watch given path [<ref name="delay]"/></short></flag> + <flag name="pipe"><short>use pipe instead of execute</short></flag> + <flag name="delay"><short>delay between sweeps</short></flag> + <flag name="automachine"><short>replace /machine/ in path /servername/</short></flag> + <flag name="collect"><short>condense log files</short></flag> + <flag name="cleanup" value="delay"><short>remove files in given path [<ref name="force]"/></short></flag> + <flag name="showlog"><short>show log data</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -410,6 +424,8 @@ elseif environment.argument("cleanup") then scripts.watch.save_logs(scripts.watch.cleanup_stale_files()) elseif environment.argument("showlog") then scripts.watch.show_logs() +elseif environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) else application.help() end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 92c9a763a..ef405fb1e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -6072,7 +6072,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21510, stripped down to: 15167 +-- original size: 21573, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6588,7 +6588,10 @@ local reporters={ info=reportinfo, export=reportexport, } +local exporters={ +} logs.reporters=reporters +logs.exporters=exporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner @@ -11178,7 +11181,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 3490, stripped down to: 2879 +-- original size: 4104, stripped down to: 3380 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11217,9 +11220,9 @@ local function showhelp(specification,...) local value=flag.at.value local short=xmltext(xmlfirst(flag,"/short")) if value then - report("--%-24s %s",formatters["%s=%s"](name,value),short) + report("--%-20s %s",formatters["%s=%s"](name,value),short) else - report("--%-24s %s",name,short) + report("--%-20s %s",name,short) end end report() @@ -11242,6 +11245,12 @@ local function showhelp(specification,...) report() end end + for comment in xmlcollected(root,"/application/comments/comment") do + local comment=xmltext(comment) + report() + report(comment) + report() + end end local reporthelp=reporters.help local exporthelp=reporters.export @@ -11253,14 +11262,30 @@ function reporters.help(t,...) reporthelp(t,...) end end +local exporters=logs.exporters function reporters.export(t,method,filename) dofile(resolvers.findfile("trac-exp.lua","tex")) - local exporters=logs.exporters - local result=method and exporters and exporters[method] and exporters[method](t,method) or exporthelp(t) - if type(filename)=="string" and filename~="" then - io.savedata(filename,result) + if not exporters or not method then + return exporthelp(t) + end + if method=="all" then + method=table.keys(exporters) else - reporters.lines(t,result) + method={ method } + end + filename=type(filename)=="string" and filename~="" and filename or false + for i=1,#method do + local m=method[i] + local result=exporters[m](t,m) + if result and result~="" then + if filename then + local fullname=file.replacesuffix(filename,m) + t.report("saving export in %a",fullname) + io.savedata(fullname,result) + else + reporters.lines(t,result) + end + end end end @@ -15513,8 +15538,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 : 640903 --- stripped bytes : 231417 +-- original bytes : 641580 +-- stripped bytes : 231548 -- end library merge diff --git a/scripts/context/ruby/mpstools.rb b/scripts/context/ruby/mpstools.rb deleted file mode 100644 index 534bfb95b..000000000 --- a/scripts/context/ruby/mpstools.rb +++ /dev/null @@ -1,7 +0,0 @@ -# todo -# -# this script will replace mptopdf and makempy - -puts("This program is yet unfinished, for the moment it just calls 'mptopdf'.\n\n") - -system("texmfstart mptopdf #{ARGV.join(' ')}") diff --git a/scripts/context/ruby/texsync.rb b/scripts/context/ruby/texsync.rb deleted file mode 100644 index fd6593f05..000000000 --- a/scripts/context/ruby/texsync.rb +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env ruby - -# program : texsync -# copyright : PRAGMA Advanced Document Engineering -# version : 2003-2005 -# author : Hans Hagen -# -# project : ConTeXt / eXaMpLe -# concept : Hans Hagen -# info : j.hagen@xs4all.nl -# www : www.pragma-ade.com - -# For the moment this script only handles the 'minimal' context -# distribution. In due time I will add a few more options, like -# synchronization of the iso image. - -# taco's sync: rsync -au -v rsync://www.pragma-ade.com/all ./htdocs - -banner = ['TeXSync', 'version 1.1.1', '2002/2004', 'PRAGMA ADE/POD'] - -$: << File.expand_path(File.dirname($0)) ; $: << File.join($:.last,'lib') ; $:.uniq! - -require 'base/switch' -require 'base/logger' -# require 'base/tool' - -require 'rbconfig' - -class Commands - - include CommandBase - - @@formats = ['en','nl','de','cz','it','ro', 'fr'] - @@always = ['metafun','mptopdf','en','nl'] - @@rsync = 'rsync -r -z -c --progress --stats "--exclude=*.fmt" "--exclude=*.efmt" "--exclude=*.mem"' - - @@kpsewhich = Hash.new - - @@kpsewhich['minimal'] = 'SELFAUTOPARENT' - @@kpsewhich['context'] = 'TEXMFLOCAL' - @@kpsewhich['documentation'] = 'TEXMFLOCAL' - @@kpsewhich['unknown'] = 'SELFAUTOPARENT' - - def update - - report - - return unless destination = getdestination - - texpaths = gettexpaths - address = option('address') - user = option('user') - tree = option('tree') - force = option('force') - - ok = true - begin - report("synchronizing '#{tree}' from '#{address}' to '#{destination}'") - report - if texpaths then - texpaths.each do |path| - report("synchronizing path '#{path}' of '#{tree}' from '#{address}' to '#{destination}'") - command = "#{rsync} #{user}@#{address}::#{tree}/#{path} #{destination}/{path}" - ok = ok && system(command) if force - end - else - command = "#{@@rsync} #{user}@#{address}::#{tree} #{destination}" - ok = system(command) if force - end - rescue - report("error in running rsync") - ok = false - ensure - if force then - if ok then - if option('make') then - report("generating tex and metapost formats") - report - @@formats.delete_if do |f| - begin - `kpsewhich cont-#{f}`.chomp.empty? - rescue - end - end - str = [@@formats,@@always].flatten.uniq.join(' ') - begin - system("texexec --make --alone #{str}") - rescue - report("unable to generate formats '#{str}'") - else - report - end - else - report("regenerate the formats files if needed") - end - else - report("error in synchronizing '#{tree}'") - end - else - report("provide --force to execute '#{command}'") unless force - end - end - - end - - def list - - report - - address = option('address') - user = option('user') - result = nil - - begin - report("fetching list of trees from '#{address}'") - command = "#{@@rsync} #{user}@#{address}::" - if option('force') then - result = `#{command}`.chomp - else - report("provide --force to execute '#{command}'") - end - rescue - result = nil - else - if result then - report("available trees:") - report - reportlines(result) - end - ensure - report("unable to fetch list") unless result - end - - end - - private - - def gettexpaths - if option('full') then - texpaths = ['texmf','texmf-local','texmf-fonts','texmf-mswin','texmf-linux','texmf-macos'] - elsif option('terse') then - texpaths = ['texmf','texmf-local','texmf-fonts'] - case RbConfig::CONFIG['host_os'] # or: Tool.ruby_platform - when /mswin/ then texpaths.push('texmf-mswin') - when /linux/ then texpaths.push('texmf-linux') - when /darwin/ then texpaths.push('texmf-macosx') - end - else - texpaths = nil - end - texpaths - end - - def getdestination - if (destination = option('destination')) && ! destination.empty? then - begin - if @@kpsewhich.key?(destination) then - destination = @@kpsewhich[option('tree')] || @@kpsewhich['unknown'] - destination = `kpsewhich --expand-var=$#{destination}`.chomp - elsif ! FileTest.directory?(destination) then - destination = nil - end - rescue - report("unable to determine destination tex root") - else - if ! destination || destination.empty? then - report("no destination is specified") - elsif not FileTest.directory?(destination) then - report("invalid destination '#{destination}'") - elsif not FileTest.writable?(destination) then - report("destination '#{destination}' is not writable") - else - report("using destination '#{destination}'") - return destination - end - end - else - report("unknown destination") - end - return nil - end - -end - -logger = Logger.new(banner.shift) -commandline = CommandLine.new - -commandline.registeraction('update', 'update installed tree') -commandline.registeraction('list', 'list available trees') - -commandline.registerflag('terse', 'download as less as possible (esp binaries)') -commandline.registerflag('full', 'download everything (all binaries)') -commandline.registerflag('force', 'confirm action') -commandline.registerflag('make', 'remake formats') - -commandline.registervalue('address', 'www.pragma-ade.com', 'adress of repository (www.pragma-ade)') -commandline.registervalue('user', 'guest', 'user account (guest)') -commandline.registervalue('tree', 'tex', 'tree to synchronize (tex)') -commandline.registervalue('destination', nil, 'destination of tree (kpsewhich)') - -commandline.registeraction('help') -commandline.registeraction('version') - -commandline.expand - -Commands.new(commandline,logger,banner).send(commandline.action || 'help') diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 92c9a763a..ef405fb1e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -6072,7 +6072,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21510, stripped down to: 15167 +-- original size: 21573, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6588,7 +6588,10 @@ local reporters={ info=reportinfo, export=reportexport, } +local exporters={ +} logs.reporters=reporters +logs.exporters=exporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner @@ -11178,7 +11181,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 3490, stripped down to: 2879 +-- original size: 4104, stripped down to: 3380 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11217,9 +11220,9 @@ local function showhelp(specification,...) local value=flag.at.value local short=xmltext(xmlfirst(flag,"/short")) if value then - report("--%-24s %s",formatters["%s=%s"](name,value),short) + report("--%-20s %s",formatters["%s=%s"](name,value),short) else - report("--%-24s %s",name,short) + report("--%-20s %s",name,short) end end report() @@ -11242,6 +11245,12 @@ local function showhelp(specification,...) report() end end + for comment in xmlcollected(root,"/application/comments/comment") do + local comment=xmltext(comment) + report() + report(comment) + report() + end end local reporthelp=reporters.help local exporthelp=reporters.export @@ -11253,14 +11262,30 @@ function reporters.help(t,...) reporthelp(t,...) end end +local exporters=logs.exporters function reporters.export(t,method,filename) dofile(resolvers.findfile("trac-exp.lua","tex")) - local exporters=logs.exporters - local result=method and exporters and exporters[method] and exporters[method](t,method) or exporthelp(t) - if type(filename)=="string" and filename~="" then - io.savedata(filename,result) + if not exporters or not method then + return exporthelp(t) + end + if method=="all" then + method=table.keys(exporters) else - reporters.lines(t,result) + method={ method } + end + filename=type(filename)=="string" and filename~="" and filename or false + for i=1,#method do + local m=method[i] + local result=exporters[m](t,m) + if result and result~="" then + if filename then + local fullname=file.replacesuffix(filename,m) + t.report("saving export in %a",fullname) + io.savedata(fullname,result) + else + reporters.lines(t,result) + end + end end end @@ -15513,8 +15538,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 : 640903 --- stripped bytes : 231417 +-- original bytes : 641580 +-- stripped bytes : 231548 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 92c9a763a..ef405fb1e 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -6072,7 +6072,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 21510, stripped down to: 15167 +-- original size: 21573, stripped down to: 15212 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6588,7 +6588,10 @@ local reporters={ info=reportinfo, export=reportexport, } +local exporters={ +} logs.reporters=reporters +logs.exporters=exporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner @@ -11178,7 +11181,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-xml"] = package.loaded["trac-xml"] or true --- original size: 3490, stripped down to: 2879 +-- original size: 4104, stripped down to: 3380 if not modules then modules={} end modules ['trac-xml']={ version=1.001, @@ -11217,9 +11220,9 @@ local function showhelp(specification,...) local value=flag.at.value local short=xmltext(xmlfirst(flag,"/short")) if value then - report("--%-24s %s",formatters["%s=%s"](name,value),short) + report("--%-20s %s",formatters["%s=%s"](name,value),short) else - report("--%-24s %s",name,short) + report("--%-20s %s",name,short) end end report() @@ -11242,6 +11245,12 @@ local function showhelp(specification,...) report() end end + for comment in xmlcollected(root,"/application/comments/comment") do + local comment=xmltext(comment) + report() + report(comment) + report() + end end local reporthelp=reporters.help local exporthelp=reporters.export @@ -11253,14 +11262,30 @@ function reporters.help(t,...) reporthelp(t,...) end end +local exporters=logs.exporters function reporters.export(t,method,filename) dofile(resolvers.findfile("trac-exp.lua","tex")) - local exporters=logs.exporters - local result=method and exporters and exporters[method] and exporters[method](t,method) or exporthelp(t) - if type(filename)=="string" and filename~="" then - io.savedata(filename,result) + if not exporters or not method then + return exporthelp(t) + end + if method=="all" then + method=table.keys(exporters) else - reporters.lines(t,result) + method={ method } + end + filename=type(filename)=="string" and filename~="" and filename or false + for i=1,#method do + local m=method[i] + local result=exporters[m](t,m) + if result and result~="" then + if filename then + local fullname=file.replacesuffix(filename,m) + t.report("saving export in %a",fullname) + io.savedata(fullname,result) + else + reporters.lines(t,result) + end + end end end @@ -15513,8 +15538,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 : 640903 --- stripped bytes : 231417 +-- original bytes : 641580 +-- stripped bytes : 231548 -- end library merge |