diff options
28 files changed, 4254 insertions, 452 deletions
diff --git a/context/data/scite/scite-context.properties b/context/data/scite/scite-context.properties index 995c1299c..571396b58 100644 --- a/context/data/scite/scite-context.properties +++ b/context/data/scite/scite-context.properties @@ -63,7 +63,7 @@ open.suffix.$(file.patterns.context)=.tex # Example : patterns file.patterns.xml= -file.patterns.example=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd;*.lmx;*.htm;*.html;*.ctx;*.export; +file.patterns.example=*.xml;*.xsl;*.xsd;*.fo;*.exa;*.rlb;*.rlg;*.rlv;*.rng;*.xfdf;*.xslt;*.dtd;*.lmx;*.htm;*.html;*.xhtml*.ctx;*.export; open.suffix.$(file.patterns.example)=.xml filter.example=eXaMpLe|$(file.patterns.example)| #~ lexer.$(file.patterns.example)=xml diff --git a/doc/context/scripts/context.html b/doc/context/scripts/context.html new file mode 100644 index 000000000..4edd372de --- /dev/null +++ b/doc/context/scripts/context.html @@ -0,0 +1,552 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt Process Management 0.60</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { + color: #FFFFFF ; + background-color: #808080 ; + font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans ; + font-size: 12px ; + line-height: 18px ; +} +a:link, a:active, a:visited { + color: #FFFFFF ; +} +a.dir-view:link, a.dir-view:active, a.dir-view:visited { + color: #FFFFFF ; + text-decoration: underline ; +} +.valid { + color: #00FF00 ; +} +.invalid { + color: #FF0000 ; +} +button, .commonlink, .smallbutton { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; + border-color: #7F7F7F ; + border-style: solid ; + border-width: .125ex ; + background-color: #FFFFFF ; + padding: .5ex ; +} +.smallbutton { + width: 1em ; +} +a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; +} +h1, .title { + font-style: normal ; + font-weight: normal ; + font-size: 18px ; + line-height: 18px ; + margin-bottom: 20px ; +} +h2, .subtitle { + font-style: normal ; + font-weight: normal ; + font-size: 12px ; + margin-top: 18px ; + margin-bottom: 18px ; +} +table { + line-height: 18px ; + font-size: 12px ; + margin: 0 ; +} +th { + font-weight: bold ; + text-align: left ; + padding-bottom: 6px ; +} +.tc { + font-weight: bold ; + text-align: left ; +} +p, li { + max-width: 60em ; +} +.empty-line { + margin-top: 4px ; +} +.more-room { + margin-right: 1.5em ; +} +.much-more-room { + margin-right: 3em ; +} +#main { + position: absolute; + left: 10% ; + top: 10% ; + right: 10% ; + bottom: 10% ; + z-index: 2 ; + width: 80% ; + height: 80% ; + padding: 0% ; + margin: 0% ; + overflow: auto ; + border-style: none ; + border-width: 0 ; + background-color: #3F3F3F ; +} +#main-settings { + margin: 12px ; + x_max-width: 60em ; + line-height: 18px ; + font-size: 12px ; +} +#left { + position: absolute; + top : 10% ; + left: 0% ; + bottom: 0%; + right: 90% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; +} +#right { + position: absolute; + top : 0% ; + left: 90% ; + bottom: 10% ; + right: 0% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; + _margin-left: -15px ; +} +#bottom { + position: absolute ; + left: 10% ; + right: 0% ; + top: 90% ; + bottom: 0% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top { + position: absolute ; + left: 0% ; + right: 10% ; + top: 0% ; + bottom: 90% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#top-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: right ; + vertical-align: middle ; +} +#bottom-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#bottom-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: left ; + vertical-align: middle ; +} +#left-one { + position: absolute ; + width: 100% ; + buggedheight: 100% ; +} +#left-two { + position: relative ; + margin-top: 12px ; + line-height: 18px ; + text-align: center ; + vertical-align: top ; +} +#right-one { + display: table ; + height: 100% ; + width: 100% ; +} +#right-two { + display: table-row ; + height: 100% ; + width: 100% ; +} +#right-three { + display: table-cell ; + width: 100% ; + vertical-align: bottom ; + _position: absolute ; + _top: 100% ; +} +#right-four { + text-align: center ; + margin-bottom: 2ex ; + _position: relative ; + _top: -100% ; +} +#more-top { + position: absolute; + top: 0% ; + left: 90% ; + bottom: 90%; + right: 0% ; + z-index: 3 ; + width: 10% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + border-style: none ; + border-width: 0 ; +} +#more-top-settings { + text-align: center ; +} +#more-right-settings { + margin-right: 12px ; + margin-left: 12px ; + line-height: 18px ; + font-size: 10px ; + text-align: center ; +} +#right-safari { + _display: table ; + width: 100% ; + height: 100% ; +} + + </style> + </head> + <body> + <div id="top"> + <div id="top-one"> + <div id="top-two"> + ConTeXt Process Management 0.60 </div> + </div> + </div> + <div id="bottom"> + <div id="bottom-one"> + <div id="bottom-two"> + wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl </div> + </div> + </div> + <div id="left"> + <div id="left-one"> + <div id="left-two"> + </div> + </div> + </div> + <div id="right"> + <div id="right-safari"> + <div id="right-one"> + <div id="right-two"> + <div id="right-three"> + <div id="right-four"> + <div id="right-five"> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr> + <th style="width: 10em">flag</th> + <th style="width: 8em">value</th> + <th>description</th> + </tr> + <tr><th colspan="3">basic</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--run</th> + <td></td> + <td>process (one or more) files (default action)</td> + </tr> + <tr> + <th>--make</th> + <td></td> + <td>create context formats</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--ctx=name</th> + <td></td> + <td>use ctx file (process management specification)</td> + </tr> + <tr> + <th>--interface</th> + <td></td> + <td>use specified user interface (default: en)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--autopdf</th> + <td></td> + <td>close pdf file in viewer and start pdf viewer afterwards</td> + </tr> + <tr> + <th>--purge</th> + <td></td> + <td>purge files either or not after a run (--pattern=...)</td> + </tr> + <tr> + <th>--purgeall</th> + <td></td> + <td>purge all files either or not after a run (--pattern=...)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--usemodule</th> + <td>list</td> + <td>load the given module or style, normally part of the distribution</td> + </tr> + <tr> + <th>--environment</th> + <td>list</td> + <td>load the given environment file first (document styles)</td> + </tr> + <tr> + <th>--mode</th> + <td>list</td> + <td>enable given the modes (conditional processing in styles)</td> + </tr> + <tr> + <th>--path</th> + <td>list</td> + <td>also consult the given paths when files are looked for</td> + </tr> + <tr> + <th>--arguments</th> + <td>list</td> + <td>set variables that can be consulted during a run (key/value pairs)</td> + </tr> + <tr> + <th>--randomseed</th> + <td>number</td> + <td>set the randomseed</td> + </tr> + <tr> + <th>--result</th> + <td>name</td> + <td>rename the resulting output to the given name</td> + </tr> + <tr> + <th>--trackers</th> + <td>list</td> + <td>set tracker variables (show list with --showtrackers)</td> + </tr> + <tr> + <th>--directives</th> + <td>list</td> + <td>set directive variables (show list with --showdirectives)</td> + </tr> + <tr> + <th>--silent</th> + <td>list</td> + <td>disable logcatgories (show list with --showlogcategories)</td> + </tr> + <tr> + <th>--noconsole</th> + <td></td> + <td>disable logging to the console (logfile only)</td> + </tr> + <tr> + <th>--purgeresult</th> + <td></td> + <td>purge result file before run</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--forcexml</th> + <td></td> + <td>force xml stub</td> + </tr> + <tr> + <th>--forcecld</th> + <td></td> + <td>force cld (context lua document) stub</td> + </tr> + <tr> + <th>--forcelua</th> + <td></td> + <td>force lua stub (like texlua)</td> + </tr> + <tr> + <th>--forcemp</th> + <td></td> + <td>force mp stub</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--arrange</th> + <td></td> + <td>run extra imposition pass, given that the style sets up imposition</td> + </tr> + <tr> + <th>--noarrange</th> + <td></td> + <td>ignore imposition specifications in the style</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--jit</th> + <td></td> + <td>use luajittex with jit turned off (only use the faster virtual machine)</td> + </tr> + <tr> + <th>--jiton</th> + <td></td> + <td>use luajittex with jit turned on (in most cases not faster, even slower)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--once</th> + <td></td> + <td>only run once (no multipass data file is produced)</td> + </tr> + <tr> + <th>--batchmode</th> + <td></td> + <td>run without stopping and do not show messages on the console</td> + </tr> + <tr> + <th>--nonstopmode</th> + <td></td> + <td>run without stopping</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--generate</th> + <td></td> + <td>generate file database etc. (as luatools does)</td> + </tr> + <tr> + <th>--paranoid</th> + <td></td> + <td>do not descend to .. and ../..</td> + </tr> + <tr> + <th>--version</th> + <td></td> + <td>report installed context version</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--global</th> + <td></td> + <td>assume given file present elsewhere</td> + </tr> + <tr> + <th>--nofile</th> + <td></td> + <td>use dummy file as jobname</td> + </tr> + <tr><th colspan="3">expert</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--touch</th> + <td></td> + <td>update context version number (remake needed afterwards, also provide --expert)</td> + </tr> + <tr> + <th>--nostatistics</th> + <td></td> + <td>omit runtime statistics at the end of the run</td> + </tr> + <tr> + <th>--update</th> + <td></td> + <td>update context from website (not to be confused with contextgarden)</td> + </tr> + <tr> + <th>--profile</th> + <td></td> + <td>profile job (use: mtxrun --script profile --analyze)</td> + </tr> + <tr> + <th>--timing</th> + <td></td> + <td>generate timing and statistics overview</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--extra=name</th> + <td></td> + <td>process extra (mtx-context-... in distribution)</td> + </tr> + <tr> + <th>--extras</th> + <td></td> + <td>show extras</td> + </tr> + <tr><th colspan="3">special</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--pdftex</th> + <td></td> + <td>process file with texexec using pdftex</td> + </tr> + <tr> + <th>--xetex</th> + <td></td> + <td>process file with texexec using xetex</td> + </tr> + <tr> + <th>--mkii</th> + <td></td> + <td>process file with texexec</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--pipe</th> + <td></td> + <td>do not check for file and enter scroll mode (--dummyfile=whatever.tmp)</td> + </tr> + </table> +<br/> </div> + </div> + </body> + </html> diff --git a/doc/context/scripts/context.xml b/doc/context/scripts/context.xml new file mode 100644 index 000000000..9105056d8 --- /dev/null +++ b/doc/context/scripts/context.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtx-context</entry> + <entry name="detail">ConTeXt Process Management</entry> + <entry name="version">0.60</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 context formats</short> + </flag> + </subcategory> + <subcategory> + <flag name="ctx=name"> + <short>use ctx file (process management specification)</short> + </flag> + <flag name="interface"> + <short>use specified user interface (default: en)</short> + </flag> + </subcategory> + <subcategory> + <flag name="autopdf"> + <short>close pdf file in viewer and start pdf viewer afterwards</short> + </flag> + <flag name="purge"> + <short>purge files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + <flag name="purgeall"> + <short>purge all files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + </subcategory> + <subcategory> + <flag name="usemodule" value="list"> + <short>load the given module or style, normally part of the distribution</short> + </flag> + <flag name="environment" value="list"> + <short>load the given environment file first (document styles)</short> + </flag> + <flag name="mode" value="list"> + <short>enable given the modes (conditional processing in styles)</short> + </flag> + <flag name="path" value="list"> + <short>also consult the given paths when files are looked for</short> + </flag> + <flag name="arguments" value="list"> + <short>set variables that can be consulted during a run (key/value pairs)</short> + </flag> + <flag name="randomseed" value="number"> + <short>set the randomseed</short> + </flag> + <flag name="result" value="name"> + <short>rename the resulting output to the given name</short> + </flag> + <flag name="trackers" value="list"> + <short>set tracker variables (show list with <ref name="showtrackers"/>)</short> + </flag> + <flag name="directives" value="list"> + <short>set directive variables (show list with <ref name="showdirectives"/>)</short> + </flag> + <flag name="silent" value="list"> + <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> + </flag> + <flag name="noconsole"> + <short>disable logging to the console (logfile only)</short> + </flag> + <flag name="purgeresult"> + <short>purge result file before run</short> + </flag> + </subcategory> + <subcategory> + <flag name="forcexml"> + <short>force xml stub</short> + </flag> + <flag name="forcecld"> + <short>force cld (context lua document) stub</short> + </flag> + <flag name="forcelua"> + <short>force lua stub (like texlua)</short> + </flag> + <flag name="forcemp"> + <short>force mp stub</short> + </flag> + </subcategory> + <subcategory> + <flag name="arrange"> + <short>run extra imposition pass, given that the style sets up imposition</short> + </flag> + <flag name="noarrange"> + <short>ignore imposition specifications in the style</short> + </flag> + </subcategory> + <subcategory> + <flag name="jit"> + <short>use luajittex with jit turned off (only use the faster virtual machine)</short> + </flag> + <flag name="jiton"> + <short>use luajittex with jit turned on (in most cases not faster, even slower)</short> + </flag> + </subcategory> + <subcategory> + <flag name="once"> + <short>only run once (no multipass data file is produced)</short> + </flag> + <flag name="batchmode"> + <short>run without stopping and do not show messages on the console</short> + </flag> + <flag name="nonstopmode"> + <short>run without stopping</short> + </flag> + </subcategory> + <subcategory> + <flag name="generate"> + <short>generate file database etc. (as luatools does)</short> + </flag> + <flag name="paranoid"> + <short>do not descend to .. and ../..</short> + </flag> + <flag name="version"> + <short>report installed context version</short> + </flag> + </subcategory> + <subcategory> + <flag name="global"> + <short>assume given file present elsewhere</short> + </flag> + <flag name="nofile"> + <short>use dummy file as jobname</short> + </flag> + </subcategory> + </category> + <category name="expert"> + <subcategory> + <flag name="touch"> + <short>update context version number (remake needed afterwards, also provide <ref name="expert"/>)</short> + </flag> + <flag name="nostatistics"> + <short>omit runtime statistics at the end of the run</short> + </flag> + <flag name="update"> + <short>update context from website (not to be confused with contextgarden)</short> + </flag> + <flag name="profile"> + <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> + </flag> + <flag name="timing"> + <short>generate timing and statistics overview</short> + </flag> + </subcategory> + <subcategory> + <flag name="extra=name"> + <short>process extra (mtx-context-... in distribution)</short> + </flag> + <flag name="extras"> + <short>show extras</short> + </flag> + </subcategory> + </category> + <category name="special"> + <subcategory> + <flag name="pdftex"> + <short>process file with texexec using pdftex</short> + </flag> + <flag name="xetex"> + <short>process file with texexec using xetex</short> + </flag> + <flag name="mkii"> + <short>process file with texexec</short> + </flag> + </subcategory> + <subcategory> + <flag name="pipe"> + <short>do not check for file and enter scroll mode (<ref name="dummyfile"/>=whatever.tmp)</short> + </flag> + </subcategory> + </category> + </flags> +</application> diff --git a/doc/context/scripts/mtx-context.html b/doc/context/scripts/mtx-context.html new file mode 100644 index 000000000..4edd372de --- /dev/null +++ b/doc/context/scripts/mtx-context.html @@ -0,0 +1,552 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt Process Management 0.60</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { + color: #FFFFFF ; + background-color: #808080 ; + font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans ; + font-size: 12px ; + line-height: 18px ; +} +a:link, a:active, a:visited { + color: #FFFFFF ; +} +a.dir-view:link, a.dir-view:active, a.dir-view:visited { + color: #FFFFFF ; + text-decoration: underline ; +} +.valid { + color: #00FF00 ; +} +.invalid { + color: #FF0000 ; +} +button, .commonlink, .smallbutton { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; + border-color: #7F7F7F ; + border-style: solid ; + border-width: .125ex ; + background-color: #FFFFFF ; + padding: .5ex ; +} +.smallbutton { + width: 1em ; +} +a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; +} +h1, .title { + font-style: normal ; + font-weight: normal ; + font-size: 18px ; + line-height: 18px ; + margin-bottom: 20px ; +} +h2, .subtitle { + font-style: normal ; + font-weight: normal ; + font-size: 12px ; + margin-top: 18px ; + margin-bottom: 18px ; +} +table { + line-height: 18px ; + font-size: 12px ; + margin: 0 ; +} +th { + font-weight: bold ; + text-align: left ; + padding-bottom: 6px ; +} +.tc { + font-weight: bold ; + text-align: left ; +} +p, li { + max-width: 60em ; +} +.empty-line { + margin-top: 4px ; +} +.more-room { + margin-right: 1.5em ; +} +.much-more-room { + margin-right: 3em ; +} +#main { + position: absolute; + left: 10% ; + top: 10% ; + right: 10% ; + bottom: 10% ; + z-index: 2 ; + width: 80% ; + height: 80% ; + padding: 0% ; + margin: 0% ; + overflow: auto ; + border-style: none ; + border-width: 0 ; + background-color: #3F3F3F ; +} +#main-settings { + margin: 12px ; + x_max-width: 60em ; + line-height: 18px ; + font-size: 12px ; +} +#left { + position: absolute; + top : 10% ; + left: 0% ; + bottom: 0%; + right: 90% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; +} +#right { + position: absolute; + top : 0% ; + left: 90% ; + bottom: 10% ; + right: 0% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; + _margin-left: -15px ; +} +#bottom { + position: absolute ; + left: 10% ; + right: 0% ; + top: 90% ; + bottom: 0% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top { + position: absolute ; + left: 0% ; + right: 10% ; + top: 0% ; + bottom: 90% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#top-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: right ; + vertical-align: middle ; +} +#bottom-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#bottom-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: left ; + vertical-align: middle ; +} +#left-one { + position: absolute ; + width: 100% ; + buggedheight: 100% ; +} +#left-two { + position: relative ; + margin-top: 12px ; + line-height: 18px ; + text-align: center ; + vertical-align: top ; +} +#right-one { + display: table ; + height: 100% ; + width: 100% ; +} +#right-two { + display: table-row ; + height: 100% ; + width: 100% ; +} +#right-three { + display: table-cell ; + width: 100% ; + vertical-align: bottom ; + _position: absolute ; + _top: 100% ; +} +#right-four { + text-align: center ; + margin-bottom: 2ex ; + _position: relative ; + _top: -100% ; +} +#more-top { + position: absolute; + top: 0% ; + left: 90% ; + bottom: 90%; + right: 0% ; + z-index: 3 ; + width: 10% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + border-style: none ; + border-width: 0 ; +} +#more-top-settings { + text-align: center ; +} +#more-right-settings { + margin-right: 12px ; + margin-left: 12px ; + line-height: 18px ; + font-size: 10px ; + text-align: center ; +} +#right-safari { + _display: table ; + width: 100% ; + height: 100% ; +} + + </style> + </head> + <body> + <div id="top"> + <div id="top-one"> + <div id="top-two"> + ConTeXt Process Management 0.60 </div> + </div> + </div> + <div id="bottom"> + <div id="bottom-one"> + <div id="bottom-two"> + wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl </div> + </div> + </div> + <div id="left"> + <div id="left-one"> + <div id="left-two"> + </div> + </div> + </div> + <div id="right"> + <div id="right-safari"> + <div id="right-one"> + <div id="right-two"> + <div id="right-three"> + <div id="right-four"> + <div id="right-five"> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr> + <th style="width: 10em">flag</th> + <th style="width: 8em">value</th> + <th>description</th> + </tr> + <tr><th colspan="3">basic</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--run</th> + <td></td> + <td>process (one or more) files (default action)</td> + </tr> + <tr> + <th>--make</th> + <td></td> + <td>create context formats</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--ctx=name</th> + <td></td> + <td>use ctx file (process management specification)</td> + </tr> + <tr> + <th>--interface</th> + <td></td> + <td>use specified user interface (default: en)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--autopdf</th> + <td></td> + <td>close pdf file in viewer and start pdf viewer afterwards</td> + </tr> + <tr> + <th>--purge</th> + <td></td> + <td>purge files either or not after a run (--pattern=...)</td> + </tr> + <tr> + <th>--purgeall</th> + <td></td> + <td>purge all files either or not after a run (--pattern=...)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--usemodule</th> + <td>list</td> + <td>load the given module or style, normally part of the distribution</td> + </tr> + <tr> + <th>--environment</th> + <td>list</td> + <td>load the given environment file first (document styles)</td> + </tr> + <tr> + <th>--mode</th> + <td>list</td> + <td>enable given the modes (conditional processing in styles)</td> + </tr> + <tr> + <th>--path</th> + <td>list</td> + <td>also consult the given paths when files are looked for</td> + </tr> + <tr> + <th>--arguments</th> + <td>list</td> + <td>set variables that can be consulted during a run (key/value pairs)</td> + </tr> + <tr> + <th>--randomseed</th> + <td>number</td> + <td>set the randomseed</td> + </tr> + <tr> + <th>--result</th> + <td>name</td> + <td>rename the resulting output to the given name</td> + </tr> + <tr> + <th>--trackers</th> + <td>list</td> + <td>set tracker variables (show list with --showtrackers)</td> + </tr> + <tr> + <th>--directives</th> + <td>list</td> + <td>set directive variables (show list with --showdirectives)</td> + </tr> + <tr> + <th>--silent</th> + <td>list</td> + <td>disable logcatgories (show list with --showlogcategories)</td> + </tr> + <tr> + <th>--noconsole</th> + <td></td> + <td>disable logging to the console (logfile only)</td> + </tr> + <tr> + <th>--purgeresult</th> + <td></td> + <td>purge result file before run</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--forcexml</th> + <td></td> + <td>force xml stub</td> + </tr> + <tr> + <th>--forcecld</th> + <td></td> + <td>force cld (context lua document) stub</td> + </tr> + <tr> + <th>--forcelua</th> + <td></td> + <td>force lua stub (like texlua)</td> + </tr> + <tr> + <th>--forcemp</th> + <td></td> + <td>force mp stub</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--arrange</th> + <td></td> + <td>run extra imposition pass, given that the style sets up imposition</td> + </tr> + <tr> + <th>--noarrange</th> + <td></td> + <td>ignore imposition specifications in the style</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--jit</th> + <td></td> + <td>use luajittex with jit turned off (only use the faster virtual machine)</td> + </tr> + <tr> + <th>--jiton</th> + <td></td> + <td>use luajittex with jit turned on (in most cases not faster, even slower)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--once</th> + <td></td> + <td>only run once (no multipass data file is produced)</td> + </tr> + <tr> + <th>--batchmode</th> + <td></td> + <td>run without stopping and do not show messages on the console</td> + </tr> + <tr> + <th>--nonstopmode</th> + <td></td> + <td>run without stopping</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--generate</th> + <td></td> + <td>generate file database etc. (as luatools does)</td> + </tr> + <tr> + <th>--paranoid</th> + <td></td> + <td>do not descend to .. and ../..</td> + </tr> + <tr> + <th>--version</th> + <td></td> + <td>report installed context version</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--global</th> + <td></td> + <td>assume given file present elsewhere</td> + </tr> + <tr> + <th>--nofile</th> + <td></td> + <td>use dummy file as jobname</td> + </tr> + <tr><th colspan="3">expert</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--touch</th> + <td></td> + <td>update context version number (remake needed afterwards, also provide --expert)</td> + </tr> + <tr> + <th>--nostatistics</th> + <td></td> + <td>omit runtime statistics at the end of the run</td> + </tr> + <tr> + <th>--update</th> + <td></td> + <td>update context from website (not to be confused with contextgarden)</td> + </tr> + <tr> + <th>--profile</th> + <td></td> + <td>profile job (use: mtxrun --script profile --analyze)</td> + </tr> + <tr> + <th>--timing</th> + <td></td> + <td>generate timing and statistics overview</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--extra=name</th> + <td></td> + <td>process extra (mtx-context-... in distribution)</td> + </tr> + <tr> + <th>--extras</th> + <td></td> + <td>show extras</td> + </tr> + <tr><th colspan="3">special</td></tr><tr><th/><td/><td/></tr> <tr> + <th>--pdftex</th> + <td></td> + <td>process file with texexec using pdftex</td> + </tr> + <tr> + <th>--xetex</th> + <td></td> + <td>process file with texexec using xetex</td> + </tr> + <tr> + <th>--mkii</th> + <td></td> + <td>process file with texexec</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--pipe</th> + <td></td> + <td>do not check for file and enter scroll mode (--dummyfile=whatever.tmp)</td> + </tr> + </table> +<br/> </div> + </div> + </body> + </html> diff --git a/doc/context/scripts/mtx-context.man b/doc/context/scripts/mtx-context.man new file mode 100644 index 000000000..439f7bb9f --- /dev/null +++ b/doc/context/scripts/mtx-context.man @@ -0,0 +1,154 @@ +.TH ConTeXt Process Management 0.60 +.SH "NAME" +mtx-context.SH "SYNOPSIS" +\fBmtx-context\fP [ \fIOPTIONS\fP ... ] +.SH "DESCRIPTION" +ConTeXt Process Management + +.SH "OPTIONS: BASIC" +.TP +.B --run +process (one or more) files (default action) +.TP +.B --make +create context formats +.TP +.B --ctx=name +use ctx file (process management specification) +.TP +.B --interface +use specified user interface (default: en) +.TP +.B --autopdf +close pdf file in viewer and start pdf viewer afterwards +.TP +.B --purge +purge files either or not after a run (--pattern=...) +.TP +.B --purgeall +purge all files either or not after a run (--pattern=...) +.TP +.B --usemodule=list +load the given module or style, normally part of the distribution +.TP +.B --environment=list +load the given environment file first (document styles) +.TP +.B --mode=list +enable given the modes (conditional processing in styles) +.TP +.B --path=list +also consult the given paths when files are looked for +.TP +.B --arguments=list +set variables that can be consulted during a run (key/value pairs) +.TP +.B --randomseed=number +set the randomseed +.TP +.B --result=name +rename the resulting output to the given name +.TP +.B --trackers=list +set tracker variables (show list with --showtrackers) +.TP +.B --directives=list +set directive variables (show list with --showdirectives) +.TP +.B --silent=list +disable logcatgories (show list with --showlogcategories) +.TP +.B --noconsole +disable logging to the console (logfile only) +.TP +.B --purgeresult +purge result file before run +.TP +.B --forcexml +force xml stub +.TP +.B --forcecld +force cld (context lua document) stub +.TP +.B --forcelua +force lua stub (like texlua) +.TP +.B --forcemp +force mp stub +.TP +.B --arrange +run extra imposition pass, given that the style sets up imposition +.TP +.B --noarrange +ignore imposition specifications in the style +.TP +.B --jit +use luajittex with jit turned off (only use the faster virtual machine) +.TP +.B --jiton +use luajittex with jit turned on (in most cases not faster, even slower) +.TP +.B --once +only run once (no multipass data file is produced) +.TP +.B --batchmode +run without stopping and do not show messages on the console +.TP +.B --nonstopmode +run without stopping +.TP +.B --generate +generate file database etc. (as luatools does) +.TP +.B --paranoid +do not descend to .. and ../.. +.TP +.B --version +report installed context version +.TP +.B --global +assume given file present elsewhere +.TP +.B --nofile +use dummy file as jobname +.SH "OPTIONS: EXPERT" +.TP +.B --touch +update context version number (remake needed afterwards, also provide --expert) +.TP +.B --nostatistics +omit runtime statistics at the end of the run +.TP +.B --update +update context from website (not to be confused with contextgarden) +.TP +.B --profile +profile job (use: mtxrun --script profile --analyze) +.TP +.B --timing +generate timing and statistics overview +.TP +.B --extra=name +process extra (mtx-context-... in distribution) +.TP +.B --extras +show extras +.SH "OPTIONS: SPECIAL" +.TP +.B --pdftex +process file with texexec using pdftex +.TP +.B --xetex +process file with texexec using xetex +.TP +.B --mkii +process file with texexec +.TP +.B --pipe +do not check for file and enter scroll mode (--dummyfile=whatever.tmp) +.SH "AUTHOR" +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net diff --git a/doc/context/scripts/mtx-context.xml b/doc/context/scripts/mtx-context.xml new file mode 100644 index 000000000..9105056d8 --- /dev/null +++ b/doc/context/scripts/mtx-context.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtx-context</entry> + <entry name="detail">ConTeXt Process Management</entry> + <entry name="version">0.60</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 context formats</short> + </flag> + </subcategory> + <subcategory> + <flag name="ctx=name"> + <short>use ctx file (process management specification)</short> + </flag> + <flag name="interface"> + <short>use specified user interface (default: en)</short> + </flag> + </subcategory> + <subcategory> + <flag name="autopdf"> + <short>close pdf file in viewer and start pdf viewer afterwards</short> + </flag> + <flag name="purge"> + <short>purge files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + <flag name="purgeall"> + <short>purge all files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + </subcategory> + <subcategory> + <flag name="usemodule" value="list"> + <short>load the given module or style, normally part of the distribution</short> + </flag> + <flag name="environment" value="list"> + <short>load the given environment file first (document styles)</short> + </flag> + <flag name="mode" value="list"> + <short>enable given the modes (conditional processing in styles)</short> + </flag> + <flag name="path" value="list"> + <short>also consult the given paths when files are looked for</short> + </flag> + <flag name="arguments" value="list"> + <short>set variables that can be consulted during a run (key/value pairs)</short> + </flag> + <flag name="randomseed" value="number"> + <short>set the randomseed</short> + </flag> + <flag name="result" value="name"> + <short>rename the resulting output to the given name</short> + </flag> + <flag name="trackers" value="list"> + <short>set tracker variables (show list with <ref name="showtrackers"/>)</short> + </flag> + <flag name="directives" value="list"> + <short>set directive variables (show list with <ref name="showdirectives"/>)</short> + </flag> + <flag name="silent" value="list"> + <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> + </flag> + <flag name="noconsole"> + <short>disable logging to the console (logfile only)</short> + </flag> + <flag name="purgeresult"> + <short>purge result file before run</short> + </flag> + </subcategory> + <subcategory> + <flag name="forcexml"> + <short>force xml stub</short> + </flag> + <flag name="forcecld"> + <short>force cld (context lua document) stub</short> + </flag> + <flag name="forcelua"> + <short>force lua stub (like texlua)</short> + </flag> + <flag name="forcemp"> + <short>force mp stub</short> + </flag> + </subcategory> + <subcategory> + <flag name="arrange"> + <short>run extra imposition pass, given that the style sets up imposition</short> + </flag> + <flag name="noarrange"> + <short>ignore imposition specifications in the style</short> + </flag> + </subcategory> + <subcategory> + <flag name="jit"> + <short>use luajittex with jit turned off (only use the faster virtual machine)</short> + </flag> + <flag name="jiton"> + <short>use luajittex with jit turned on (in most cases not faster, even slower)</short> + </flag> + </subcategory> + <subcategory> + <flag name="once"> + <short>only run once (no multipass data file is produced)</short> + </flag> + <flag name="batchmode"> + <short>run without stopping and do not show messages on the console</short> + </flag> + <flag name="nonstopmode"> + <short>run without stopping</short> + </flag> + </subcategory> + <subcategory> + <flag name="generate"> + <short>generate file database etc. (as luatools does)</short> + </flag> + <flag name="paranoid"> + <short>do not descend to .. and ../..</short> + </flag> + <flag name="version"> + <short>report installed context version</short> + </flag> + </subcategory> + <subcategory> + <flag name="global"> + <short>assume given file present elsewhere</short> + </flag> + <flag name="nofile"> + <short>use dummy file as jobname</short> + </flag> + </subcategory> + </category> + <category name="expert"> + <subcategory> + <flag name="touch"> + <short>update context version number (remake needed afterwards, also provide <ref name="expert"/>)</short> + </flag> + <flag name="nostatistics"> + <short>omit runtime statistics at the end of the run</short> + </flag> + <flag name="update"> + <short>update context from website (not to be confused with contextgarden)</short> + </flag> + <flag name="profile"> + <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> + </flag> + <flag name="timing"> + <short>generate timing and statistics overview</short> + </flag> + </subcategory> + <subcategory> + <flag name="extra=name"> + <short>process extra (mtx-context-... in distribution)</short> + </flag> + <flag name="extras"> + <short>show extras</short> + </flag> + </subcategory> + </category> + <category name="special"> + <subcategory> + <flag name="pdftex"> + <short>process file with texexec using pdftex</short> + </flag> + <flag name="xetex"> + <short>process file with texexec using xetex</short> + </flag> + <flag name="mkii"> + <short>process file with texexec</short> + </flag> + </subcategory> + <subcategory> + <flag name="pipe"> + <short>do not check for file and enter scroll mode (<ref name="dummyfile"/>=whatever.tmp)</short> + </flag> + </subcategory> + </category> + </flags> +</application> diff --git a/doc/context/scripts/mtx-fonts.html b/doc/context/scripts/mtx-fonts.html new file mode 100644 index 000000000..b5372178c --- /dev/null +++ b/doc/context/scripts/mtx-fonts.html @@ -0,0 +1,387 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt Font Database Management 0.21</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { + color: #FFFFFF ; + background-color: #808080 ; + font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans ; + font-size: 12px ; + line-height: 18px ; +} +a:link, a:active, a:visited { + color: #FFFFFF ; +} +a.dir-view:link, a.dir-view:active, a.dir-view:visited { + color: #FFFFFF ; + text-decoration: underline ; +} +.valid { + color: #00FF00 ; +} +.invalid { + color: #FF0000 ; +} +button, .commonlink, .smallbutton { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; + border-color: #7F7F7F ; + border-style: solid ; + border-width: .125ex ; + background-color: #FFFFFF ; + padding: .5ex ; +} +.smallbutton { + width: 1em ; +} +a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; +} +h1, .title { + font-style: normal ; + font-weight: normal ; + font-size: 18px ; + line-height: 18px ; + margin-bottom: 20px ; +} +h2, .subtitle { + font-style: normal ; + font-weight: normal ; + font-size: 12px ; + margin-top: 18px ; + margin-bottom: 18px ; +} +table { + line-height: 18px ; + font-size: 12px ; + margin: 0 ; +} +th { + font-weight: bold ; + text-align: left ; + padding-bottom: 6px ; +} +.tc { + font-weight: bold ; + text-align: left ; +} +p, li { + max-width: 60em ; +} +.empty-line { + margin-top: 4px ; +} +.more-room { + margin-right: 1.5em ; +} +.much-more-room { + margin-right: 3em ; +} +#main { + position: absolute; + left: 10% ; + top: 10% ; + right: 10% ; + bottom: 10% ; + z-index: 2 ; + width: 80% ; + height: 80% ; + padding: 0% ; + margin: 0% ; + overflow: auto ; + border-style: none ; + border-width: 0 ; + background-color: #3F3F3F ; +} +#main-settings { + margin: 12px ; + x_max-width: 60em ; + line-height: 18px ; + font-size: 12px ; +} +#left { + position: absolute; + top : 10% ; + left: 0% ; + bottom: 0%; + right: 90% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; +} +#right { + position: absolute; + top : 0% ; + left: 90% ; + bottom: 10% ; + right: 0% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; + _margin-left: -15px ; +} +#bottom { + position: absolute ; + left: 10% ; + right: 0% ; + top: 90% ; + bottom: 0% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top { + position: absolute ; + left: 0% ; + right: 10% ; + top: 0% ; + bottom: 90% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#top-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: right ; + vertical-align: middle ; +} +#bottom-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#bottom-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: left ; + vertical-align: middle ; +} +#left-one { + position: absolute ; + width: 100% ; + buggedheight: 100% ; +} +#left-two { + position: relative ; + margin-top: 12px ; + line-height: 18px ; + text-align: center ; + vertical-align: top ; +} +#right-one { + display: table ; + height: 100% ; + width: 100% ; +} +#right-two { + display: table-row ; + height: 100% ; + width: 100% ; +} +#right-three { + display: table-cell ; + width: 100% ; + vertical-align: bottom ; + _position: absolute ; + _top: 100% ; +} +#right-four { + text-align: center ; + margin-bottom: 2ex ; + _position: relative ; + _top: -100% ; +} +#more-top { + position: absolute; + top: 0% ; + left: 90% ; + bottom: 90%; + right: 0% ; + z-index: 3 ; + width: 10% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + border-style: none ; + border-width: 0 ; +} +#more-top-settings { + text-align: center ; +} +#more-right-settings { + margin-right: 12px ; + margin-left: 12px ; + line-height: 18px ; + font-size: 10px ; + text-align: center ; +} +#right-safari { + _display: table ; + width: 100% ; + height: 100% ; +} + + </style> + </head> + <body> + <div id="top"> + <div id="top-one"> + <div id="top-two"> + ConTeXt Font Database Management 0.21 </div> + </div> + </div> + <div id="bottom"> + <div id="bottom-one"> + <div id="bottom-two"> + wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl </div> + </div> + </div> + <div id="left"> + <div id="left-one"> + <div id="left-two"> + </div> + </div> + </div> + <div id="right"> + <div id="right-safari"> + <div id="right-one"> + <div id="right-two"> + <div id="right-three"> + <div id="right-four"> + <div id="right-five"> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr> + <th style="width: 10em">flag</th> + <th style="width: 8em">value</th> + <th>description</th> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--save</th> + <td></td> + <td>save open type font in raw table</td> + </tr> + <tr> + <th>--unpack</th> + <td></td> + <td>save a tma file in a more readale format</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--reload</th> + <td></td> + <td>generate new font database (use --force when in doubt)</td> + </tr> + <tr> + <th>--reload</th> + <td></td> + <td>--simple:generate luatex-fonts-names.lua (not for context!)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--list</th> + <td></td> + <td>--name: list installed fonts, filter by name [--pattern]</td> + </tr> + <tr> + <th>--list</th> + <td></td> + <td>--spec: list installed fonts, filter by spec [--filter]</td> + </tr> + <tr> + <th>--list</th> + <td></td> + <td>--file: list installed fonts, filter by file [--pattern]</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--pattern</th> + <td>str</td> + <td>filter files using pattern</td> + </tr> + <tr> + <th>--filter</th> + <td>list</td> + <td>key-value pairs</td> + </tr> + <tr> + <th>--all</th> + <td></td> + <td>show all found instances (combined with other flags)</td> + </tr> + <tr> + <th>--info</th> + <td></td> + <td>give more details</td> + </tr> + <tr> + <th>--track</th> + <td>list</td> + <td>enable trackers</td> + </tr> + <tr> + <th>--statistics</th> + <td></td> + <td>some info about the database</td> + </tr> + </table> +<br/><h1>Examples of searches</h1><tt>mtxrun --script font --list somename (== --pattern=*somename*)</tt><br/><br/><tt>mtxrun --script font --list --name somename</tt><br/><tt>mtxrun --script font --list --name --pattern=*somename*</tt><br/><br/><tt>mtxrun --script font --list --spec somename</tt><br/><tt>mtxrun --script font --list --spec somename-bold-italic</tt><br/><tt>mtxrun --script font --list --spec --pattern=*somename*</tt><br/><tt>mtxrun --script font --list --spec --filter="fontname=somename"</tt><br/><tt>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</tt><br/><tt>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</tt><br/><br/><tt>mtxrun --script font --list --all</tt><br/><tt>mtxrun --script font --list --file somename</tt><br/><tt>mtxrun --script font --list --file --all somename</tt><br/><tt>mtxrun --script font --list --file --pattern=*somename*</tt><br/><br/> </div> + </div> + </body> + </html> diff --git a/doc/context/scripts/mtx-fonts.man b/doc/context/scripts/mtx-fonts.man new file mode 100644 index 000000000..46dc2cc8e --- /dev/null +++ b/doc/context/scripts/mtx-fonts.man @@ -0,0 +1,53 @@ +.TH ConTeXt Font Database Management 0.21 +.SH "NAME" +mtx-fonts.SH "SYNOPSIS" +\fBmtx-fonts\fP [ \fIOPTIONS\fP ... ] +.SH "DESCRIPTION" +ConTeXt Font Database Management + +.SH "OPTIONS" +.TP +.B --save +save open type font in raw table +.TP +.B --unpack +save a tma file in a more readale format +.TP +.B --reload +generate new font database (use --force when in doubt) +.TP +.B --reload +--simple:generate luatex-fonts-names.lua (not for context!) +.TP +.B --list +--name: list installed fonts, filter by name [--pattern] +.TP +.B --list +--spec: list installed fonts, filter by spec [--filter] +.TP +.B --list +--file: list installed fonts, filter by file [--pattern] +.TP +.B --pattern=str +filter files using pattern +.TP +.B --filter=list +key-value pairs +.TP +.B --all +show all found instances (combined with other flags) +.TP +.B --info +give more details +.TP +.B --track=list +enable trackers +.TP +.B --statistics +some info about the database +.SH "AUTHOR" +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net diff --git a/doc/context/scripts/mtx-fonts.xml b/doc/context/scripts/mtx-fonts.xml new file mode 100644 index 000000000..4cd799ac3 --- /dev/null +++ b/doc/context/scripts/mtx-fonts.xml @@ -0,0 +1,59 @@ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-fonts</entry> + <entry name="detail">ConTeXt Font Database Management</entry> + <entry name="version">0.21</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="save"><short>save open type font in raw table</short></flag> + <flag name="unpack"><short>save a tma file in a more readale format</short></flag> + </subcategory> + <subcategory> + <flag name="reload"><short>generate new font database (use <ref name="force"/> when in doubt)</short></flag> + <flag name="reload"><short><ref name="simple"/>:generate luatex-fonts-names.lua (not for context!)</short></flag> + </subcategory> + <subcategory> + <flag name="list"><short><ref name="name"/>: list installed fonts, filter by name [<ref name="pattern"/>]</short></flag> + <flag name="list"><short><ref name="spec"/>: list installed fonts, filter by spec [<ref name="filter"/>]</short></flag> + <flag name="list"><short><ref name="file"/>: list installed fonts, filter by file [<ref name="pattern"/>]</short></flag> + </subcategory> + <subcategory> + <flag name="pattern" value="str"><short>filter files using pattern</short></flag> + <flag name="filter" value="list"><short>key-value pairs</short></flag> + <flag name="all"><short>show all found instances (combined with other flags)</short></flag> + <flag name="info"><short>give more details</short></flag> + <flag name="track" value="list"><short>enable trackers</short></flag> + <flag name="statistics"><short>some info about the database</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples of searches</title> + <subcategory> + <example><command>mtxrun --script font --list somename (== --pattern=*somename*)</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --name somename</command></example> + <example><command>mtxrun --script font --list --name --pattern=*somename*</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --spec somename</command></example> + <example><command>mtxrun --script font --list --spec somename-bold-italic</command></example> + <example><command>mtxrun --script font --list --spec --pattern=*somename*</command></example> + <example><command>mtxrun --script font --list --spec --filter="fontname=somename"</command></example> + <example><command>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</command></example> + <example><command>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --all</command></example> + <example><command>mtxrun --script font --list --file somename</command></example> + <example><command>mtxrun --script font --list --file --all somename</command></example> + <example><command>mtxrun --script font --list --file --pattern=*somename*</command></example> + </subcategory> + </category> + </examples> +</application> diff --git a/doc/context/scripts/mtxrun.html b/doc/context/scripts/mtxrun.html new file mode 100644 index 000000000..ffae8cec7 --- /dev/null +++ b/doc/context/scripts/mtxrun.html @@ -0,0 +1,527 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + + + +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> + <head> + <title>ConTeXt TDS Runner Tool 1.31</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <style type="text/css"> + body { + color: #FFFFFF ; + background-color: #808080 ; + font-family: optima, verdana, futura, "lucida sans", arial, geneva, helvetica, sans ; + font-size: 12px ; + line-height: 18px ; +} +a:link, a:active, a:visited { + color: #FFFFFF ; +} +a.dir-view:link, a.dir-view:active, a.dir-view:visited { + color: #FFFFFF ; + text-decoration: underline ; +} +.valid { + color: #00FF00 ; +} +.invalid { + color: #FF0000 ; +} +button, .commonlink, .smallbutton { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; + border-color: #7F7F7F ; + border-style: solid ; + border-width: .125ex ; + background-color: #FFFFFF ; + padding: .5ex ; +} +.smallbutton { + width: 1em ; +} +a.commonlink:link, a.commonlink:active, a.commonlink:visited, a.smalllink:link, a.smalllink:active, a.smalllink:visited { + font-weight: bold ; + font-size: 12px ; + text-decoration: none ; + color: #000000 ; +} +h1, .title { + font-style: normal ; + font-weight: normal ; + font-size: 18px ; + line-height: 18px ; + margin-bottom: 20px ; +} +h2, .subtitle { + font-style: normal ; + font-weight: normal ; + font-size: 12px ; + margin-top: 18px ; + margin-bottom: 18px ; +} +table { + line-height: 18px ; + font-size: 12px ; + margin: 0 ; +} +th { + font-weight: bold ; + text-align: left ; + padding-bottom: 6px ; +} +.tc { + font-weight: bold ; + text-align: left ; +} +p, li { + max-width: 60em ; +} +.empty-line { + margin-top: 4px ; +} +.more-room { + margin-right: 1.5em ; +} +.much-more-room { + margin-right: 3em ; +} +#main { + position: absolute; + left: 10% ; + top: 10% ; + right: 10% ; + bottom: 10% ; + z-index: 2 ; + width: 80% ; + height: 80% ; + padding: 0% ; + margin: 0% ; + overflow: auto ; + border-style: none ; + border-width: 0 ; + background-color: #3F3F3F ; +} +#main-settings { + margin: 12px ; + x_max-width: 60em ; + line-height: 18px ; + font-size: 12px ; +} +#left { + position: absolute; + top : 10% ; + left: 0% ; + bottom: 0%; + right: 90% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; +} +#right { + position: absolute; + top : 0% ; + left: 90% ; + bottom: 10% ; + right: 0% ; + z-index: 1 ; + width: 10% ; + height: 90% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #4F6F6F ; + _margin-left: -15px ; +} +#bottom { + position: absolute ; + left: 10% ; + right: 0% ; + top: 90% ; + bottom: 0% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top { + position: absolute ; + left: 0% ; + right: 10% ; + top: 0% ; + bottom: 90% ; + z-index: 1 ; + width: 90% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + font-size: 16px ; + border-style: none ; + border-width: 0 ; + background-color: #6F6F8F ; +} +#top-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#top-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: right ; + vertical-align: middle ; +} +#bottom-one { + position: absolute ; + bottom: 50% ; + width: 100% ; + buggedheight: 100% ; +} +#bottom-two { + position: relative ; + margin-bottom: -9px ; + margin-left: 12px ; + margin-right: 12px ; + line-height: 18px ; + text-align: left ; + vertical-align: middle ; +} +#left-one { + position: absolute ; + width: 100% ; + buggedheight: 100% ; +} +#left-two { + position: relative ; + margin-top: 12px ; + line-height: 18px ; + text-align: center ; + vertical-align: top ; +} +#right-one { + display: table ; + height: 100% ; + width: 100% ; +} +#right-two { + display: table-row ; + height: 100% ; + width: 100% ; +} +#right-three { + display: table-cell ; + width: 100% ; + vertical-align: bottom ; + _position: absolute ; + _top: 100% ; +} +#right-four { + text-align: center ; + margin-bottom: 2ex ; + _position: relative ; + _top: -100% ; +} +#more-top { + position: absolute; + top: 0% ; + left: 90% ; + bottom: 90%; + right: 0% ; + z-index: 3 ; + width: 10% ; + height: 10% ; + padding: 0% ; + margin: 0% ; + border-style: none ; + border-width: 0 ; +} +#more-top-settings { + text-align: center ; +} +#more-right-settings { + margin-right: 12px ; + margin-left: 12px ; + line-height: 18px ; + font-size: 10px ; + text-align: center ; +} +#right-safari { + _display: table ; + width: 100% ; + height: 100% ; +} + + </style> + </head> + <body> + <div id="top"> + <div id="top-one"> + <div id="top-two"> + ConTeXt TDS Runner Tool 1.31 </div> + </div> + </div> + <div id="bottom"> + <div id="bottom-one"> + <div id="bottom-two"> + wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl </div> + </div> + </div> + <div id="left"> + <div id="left-one"> + <div id="left-two"> + </div> + </div> + </div> + <div id="right"> + <div id="right-safari"> + <div id="right-one"> + <div id="right-two"> + <div id="right-three"> + <div id="right-four"> + <div id="right-five"> + </div> + </div> + </div> + </div> + </div> + </div> + </div> + <div id="main"> + <div id='main-settings'> + <h1>Command line options</h1> +<table> + <tr> + <th style="width: 10em">flag</th> + <th style="width: 8em">value</th> + <th>description</th> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--script</th> + <td></td> + <td>run an mtx script (lua prefered method) (--noquotes), no script gives list</td> + </tr> + <tr> + <th>--execute</th> + <td></td> + <td>run a script or program (texmfstart method) (--noquotes)</td> + </tr> + <tr> + <th>--resolve</th> + <td></td> + <td>resolve prefixed arguments</td> + </tr> + <tr> + <th>--ctxlua</th> + <td></td> + <td>run internally (using preloaded libs)</td> + </tr> + <tr> + <th>--internal</th> + <td></td> + <td>run script using built in libraries (same as --ctxlua)</td> + </tr> + <tr> + <th>--locate</th> + <td></td> + <td>locate given filename in database (default) or system (--first --all --detail)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--autotree</th> + <td></td> + <td>use texmf tree cf. env texmfstart_tree or texmfstarttree</td> + </tr> + <tr> + <th>--tree</th> + <td>pathtotree</td> + <td>use given texmf tree (default file: setuptex.tmf)</td> + </tr> + <tr> + <th>--environment</th> + <td>name</td> + <td>use given (tmf) environment file</td> + </tr> + <tr> + <th>--path</th> + <td>runpath</td> + <td>go to given path before execution</td> + </tr> + <tr> + <th>--ifchanged</th> + <td>filename</td> + <td>only execute when given file has changed (md checksum)</td> + </tr> + <tr> + <th>--iftouched</th> + <td>old,new</td> + <td>only execute when given file has changed (time stamp)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--makestubs</th> + <td></td> + <td>create stubs for (context related) scripts</td> + </tr> + <tr> + <th>--removestubs</th> + <td></td> + <td>remove stubs (context related) scripts</td> + </tr> + <tr> + <th>--stubpath</th> + <td>binpath</td> + <td>paths where stubs wil be written</td> + </tr> + <tr> + <th>--windows</th> + <td></td> + <td>create windows (mswin) stubs</td> + </tr> + <tr> + <th>--unix</th> + <td></td> + <td>create unix (linux) stubs</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--verbose</th> + <td></td> + <td>give a bit more info</td> + </tr> + <tr> + <th>--trackers</th> + <td>list</td> + <td>enable given trackers</td> + </tr> + <tr> + <th>--progname</th> + <td>str</td> + <td>format or backend</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--edit</th> + <td></td> + <td>launch editor with found file</td> + </tr> + <tr> + <th>--launch</th> + <td></td> + <td>launch files like manuals, assumes os support (--all)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--timedrun</th> + <td></td> + <td>run a script an time its run</td> + </tr> + <tr> + <th>--autogenerate</th> + <td></td> + <td>regenerate databases if needed (handy when used to run context in an editor)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--usekpse</th> + <td></td> + <td>use kpse as fallback (when no mkiv and cache installed, often slower)</td> + </tr> + <tr> + <th>--forcekpse</th> + <td></td> + <td>force using kpse (handy when no mkiv and cache installed but less functionality)</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--prefixes</th> + <td></td> + <td>show supported prefixes</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--generate</th> + <td></td> + <td>generate file database</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--variables</th> + <td></td> + <td>show configuration variables</td> + </tr> + <tr> + <th>--configurations</th> + <td></td> + <td>show configuration order</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--directives</th> + <td></td> + <td>show (known) directives</td> + </tr> + <tr> + <th>--trackers</th> + <td></td> + <td>show (known) trackers</td> + </tr> + <tr> + <th>--experiments</th> + <td></td> + <td>show (known) experiments</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--expand-braces</th> + <td></td> + <td>expand complex variable</td> + </tr> + <tr> + <th>--expand-path</th> + <td></td> + <td>expand variable (resolve paths)</td> + </tr> + <tr> + <th>--expand-var</th> + <td></td> + <td>expand variable (resolve references)</td> + </tr> + <tr> + <th>--show-path</th> + <td></td> + <td>show path expansion of ...</td> + </tr> + <tr> + <th>--var-value</th> + <td></td> + <td>report value of variable</td> + </tr> + <tr> + <th>--find-file</th> + <td></td> + <td>report file location</td> + </tr> + <tr> + <th>--find-path</th> + <td></td> + <td>report path of file</td> + </tr> + <tr><th/><td/><td/></tr> <tr> + <th>--pattern</th> + <td>string</td> + <td>filter variables</td> + </tr> + </table> +<br/> </div> + </div> + </body> + </html> diff --git a/doc/context/scripts/mtxrun.man b/doc/context/scripts/mtxrun.man new file mode 100644 index 000000000..744146fc8 --- /dev/null +++ b/doc/context/scripts/mtxrun.man @@ -0,0 +1,137 @@ +.TH ConTeXt TDS Runner Tool 1.31 +.SH "NAME" +mtxrun.SH "SYNOPSIS" +\fBmtxrun\fP [ \fIOPTIONS\fP ... ] +.SH "DESCRIPTION" +ConTeXt TDS Runner Tool + +.SH "OPTIONS" +.TP +.B --script +run an mtx script (lua prefered method) (--noquotes), no script gives list +.TP +.B --execute +run a script or program (texmfstart method) (--noquotes) +.TP +.B --resolve +resolve prefixed arguments +.TP +.B --ctxlua +run internally (using preloaded libs) +.TP +.B --internal +run script using built in libraries (same as --ctxlua) +.TP +.B --locate +locate given filename in database (default) or system (--first --all --detail) +.TP +.B --autotree +use texmf tree cf. env texmfstart_tree or texmfstarttree +.TP +.B --tree=pathtotree +use given texmf tree (default file: setuptex.tmf) +.TP +.B --environment=name +use given (tmf) environment file +.TP +.B --path=runpath +go to given path before execution +.TP +.B --ifchanged=filename +only execute when given file has changed (md checksum) +.TP +.B --iftouched=old,new +only execute when given file has changed (time stamp) +.TP +.B --makestubs +create stubs for (context related) scripts +.TP +.B --removestubs +remove stubs (context related) scripts +.TP +.B --stubpath=binpath +paths where stubs wil be written +.TP +.B --windows +create windows (mswin) stubs +.TP +.B --unix +create unix (linux) stubs +.TP +.B --verbose +give a bit more info +.TP +.B --trackers=list +enable given trackers +.TP +.B --progname=str +format or backend +.TP +.B --edit +launch editor with found file +.TP +.B --launch +launch files like manuals, assumes os support (--all) +.TP +.B --timedrun +run a script an time its run +.TP +.B --autogenerate +regenerate databases if needed (handy when used to run context in an editor) +.TP +.B --usekpse +use kpse as fallback (when no mkiv and cache installed, often slower) +.TP +.B --forcekpse +force using kpse (handy when no mkiv and cache installed but less functionality) +.TP +.B --prefixes +show supported prefixes +.TP +.B --generate +generate file database +.TP +.B --variables +show configuration variables +.TP +.B --configurations +show configuration order +.TP +.B --directives +show (known) directives +.TP +.B --trackers +show (known) trackers +.TP +.B --experiments +show (known) experiments +.TP +.B --expand-braces +expand complex variable +.TP +.B --expand-path +expand variable (resolve paths) +.TP +.B --expand-var +expand variable (resolve references) +.TP +.B --show-path +show path expansion of ... +.TP +.B --var-value +report value of variable +.TP +.B --find-file +report file location +.TP +.B --find-path +report path of file +.TP +.B --pattern=string +filter variables +.SH "AUTHOR" +More information about ConTeXt and the tools that come with it can be found at: + +maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context +webpage : http://www.pragma-ade.nl / http://tex.aanhet.net +wiki : http://contextgarden.net diff --git a/doc/context/scripts/mtxrun.xml b/doc/context/scripts/mtxrun.xml new file mode 100644 index 000000000..a7d4114d5 --- /dev/null +++ b/doc/context/scripts/mtxrun.xml @@ -0,0 +1,79 @@ +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtxrun</entry> + <entry name="detail">ConTeXt TDS Runner Tool</entry> + <entry name="version">1.31</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag> + <flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag> + <flag name="resolve"><short>resolve prefixed arguments</short></flag> + <flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag> + <flag name="internal"><short>run script using built in libraries (same as <ref name="ctxlua"/>)</short></flag> + <flag name="locate"><short>locate given filename in database (default) or system (<ref name="first"/> <ref name="all"/> <ref name="detail"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="autotree"><short>use texmf tree cf. env texmfstart_tree or texmfstarttree</short></flag> + <flag name="tree" value="pathtotree"><short>use given texmf tree (default file: setuptex.tmf)</short></flag> + <flag name="environment" value="name"><short>use given (tmf) environment file</short></flag> + <flag name="path" value="runpath"><short>go to given path before execution</short></flag> + <flag name="ifchanged" value="filename"><short>only execute when given file has changed (md checksum)</short></flag> + <flag name="iftouched" value="old,new"><short>only execute when given file has changed (time stamp)</short></flag> + </subcategory> + <subcategory> + <flag name="makestubs"><short>create stubs for (context related) scripts</short></flag> + <flag name="removestubs"><short>remove stubs (context related) scripts</short></flag> + <flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag> + <flag name="windows"><short>create windows (mswin) stubs</short></flag> + <flag name="unix"><short>create unix (linux) stubs</short></flag> + </subcategory> + <subcategory> + <flag name="verbose"><short>give a bit more info</short></flag> + <flag name="trackers" value="list"><short>enable given trackers</short></flag> + <flag name="progname" value="str"><short>format or backend</short></flag> + </subcategory> + <subcategory> + <flag name="edit"><short>launch editor with found file</short></flag> + <flag name="launch"><short>launch files like manuals, assumes os support (<ref name="all"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="timedrun"><short>run a script an time its run</short></flag> + <flag name="autogenerate"><short>regenerate databases if needed (handy when used to run context in an editor)</short></flag> + </subcategory> + <subcategory> + <flag name="usekpse"><short>use kpse as fallback (when no mkiv and cache installed, often slower)</short></flag> + <flag name="forcekpse"><short>force using kpse (handy when no mkiv and cache installed but less functionality)</short></flag> + </subcategory> + <subcategory> + <flag name="prefixes"><short>show supported prefixes</short></flag> + </subcategory> + <subcategory> + <flag name="generate"><short>generate file database</short></flag> + </subcategory> + <subcategory> + <flag name="variables"><short>show configuration variables</short></flag> + <flag name="configurations"><short>show configuration order</short></flag> + </subcategory> + <subcategory> + <flag name="directives"><short>show (known) directives</short></flag> + <flag name="trackers"><short>show (known) trackers</short></flag> + <flag name="experiments"><short>show (known) experiments</short></flag> + </subcategory> + <subcategory> + <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> + </subcategory> + <subcategory> + <flag name="pattern" value="string"><short>filter variables</short></flag> + </subcategory> + </category> + </flags> +</application> diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index d06b60b77..ad25b52ce 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -19,85 +19,195 @@ local lpegpatterns, lpegmatch, Cs, P = lpeg.patterns, lpeg.match, lpeg.Cs, lpeg. local getargument = environment.getargument or environment.argument local setargument = environment.setargument -local basicinfo = [[ ---run process (one or more) files (default action) ---make create context formats - ---ctx=name use ctx file (process management specification) ---interface use specified user interface (default: en) - ---autopdf close pdf file in viewer and start pdf viewer afterwards ---purge(all) purge files either or not after a run (--pattern=...) - ---usemodule=list load the given module or style, normally part o fthe distribution ---environment=list load the given environment file first (document styles) ---mode=list enable given the modes (conditional processing in styles) ---path=list also consult the given paths when files are looked for ---arguments=list set variables that can be consulted during a run (key/value pairs) ---randomseed=number set the randomseed ---result=name rename the resulting output to the given name ---trackers=list set tracker variables (show list with --showtrackers) ---directives=list set directive variables (show list with --showdirectives) ---silent=list disable logcatgories (show list with --showlogcategories) ---noconsole disable logging to the console (logfile only) ---purgeresult purge result file before run - ---forcexml force xml stub ---forcecld force cld (context lua document) stub ---forcelua force lua stub (like texlua) ---forcemp force mp stub - ---arrange run extra imposition pass, given that the style sets up imposition ---noarrange ignore imposition specifications in the style - ---jit use luajittex with jit turned off (only use the faster virtual machine) ---jiton use luajittex with jit turned on (in most cases not faster, even slower) - ---once only run once (no multipass data file is produced) ---batchmode run without stopping and don't show messages on the console ---nonstopmode run without stopping - ---generate generate file database etc. (as luatools does) ---paranoid don't descend to .. and ../.. ---version report installed context version - ---global assume given file present elsewhere ---nofile use dummy file as jobname - ---expert expert options -]] - -local expertinfo = [[ -expert options: - ---touch update context version number (remake needed afterwards, also provide --expert) ---nostatistics omit runtime statistics at the end of the run ---update update context from website (not to be confused with contextgarden) ---profile profile job (use: mtxrun --script profile --analyze) ---timing generate timing and statistics overview - ---extra=name process extra (mtx-context-<name> in distribution) ---extras show extras -]] - -local specialinfo = [[ -special options: - ---pdftex process file with texexec using pdftex ---xetex process file with texexec using xetex ---mkii process file with texexec - ---pipe don't check for file and enter scroll mode (--dummyfile=whatever.tmp) +local helpinfo = [[ +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtx-context</entry> + <entry name="detail">ConTeXt Process Management</entry> + <entry name="version">0.60</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 context formats</short> + </flag> + </subcategory> + <subcategory> + <flag name="ctx=name"> + <short>use ctx file (process management specification)</short> + </flag> + <flag name="interface"> + <short>use specified user interface (default: en)</short> + </flag> + </subcategory> + <subcategory> + <flag name="autopdf"> + <short>close pdf file in viewer and start pdf viewer afterwards</short> + </flag> + <flag name="purge"> + <short>purge files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + <flag name="purgeall"> + <short>purge all files either or not after a run (<ref name="pattern"/>=...)</short> + </flag> + </subcategory> + <subcategory> + <flag name="usemodule" value="list"> + <short>load the given module or style, normally part of the distribution</short> + </flag> + <flag name="environment" value="list"> + <short>load the given environment file first (document styles)</short> + </flag> + <flag name="mode" value="list"> + <short>enable given the modes (conditional processing in styles)</short> + </flag> + <flag name="path" value="list"> + <short>also consult the given paths when files are looked for</short> + </flag> + <flag name="arguments" value="list"> + <short>set variables that can be consulted during a run (key/value pairs)</short> + </flag> + <flag name="randomseed" value="number"> + <short>set the randomseed</short> + </flag> + <flag name="result" value="name"> + <short>rename the resulting output to the given name</short> + </flag> + <flag name="trackers" value="list"> + <short>set tracker variables (show list with <ref name="showtrackers"/>)</short> + </flag> + <flag name="directives" value="list"> + <short>set directive variables (show list with <ref name="showdirectives"/>)</short> + </flag> + <flag name="silent" value="list"> + <short>disable logcatgories (show list with <ref name="showlogcategories"/>)</short> + </flag> + <flag name="noconsole"> + <short>disable logging to the console (logfile only)</short> + </flag> + <flag name="purgeresult"> + <short>purge result file before run</short> + </flag> + </subcategory> + <subcategory> + <flag name="forcexml"> + <short>force xml stub</short> + </flag> + <flag name="forcecld"> + <short>force cld (context lua document) stub</short> + </flag> + <flag name="forcelua"> + <short>force lua stub (like texlua)</short> + </flag> + <flag name="forcemp"> + <short>force mp stub</short> + </flag> + </subcategory> + <subcategory> + <flag name="arrange"> + <short>run extra imposition pass, given that the style sets up imposition</short> + </flag> + <flag name="noarrange"> + <short>ignore imposition specifications in the style</short> + </flag> + </subcategory> + <subcategory> + <flag name="jit"> + <short>use luajittex with jit turned off (only use the faster virtual machine)</short> + </flag> + <flag name="jiton"> + <short>use luajittex with jit turned on (in most cases not faster, even slower)</short> + </flag> + </subcategory> + <subcategory> + <flag name="once"> + <short>only run once (no multipass data file is produced)</short> + </flag> + <flag name="batchmode"> + <short>run without stopping and do not show messages on the console</short> + </flag> + <flag name="nonstopmode"> + <short>run without stopping</short> + </flag> + </subcategory> + <subcategory> + <flag name="generate"> + <short>generate file database etc. (as luatools does)</short> + </flag> + <flag name="paranoid"> + <short>do not descend to .. and ../..</short> + </flag> + <flag name="version"> + <short>report installed context version</short> + </flag> + </subcategory> + <subcategory> + <flag name="global"> + <short>assume given file present elsewhere</short> + </flag> + <flag name="nofile"> + <short>use dummy file as jobname</short> + </flag> + </subcategory> + </category> + <category name="expert"> + <subcategory> + <flag name="touch"> + <short>update context version number (remake needed afterwards, also provide <ref name="expert"/>)</short> + </flag> + <flag name="nostatistics"> + <short>omit runtime statistics at the end of the run</short> + </flag> + <flag name="update"> + <short>update context from website (not to be confused with contextgarden)</short> + </flag> + <flag name="profile"> + <short>profile job (use: mtxrun <ref name="script"/> profile <ref name="analyze"/>)</short> + </flag> + <flag name="timing"> + <short>generate timing and statistics overview</short> + </flag> + </subcategory> + <subcategory> + <flag name="extra=name"> + <short>process extra (mtx-context-... in distribution)</short> + </flag> + <flag name="extras"> + <short>show extras</short> + </flag> + </subcategory> + </category> + <category name="special"> + <subcategory> + <flag name="pdftex"> + <short>process file with texexec using pdftex</short> + </flag> + <flag name="xetex"> + <short>process file with texexec using xetex</short> + </flag> + <flag name="mkii"> + <short>process file with texexec</short> + </flag> + </subcategory> + <subcategory> + <flag name="pipe"> + <short>do not check for file and enter scroll mode (<ref name="dummyfile"/>=whatever.tmp)</short> + </flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { name = "mtx-context", banner = "ConTeXt Process Management 0.60", - helpinfo = { - basic = basicinfo, - extra = extrainfo, - expert = expertinfo, - } + helpinfo = helpinfo, } -- local luatexflags = { @@ -1468,6 +1578,8 @@ elseif getargument("extras") then scripts.context.extras(environment.files[1] or getargument("extras")) elseif getargument("extra") then scripts.context.extra() +elseif getargument("exporthelp") then + application.export(getargument("exporthelp"),environment.files[1]) elseif getargument("help") then if environment.files[1] == "extras" then scripts.context.extras() diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index 6dfd6b108..659059fa1 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -6,42 +6,70 @@ if not modules then modules = { } end modules ['mtx-fonts'] = { license = "see context related readme files" } -local helpinfo = [[ ---save save open type font in raw table ---unpack save a tma file in a more readale format - ---reload [--force] generate new font database (use force when in doubt) ---reload --simple generate 'luatex-fonts-names.lua' (not for context!) - ---list --name list installed fonts, filter by name [--pattern] ---list --spec list installed fonts, filter by spec [--filter] ---list --file list installed fonts, filter by file [--pattern] - ---pattern=str filter files using pattern ---filter=list key-value pairs ---all show all found instances (combined with other flags) ---info give more details ---track=list enable trackers ---statistics some info about the database - -examples of searches: +local getargument = environment.getargument +local setargument = environment.setargument +local givenfiles = environment.files -mtxrun --script font --list somename (== --pattern=*somename*) - -mtxrun --script font --list --name somename -mtxrun --script font --list --name --pattern=*somename* - -mtxrun --script font --list --spec somename -mtxrun --script font --list --spec somename-bold-italic -mtxrun --script font --list --spec --pattern=*somename* -mtxrun --script font --list --spec --filter="fontname=somename" -mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed" -mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic" - -mtxrun --script font --list --all -mtxrun --script font --list --file somename -mtxrun --script font --list --file --all somename -mtxrun --script font --list --file --pattern=*somename* +local helpinfo = [[ +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-fonts</entry> + <entry name="detail">ConTeXt Font Database Management</entry> + <entry name="version">0.21</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="save"><short>save open type font in raw table</short></flag> + <flag name="unpack"><short>save a tma file in a more readale format</short></flag> + </subcategory> + <subcategory> + <flag name="reload"><short>generate new font database (use <ref name="force"/> when in doubt)</short></flag> + <flag name="reload"><short><ref name="simple"/>:generate luatex-fonts-names.lua (not for context!)</short></flag> + </subcategory> + <subcategory> + <flag name="list"><short><ref name="name"/>: list installed fonts, filter by name [<ref name="pattern"/>]</short></flag> + <flag name="list"><short><ref name="spec"/>: list installed fonts, filter by spec [<ref name="filter"/>]</short></flag> + <flag name="list"><short><ref name="file"/>: list installed fonts, filter by file [<ref name="pattern"/>]</short></flag> + </subcategory> + <subcategory> + <flag name="pattern" value="str"><short>filter files using pattern</short></flag> + <flag name="filter" value="list"><short>key-value pairs</short></flag> + <flag name="all"><short>show all found instances (combined with other flags)</short></flag> + <flag name="info"><short>give more details</short></flag> + <flag name="track" value="list"><short>enable trackers</short></flag> + <flag name="statistics"><short>some info about the database</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples of searches</title> + <subcategory> + <example><command>mtxrun --script font --list somename (== --pattern=*somename*)</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --name somename</command></example> + <example><command>mtxrun --script font --list --name --pattern=*somename*</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --spec somename</command></example> + <example><command>mtxrun --script font --list --spec somename-bold-italic</command></example> + <example><command>mtxrun --script font --list --spec --pattern=*somename*</command></example> + <example><command>mtxrun --script font --list --spec --filter="fontname=somename"</command></example> + <example><command>mtxrun --script font --list --spec --filter="familyname=somename,weight=bold,style=italic,width=condensed"</command></example> + <example><command>mtxrun --script font --list --spec --filter="familyname=crap*,weight=bold,style=italic"</command></example> + </subcategory> + <subcategory> + <example><command>mtxrun --script font --list --all</command></example> + <example><command>mtxrun --script font --list --file somename</command></example> + <example><command>mtxrun --script font --list --file --all somename</command></example> + <example><command>mtxrun --script font --list --file --pattern=*somename*</command></example> + </subcategory> + </category> + </examples> +</application> ]] local application = logs.application { @@ -139,10 +167,10 @@ function fonts.names.simple() end function scripts.fonts.reload() - if environment.argument("simple") then + if getargument("simple") then fonts.names.simple() else - fonts.names.load(true,environment.arguments.force) + fonts.names.load(true,arguments.force) end end @@ -210,7 +238,7 @@ end local function reloadbase(reload) if reload then report("fontnames, reloading font database") - names.load(true,environment.arguments.force) + names.load(true,arguments.force) report("fontnames, done\n\n") end end @@ -276,16 +304,16 @@ end function scripts.fonts.list() - local all = environment.argument("all") - local info = environment.argument("info") - local reload = environment.argument("reload") - local pattern = environment.argument("pattern") - local filter = environment.argument("filter") - local given = environment.files[1] + local all = getargument("all") + local info = getargument("info") + local reload = getargument("reload") + local pattern = getargument("pattern") + local filter = getargument("filter") + local given = givenfiles[1] reloadbase(reload) - if environment.argument("name") then + if getargument("name") then if pattern then --~ mtxrun --script font --list --name --pattern=*somename* list_matches(fonts.names.list(string.topattern(pattern,true),reload,all),info) @@ -297,7 +325,7 @@ function scripts.fonts.list() else report("not supported: --list --name <no specification>",name) end - elseif environment.argument("spec") then + elseif getargument("spec") then if pattern then --~ mtxrun --script font --list --spec --pattern=*somename* report("not supported: --list --spec --pattern",name) @@ -310,7 +338,7 @@ function scripts.fonts.list() else report("not supported: --list --spec <no specification>",name) end - elseif environment.argument("file") then + elseif getargument("file") then if pattern then --~ mtxrun --script font --list --file --pattern=*somename* list_specifications(fonts.names.collectfiles(string.topattern(pattern,true),reload,all),info) @@ -338,7 +366,7 @@ function scripts.fonts.list() end function scripts.fonts.unpack() - local name = file.removesuffix(file.basename(environment.files[1] or "")) + local name = file.removesuffix(file.basename(givenfiles[1] or "")) if name and name ~= "" then local cache = containers.define("fonts", "otf", 2.730, true) local cleanname = containers.cleanname(name) @@ -355,8 +383,8 @@ function scripts.fonts.unpack() end function scripts.fonts.save() - local name = environment.files[1] or "" - local sub = environment.files[2] or "" + local name = givenfiles[1] or "" + local sub = givenfiles[2] or "" local function save(savename,fontblob) if fontblob then savename = savename:lower() .. ".lua" @@ -396,21 +424,23 @@ function scripts.fonts.save() end end -if environment.argument("names") then - environment.setargument("reload",true) - environment.setargument("simple",true) +if getargument("names") then + setargument("reload",true) + setargument("simple",true) end -if environment.argument("list") then +if getargument("list") then scripts.fonts.list() -elseif environment.argument("reload") then +elseif getargument("reload") then scripts.fonts.reload() -elseif environment.argument("save") then +elseif getargument("save") then scripts.fonts.save() -elseif environment.argument("unpack") then +elseif getargument("unpack") then scripts.fonts.unpack() -elseif environment.argument("statistics") then +elseif getargument("statistics") then fonts.names.statistics() +elseif getargument("exporthelp") then + application.export(getargument("exporthelp"),givenfiles[1]) else application.help() end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 0648e94e7..92c9a763a 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: 20644, stripped down to: 14615 +-- original size: 21510, stripped down to: 15167 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6137,6 +6137,7 @@ logs=logs or {} local logs=logs local moreinfo=[[ More information about ConTeXt and the tools that come with it can be found at: +]].."\n"..[[ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net wiki : http://contextgarden.net @@ -6536,11 +6537,14 @@ function logs.reportbanner() end function logs.reportline () end function logs.simplelines () end function logs.help () end +local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match +local p_newline=lpeg.patterns.newline +local linewise=( + Carg(1)*C((1-p_newline)^1)/function(t,s) t.report(s) end+Carg(1)*p_newline^2/function(t) t.report() end+p_newline +)^1 local function reportlines(t,str) if str then - for line in gmatch(str,"(.-)[\n\r]") do - t.report(line) - end + lpegmatch(linewise,str,1,t) end end local function reportbanner(t) @@ -6561,8 +6565,7 @@ local function reporthelp(t,...) if type(helpinfo)=="string" then reportlines(t,helpinfo) elseif type(helpinfo)=="table" then - local n=select("#",...) - for i=1,n do + for i=1,select("#",...) do reportlines(t,t.helpinfo[select(i,...)]) if i<n then t.report() @@ -6572,15 +6575,39 @@ local function reporthelp(t,...) end local function reportinfo(t) t.report() - reportlines(t,moreinfo) -end + reportlines(t,t.moreinfo) +end +local function reportexport(t,method) + report(t.helpinfo) +end +local reporters={ + lines=reportlines, + banner=reportbanner, + version=reportversion, + help=reporthelp, + info=reportinfo, + export=reportexport, +} +logs.reporters=reporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner + t.moreinfo=moreinfo t.report=logs.reporter(t.name) - t.help=function(...) reportbanner(t);reporthelp(t,...);reportinfo(t) end - t.identify=function() reportbanner(t) end - t.version=function() reportversion(t) end + t.help=function(...) + reporters.banner(t) + reporters.help(t,...) + reporters.info(t) + end + t.export=function(...) + reporters.export(t,...) + end + t.identify=function() + reporters.banner(t) + end + t.version=function() + reporters.version(t) + end return t end function logs.system(whereto,process,jobname,category,...) @@ -7348,7 +7375,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-mrg"] = package.loaded["util-mrg"] or true --- original size: 7255, stripped down to: 5798 +-- original size: 7294, stripped down to: 5798 if not modules then modules={} end modules ['util-mrg']={ version=1.001, @@ -7968,7 +7995,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42430, stripped down to: 26548 +-- original size: 42495, stripped down to: 26647 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -7978,15 +8005,16 @@ if not modules then modules={} end modules ['lxml-tab']={ license="see context related readme files" } local trace_entities=false trackers.register("xml.entities",function(v) trace_entities=v end) -local report_xml=logs and logs.reporter("xml","core") or function(...) print(format(...)) end +local report_xml=logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end xml=xml or {} local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber=type,next,setmetatable,getmetatable,tonumber -local format,lower,find,match,gsub=string.format,string.lower,string.find,string.match,string.gsub +local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub local utfchar=utf.char local lpegmatch=lpeg.match local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs +local formatters=string.formatters xml.xmlns=xml.xmlns or {} local check=P(false) local parse=check @@ -8049,7 +8077,7 @@ local function add_empty(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top=stack[#stack] dt=top.dt local t={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=top } @@ -8064,7 +8092,7 @@ local function add_begin(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=stack[#stack] } setmetatable(top,mt) dt=top.dt @@ -8078,9 +8106,9 @@ local function add_end(spacing,namespace,tag) local toclose=remove(stack) top=stack[#stack] if #stack<1 then - errorstr=format("nothing to close with %s %s",tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "") elseif toclose.tg~=tag then - errorstr=format("unable to close %s with %s %s",toclose.tg,tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "") end dt=top.dt dt[#dt+1]=toclose @@ -8125,9 +8153,9 @@ local function attribute_specification_error(str) return str end xml.placeholders={ - unknown_dec_entity=function(str) return (str=="" and "&error;") or format("&%s;",str) end, - unknown_hex_entity=function(str) return format("&#x%s;",str) end, - unknown_any_entity=function(str) return format("&#x%s;",str) end, + unknown_dec_entity=function(str) return str=="" and "&error;" or formatters["&%s;"](str) end, + unknown_hex_entity=function(str) return formatters["&#x%s;"](str) end, + unknown_any_entity=function(str) return formatters["&#x%s;"](str) end, } local placeholders=xml.placeholders local function fromhex(s) @@ -8135,7 +8163,7 @@ local function fromhex(s) if n then return utfchar(n) else - return format("h:%s",s),true + return formatters["h:%s"](s),true end end local function fromdec(s) @@ -8143,7 +8171,7 @@ local function fromdec(s) if n then return utfchar(n) else - return format("d:%s",s),true + return formatters["d:%s"](s),true end end local rest=(1-P(";"))^0 @@ -8469,9 +8497,9 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) else - xml.errorhandler(format("load error: %s",errorstr)) + xml.errorhandler(formatters["load error: %s"](errorstr)) end end end @@ -8607,7 +8635,7 @@ local function verbose_element(e,handlers) local ats=eat and next(eat) and {} if ats then for k,v in next,eat do - ats[#ats+1]=format('%s=%q',k,escaped(v)) + ats[#ats+1]=formatters['%s=%q'](k,escaped(v)) end end if ern and trace_entities and ern~=ens then @@ -8722,7 +8750,7 @@ local function xserialize(e,handlers) end local handlers={} local function newhandlers(settings) - local t=table.copy(handlers.verbose or {}) + local t=table.copy(handlers[settings and settings.parent or "verbose"] or {}) if settings then for k,v in next,settings do if type(v)=="table" then @@ -8803,7 +8831,7 @@ local xmlstringhandler=newhandlers { local function xmltostring(root) if not root then return "" - elseif type(root)=='string' then + elseif type(root)=="string" then return root else return serialize(root,xmlstringhandler) or "" @@ -8892,7 +8920,7 @@ end function xml.tocdata(e,wrapper) local whatever=type(e)=="table" and xmltostring(e.dt) or e or "" if wrapper then - whatever=format("<%s>%s</%s>",wrapper,whatever,wrapper) + whatever=formatters["<%s>%s</%s>"](wrapper,whatever,wrapper) end local t={ special=true,ns="",tg="@cd@",at={},rn="",dt={ whatever },__p__=e } setmetatable(t,getmetatable(e)) @@ -11148,6 +11176,99 @@ end -- of closure 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 + +if not modules then modules={} end modules ['trac-xml']={ + version=1.001, + comment="companion to trac-log.mkiv", + author="Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright="PRAGMA ADE / ConTeXt Development Team", + license="see context related readme files" +} +local formatters=string.formatters +local reporters=logs.reporters +local xmlserialize=xml.serialize +local xmlcollected=xml.collected +local xmltext=xml.text +local xmlfirst=xml.first +local function showhelp(specification,...) + local root=xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs=xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref",function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories=select("#",...)==0 and true or table.tohash {... } + local nofcategories=xml.count(root,"/application/flags/category") + local report=specification.report + for category in xmlcollected(root,"/application/flags/category") do + local categoryname=category.at.name or "" + if wantedcategories==true or wantedcategories[categoryname] then + if nofcategories>1 then + report("%s options:",categoryname) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for flag in xmlcollected(subcategory,"/flag") do + local name=flag.at.name + local value=flag.at.value + local short=xmltext(xmlfirst(flag,"/short")) + if value then + report("--%-24s %s",formatters["%s=%s"](name,value),short) + else + report("--%-24s %s",name,short) + end + end + report() + end + end + end + for category in xmlcollected(root,"/application/examples/category") do + local title=xmltext(xmlfirst(category,"/title")) + if title and title~="" then + report() + report(title) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for example in xmlcollected(subcategory,"/example") do + local command=xmltext(xmlfirst(example,"/command")) + local comment=xmltext(xmlfirst(example,"/comment")) + report(command) + end + report() + end + end +end +local reporthelp=reporters.help +local exporthelp=reporters.export +function reporters.help(t,...) + local helpinfo=t.helpinfo + if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + showhelp(t,...) + else + reporthelp(t,...) + end +end +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) + else + reporters.lines(t,result) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + package.loaded["data-ini"] = package.loaded["data-ini"] or true -- original size: 7898, stripped down to: 5501 @@ -15390,10 +15511,10 @@ end 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 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 +-- 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 : 636443 --- stripped bytes : 230487 +-- original bytes : 640903 +-- stripped bytes : 231417 -- end library merge @@ -15459,6 +15580,8 @@ local ownlibs = { -- order can be made better 'lxml-aux.lua', 'lxml-xml.lua', + 'trac-xml.lua', + 'data-ini.lua', 'data-exp.lua', 'data-env.lua', @@ -15603,59 +15726,85 @@ if not environment.experiments then environment.experiments = e_experiments end local instance = resolvers.reset() local helpinfo = [[ ---script run an mtx script (lua prefered method) (--noquotes), no script gives list ---execute run a script or program (texmfstart method) (--noquotes) ---resolve resolve prefixed arguments ---ctxlua run internally (using preloaded libs) ---internal run script using built in libraries (same as --ctxlua) ---locate locate given filename in database (default) or system (--first --all --detail) - ---autotree use texmf tree cf. env 'texmfstart_tree' or 'texmfstarttree' ---tree=pathtotree use given texmf tree (default file: 'setuptex.tmf') ---environment=name use given (tmf) environment file ---path=runpath go to given path before execution ---ifchanged=filename only execute when given file has changed (md checksum) ---iftouched=old,new only execute when given file has changed (time stamp) - ---makestubs create stubs for (context related) scripts ---removestubs remove stubs (context related) scripts ---stubpath=binpath paths where stubs wil be written ---windows create windows (mswin) stubs ---unix create unix (linux) stubs - ---verbose give a bit more info ---trackers=list enable given trackers ---progname=str format or backend - ---edit launch editor with found file ---launch (--all) launch files like manuals, assumes os support - ---timedrun run a script an time its run ---autogenerate regenerate databases if needed (handy when used to run context in an editor) - ---usekpse use kpse as fallback (when no mkiv and cache installed, often slower) ---forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) - ---prefixes show supported prefixes - ---generate generate file database - ---variables show configuration variables ---configurations show configuration order - ---directives show (known) directives ---trackers show (known) trackers ---experiments show (known) experiments - ---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 - ---pattern=str filter variables +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtxrun</entry> + <entry name="detail">ConTeXt TDS Runner Tool</entry> + <entry name="version">1.31</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag> + <flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag> + <flag name="resolve"><short>resolve prefixed arguments</short></flag> + <flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag> + <flag name="internal"><short>run script using built in libraries (same as <ref name="ctxlua"/>)</short></flag> + <flag name="locate"><short>locate given filename in database (default) or system (<ref name="first"/> <ref name="all"/> <ref name="detail"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="autotree"><short>use texmf tree cf. env texmfstart_tree or texmfstarttree</short></flag> + <flag name="tree" value="pathtotree"><short>use given texmf tree (default file: setuptex.tmf)</short></flag> + <flag name="environment" value="name"><short>use given (tmf) environment file</short></flag> + <flag name="path" value="runpath"><short>go to given path before execution</short></flag> + <flag name="ifchanged" value="filename"><short>only execute when given file has changed (md checksum)</short></flag> + <flag name="iftouched" value="old,new"><short>only execute when given file has changed (time stamp)</short></flag> + </subcategory> + <subcategory> + <flag name="makestubs"><short>create stubs for (context related) scripts</short></flag> + <flag name="removestubs"><short>remove stubs (context related) scripts</short></flag> + <flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag> + <flag name="windows"><short>create windows (mswin) stubs</short></flag> + <flag name="unix"><short>create unix (linux) stubs</short></flag> + </subcategory> + <subcategory> + <flag name="verbose"><short>give a bit more info</short></flag> + <flag name="trackers" value="list"><short>enable given trackers</short></flag> + <flag name="progname" value="str"><short>format or backend</short></flag> + </subcategory> + <subcategory> + <flag name="edit"><short>launch editor with found file</short></flag> + <flag name="launch"><short>launch files like manuals, assumes os support (<ref name="all"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="timedrun"><short>run a script an time its run</short></flag> + <flag name="autogenerate"><short>regenerate databases if needed (handy when used to run context in an editor)</short></flag> + </subcategory> + <subcategory> + <flag name="usekpse"><short>use kpse as fallback (when no mkiv and cache installed, often slower)</short></flag> + <flag name="forcekpse"><short>force using kpse (handy when no mkiv and cache installed but less functionality)</short></flag> + </subcategory> + <subcategory> + <flag name="prefixes"><short>show supported prefixes</short></flag> + </subcategory> + <subcategory> + <flag name="generate"><short>generate file database</short></flag> + </subcategory> + <subcategory> + <flag name="variables"><short>show configuration variables</short></flag> + <flag name="configurations"><short>show configuration order</short></flag> + </subcategory> + <subcategory> + <flag name="directives"><short>show (known) directives</short></flag> + <flag name="trackers"><short>show (known) trackers</short></flag> + <flag name="experiments"><short>show (known) experiments</short></flag> + </subcategory> + <subcategory> + <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> + </subcategory> + <subcategory> + <flag name="pattern" value="string"><short>filter variables</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -16617,6 +16766,11 @@ elseif e_argument("experiments") then experiments.show() +elseif e_argument("exporthelp") then + + runners.loadbase() + application.export(e_argument("exporthelp"),filename) + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 0648e94e7..92c9a763a 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: 20644, stripped down to: 14615 +-- original size: 21510, stripped down to: 15167 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6137,6 +6137,7 @@ logs=logs or {} local logs=logs local moreinfo=[[ More information about ConTeXt and the tools that come with it can be found at: +]].."\n"..[[ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net wiki : http://contextgarden.net @@ -6536,11 +6537,14 @@ function logs.reportbanner() end function logs.reportline () end function logs.simplelines () end function logs.help () end +local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match +local p_newline=lpeg.patterns.newline +local linewise=( + Carg(1)*C((1-p_newline)^1)/function(t,s) t.report(s) end+Carg(1)*p_newline^2/function(t) t.report() end+p_newline +)^1 local function reportlines(t,str) if str then - for line in gmatch(str,"(.-)[\n\r]") do - t.report(line) - end + lpegmatch(linewise,str,1,t) end end local function reportbanner(t) @@ -6561,8 +6565,7 @@ local function reporthelp(t,...) if type(helpinfo)=="string" then reportlines(t,helpinfo) elseif type(helpinfo)=="table" then - local n=select("#",...) - for i=1,n do + for i=1,select("#",...) do reportlines(t,t.helpinfo[select(i,...)]) if i<n then t.report() @@ -6572,15 +6575,39 @@ local function reporthelp(t,...) end local function reportinfo(t) t.report() - reportlines(t,moreinfo) -end + reportlines(t,t.moreinfo) +end +local function reportexport(t,method) + report(t.helpinfo) +end +local reporters={ + lines=reportlines, + banner=reportbanner, + version=reportversion, + help=reporthelp, + info=reportinfo, + export=reportexport, +} +logs.reporters=reporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner + t.moreinfo=moreinfo t.report=logs.reporter(t.name) - t.help=function(...) reportbanner(t);reporthelp(t,...);reportinfo(t) end - t.identify=function() reportbanner(t) end - t.version=function() reportversion(t) end + t.help=function(...) + reporters.banner(t) + reporters.help(t,...) + reporters.info(t) + end + t.export=function(...) + reporters.export(t,...) + end + t.identify=function() + reporters.banner(t) + end + t.version=function() + reporters.version(t) + end return t end function logs.system(whereto,process,jobname,category,...) @@ -7348,7 +7375,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-mrg"] = package.loaded["util-mrg"] or true --- original size: 7255, stripped down to: 5798 +-- original size: 7294, stripped down to: 5798 if not modules then modules={} end modules ['util-mrg']={ version=1.001, @@ -7968,7 +7995,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42430, stripped down to: 26548 +-- original size: 42495, stripped down to: 26647 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -7978,15 +8005,16 @@ if not modules then modules={} end modules ['lxml-tab']={ license="see context related readme files" } local trace_entities=false trackers.register("xml.entities",function(v) trace_entities=v end) -local report_xml=logs and logs.reporter("xml","core") or function(...) print(format(...)) end +local report_xml=logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end xml=xml or {} local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber=type,next,setmetatable,getmetatable,tonumber -local format,lower,find,match,gsub=string.format,string.lower,string.find,string.match,string.gsub +local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub local utfchar=utf.char local lpegmatch=lpeg.match local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs +local formatters=string.formatters xml.xmlns=xml.xmlns or {} local check=P(false) local parse=check @@ -8049,7 +8077,7 @@ local function add_empty(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top=stack[#stack] dt=top.dt local t={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=top } @@ -8064,7 +8092,7 @@ local function add_begin(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=stack[#stack] } setmetatable(top,mt) dt=top.dt @@ -8078,9 +8106,9 @@ local function add_end(spacing,namespace,tag) local toclose=remove(stack) top=stack[#stack] if #stack<1 then - errorstr=format("nothing to close with %s %s",tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "") elseif toclose.tg~=tag then - errorstr=format("unable to close %s with %s %s",toclose.tg,tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "") end dt=top.dt dt[#dt+1]=toclose @@ -8125,9 +8153,9 @@ local function attribute_specification_error(str) return str end xml.placeholders={ - unknown_dec_entity=function(str) return (str=="" and "&error;") or format("&%s;",str) end, - unknown_hex_entity=function(str) return format("&#x%s;",str) end, - unknown_any_entity=function(str) return format("&#x%s;",str) end, + unknown_dec_entity=function(str) return str=="" and "&error;" or formatters["&%s;"](str) end, + unknown_hex_entity=function(str) return formatters["&#x%s;"](str) end, + unknown_any_entity=function(str) return formatters["&#x%s;"](str) end, } local placeholders=xml.placeholders local function fromhex(s) @@ -8135,7 +8163,7 @@ local function fromhex(s) if n then return utfchar(n) else - return format("h:%s",s),true + return formatters["h:%s"](s),true end end local function fromdec(s) @@ -8143,7 +8171,7 @@ local function fromdec(s) if n then return utfchar(n) else - return format("d:%s",s),true + return formatters["d:%s"](s),true end end local rest=(1-P(";"))^0 @@ -8469,9 +8497,9 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) else - xml.errorhandler(format("load error: %s",errorstr)) + xml.errorhandler(formatters["load error: %s"](errorstr)) end end end @@ -8607,7 +8635,7 @@ local function verbose_element(e,handlers) local ats=eat and next(eat) and {} if ats then for k,v in next,eat do - ats[#ats+1]=format('%s=%q',k,escaped(v)) + ats[#ats+1]=formatters['%s=%q'](k,escaped(v)) end end if ern and trace_entities and ern~=ens then @@ -8722,7 +8750,7 @@ local function xserialize(e,handlers) end local handlers={} local function newhandlers(settings) - local t=table.copy(handlers.verbose or {}) + local t=table.copy(handlers[settings and settings.parent or "verbose"] or {}) if settings then for k,v in next,settings do if type(v)=="table" then @@ -8803,7 +8831,7 @@ local xmlstringhandler=newhandlers { local function xmltostring(root) if not root then return "" - elseif type(root)=='string' then + elseif type(root)=="string" then return root else return serialize(root,xmlstringhandler) or "" @@ -8892,7 +8920,7 @@ end function xml.tocdata(e,wrapper) local whatever=type(e)=="table" and xmltostring(e.dt) or e or "" if wrapper then - whatever=format("<%s>%s</%s>",wrapper,whatever,wrapper) + whatever=formatters["<%s>%s</%s>"](wrapper,whatever,wrapper) end local t={ special=true,ns="",tg="@cd@",at={},rn="",dt={ whatever },__p__=e } setmetatable(t,getmetatable(e)) @@ -11148,6 +11176,99 @@ end -- of closure 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 + +if not modules then modules={} end modules ['trac-xml']={ + version=1.001, + comment="companion to trac-log.mkiv", + author="Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright="PRAGMA ADE / ConTeXt Development Team", + license="see context related readme files" +} +local formatters=string.formatters +local reporters=logs.reporters +local xmlserialize=xml.serialize +local xmlcollected=xml.collected +local xmltext=xml.text +local xmlfirst=xml.first +local function showhelp(specification,...) + local root=xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs=xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref",function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories=select("#",...)==0 and true or table.tohash {... } + local nofcategories=xml.count(root,"/application/flags/category") + local report=specification.report + for category in xmlcollected(root,"/application/flags/category") do + local categoryname=category.at.name or "" + if wantedcategories==true or wantedcategories[categoryname] then + if nofcategories>1 then + report("%s options:",categoryname) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for flag in xmlcollected(subcategory,"/flag") do + local name=flag.at.name + local value=flag.at.value + local short=xmltext(xmlfirst(flag,"/short")) + if value then + report("--%-24s %s",formatters["%s=%s"](name,value),short) + else + report("--%-24s %s",name,short) + end + end + report() + end + end + end + for category in xmlcollected(root,"/application/examples/category") do + local title=xmltext(xmlfirst(category,"/title")) + if title and title~="" then + report() + report(title) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for example in xmlcollected(subcategory,"/example") do + local command=xmltext(xmlfirst(example,"/command")) + local comment=xmltext(xmlfirst(example,"/comment")) + report(command) + end + report() + end + end +end +local reporthelp=reporters.help +local exporthelp=reporters.export +function reporters.help(t,...) + local helpinfo=t.helpinfo + if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + showhelp(t,...) + else + reporthelp(t,...) + end +end +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) + else + reporters.lines(t,result) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + package.loaded["data-ini"] = package.loaded["data-ini"] or true -- original size: 7898, stripped down to: 5501 @@ -15390,10 +15511,10 @@ end 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 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 +-- 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 : 636443 --- stripped bytes : 230487 +-- original bytes : 640903 +-- stripped bytes : 231417 -- end library merge @@ -15459,6 +15580,8 @@ local ownlibs = { -- order can be made better 'lxml-aux.lua', 'lxml-xml.lua', + 'trac-xml.lua', + 'data-ini.lua', 'data-exp.lua', 'data-env.lua', @@ -15603,59 +15726,85 @@ if not environment.experiments then environment.experiments = e_experiments end local instance = resolvers.reset() local helpinfo = [[ ---script run an mtx script (lua prefered method) (--noquotes), no script gives list ---execute run a script or program (texmfstart method) (--noquotes) ---resolve resolve prefixed arguments ---ctxlua run internally (using preloaded libs) ---internal run script using built in libraries (same as --ctxlua) ---locate locate given filename in database (default) or system (--first --all --detail) - ---autotree use texmf tree cf. env 'texmfstart_tree' or 'texmfstarttree' ---tree=pathtotree use given texmf tree (default file: 'setuptex.tmf') ---environment=name use given (tmf) environment file ---path=runpath go to given path before execution ---ifchanged=filename only execute when given file has changed (md checksum) ---iftouched=old,new only execute when given file has changed (time stamp) - ---makestubs create stubs for (context related) scripts ---removestubs remove stubs (context related) scripts ---stubpath=binpath paths where stubs wil be written ---windows create windows (mswin) stubs ---unix create unix (linux) stubs - ---verbose give a bit more info ---trackers=list enable given trackers ---progname=str format or backend - ---edit launch editor with found file ---launch (--all) launch files like manuals, assumes os support - ---timedrun run a script an time its run ---autogenerate regenerate databases if needed (handy when used to run context in an editor) - ---usekpse use kpse as fallback (when no mkiv and cache installed, often slower) ---forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) - ---prefixes show supported prefixes - ---generate generate file database - ---variables show configuration variables ---configurations show configuration order - ---directives show (known) directives ---trackers show (known) trackers ---experiments show (known) experiments - ---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 - ---pattern=str filter variables +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtxrun</entry> + <entry name="detail">ConTeXt TDS Runner Tool</entry> + <entry name="version">1.31</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag> + <flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag> + <flag name="resolve"><short>resolve prefixed arguments</short></flag> + <flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag> + <flag name="internal"><short>run script using built in libraries (same as <ref name="ctxlua"/>)</short></flag> + <flag name="locate"><short>locate given filename in database (default) or system (<ref name="first"/> <ref name="all"/> <ref name="detail"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="autotree"><short>use texmf tree cf. env texmfstart_tree or texmfstarttree</short></flag> + <flag name="tree" value="pathtotree"><short>use given texmf tree (default file: setuptex.tmf)</short></flag> + <flag name="environment" value="name"><short>use given (tmf) environment file</short></flag> + <flag name="path" value="runpath"><short>go to given path before execution</short></flag> + <flag name="ifchanged" value="filename"><short>only execute when given file has changed (md checksum)</short></flag> + <flag name="iftouched" value="old,new"><short>only execute when given file has changed (time stamp)</short></flag> + </subcategory> + <subcategory> + <flag name="makestubs"><short>create stubs for (context related) scripts</short></flag> + <flag name="removestubs"><short>remove stubs (context related) scripts</short></flag> + <flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag> + <flag name="windows"><short>create windows (mswin) stubs</short></flag> + <flag name="unix"><short>create unix (linux) stubs</short></flag> + </subcategory> + <subcategory> + <flag name="verbose"><short>give a bit more info</short></flag> + <flag name="trackers" value="list"><short>enable given trackers</short></flag> + <flag name="progname" value="str"><short>format or backend</short></flag> + </subcategory> + <subcategory> + <flag name="edit"><short>launch editor with found file</short></flag> + <flag name="launch"><short>launch files like manuals, assumes os support (<ref name="all"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="timedrun"><short>run a script an time its run</short></flag> + <flag name="autogenerate"><short>regenerate databases if needed (handy when used to run context in an editor)</short></flag> + </subcategory> + <subcategory> + <flag name="usekpse"><short>use kpse as fallback (when no mkiv and cache installed, often slower)</short></flag> + <flag name="forcekpse"><short>force using kpse (handy when no mkiv and cache installed but less functionality)</short></flag> + </subcategory> + <subcategory> + <flag name="prefixes"><short>show supported prefixes</short></flag> + </subcategory> + <subcategory> + <flag name="generate"><short>generate file database</short></flag> + </subcategory> + <subcategory> + <flag name="variables"><short>show configuration variables</short></flag> + <flag name="configurations"><short>show configuration order</short></flag> + </subcategory> + <subcategory> + <flag name="directives"><short>show (known) directives</short></flag> + <flag name="trackers"><short>show (known) trackers</short></flag> + <flag name="experiments"><short>show (known) experiments</short></flag> + </subcategory> + <subcategory> + <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> + </subcategory> + <subcategory> + <flag name="pattern" value="string"><short>filter variables</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -16617,6 +16766,11 @@ elseif e_argument("experiments") then experiments.show() +elseif e_argument("exporthelp") then + + runners.loadbase() + application.export(e_argument("exporthelp"),filename) + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 0648e94e7..92c9a763a 100755 --- 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: 20644, stripped down to: 14615 +-- original size: 21510, stripped down to: 15167 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -6137,6 +6137,7 @@ logs=logs or {} local logs=logs local moreinfo=[[ More information about ConTeXt and the tools that come with it can be found at: +]].."\n"..[[ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net wiki : http://contextgarden.net @@ -6536,11 +6537,14 @@ function logs.reportbanner() end function logs.reportline () end function logs.simplelines () end function logs.help () end +local Carg,C,lpegmatch=lpeg.Carg,lpeg.C,lpeg.match +local p_newline=lpeg.patterns.newline +local linewise=( + Carg(1)*C((1-p_newline)^1)/function(t,s) t.report(s) end+Carg(1)*p_newline^2/function(t) t.report() end+p_newline +)^1 local function reportlines(t,str) if str then - for line in gmatch(str,"(.-)[\n\r]") do - t.report(line) - end + lpegmatch(linewise,str,1,t) end end local function reportbanner(t) @@ -6561,8 +6565,7 @@ local function reporthelp(t,...) if type(helpinfo)=="string" then reportlines(t,helpinfo) elseif type(helpinfo)=="table" then - local n=select("#",...) - for i=1,n do + for i=1,select("#",...) do reportlines(t,t.helpinfo[select(i,...)]) if i<n then t.report() @@ -6572,15 +6575,39 @@ local function reporthelp(t,...) end local function reportinfo(t) t.report() - reportlines(t,moreinfo) -end + reportlines(t,t.moreinfo) +end +local function reportexport(t,method) + report(t.helpinfo) +end +local reporters={ + lines=reportlines, + banner=reportbanner, + version=reportversion, + help=reporthelp, + info=reportinfo, + export=reportexport, +} +logs.reporters=reporters function logs.application(t) t.name=t.name or "unknown" t.banner=t.banner + t.moreinfo=moreinfo t.report=logs.reporter(t.name) - t.help=function(...) reportbanner(t);reporthelp(t,...);reportinfo(t) end - t.identify=function() reportbanner(t) end - t.version=function() reportversion(t) end + t.help=function(...) + reporters.banner(t) + reporters.help(t,...) + reporters.info(t) + end + t.export=function(...) + reporters.export(t,...) + end + t.identify=function() + reporters.banner(t) + end + t.version=function() + reporters.version(t) + end return t end function logs.system(whereto,process,jobname,category,...) @@ -7348,7 +7375,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-mrg"] = package.loaded["util-mrg"] or true --- original size: 7255, stripped down to: 5798 +-- original size: 7294, stripped down to: 5798 if not modules then modules={} end modules ['util-mrg']={ version=1.001, @@ -7968,7 +7995,7 @@ do -- create closure to overcome 200 locals limit package.loaded["lxml-tab"] = package.loaded["lxml-tab"] or true --- original size: 42430, stripped down to: 26548 +-- original size: 42495, stripped down to: 26647 if not modules then modules={} end modules ['lxml-tab']={ version=1.001, @@ -7978,15 +8005,16 @@ if not modules then modules={} end modules ['lxml-tab']={ license="see context related readme files" } local trace_entities=false trackers.register("xml.entities",function(v) trace_entities=v end) -local report_xml=logs and logs.reporter("xml","core") or function(...) print(format(...)) end +local report_xml=logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end xml=xml or {} local xml=xml local concat,remove,insert=table.concat,table.remove,table.insert local type,next,setmetatable,getmetatable,tonumber=type,next,setmetatable,getmetatable,tonumber -local format,lower,find,match,gsub=string.format,string.lower,string.find,string.match,string.gsub +local lower,find,match,gsub=string.lower,string.find,string.match,string.gsub local utfchar=utf.char local lpegmatch=lpeg.match local P,S,R,C,V,C,Cs=lpeg.P,lpeg.S,lpeg.R,lpeg.C,lpeg.V,lpeg.C,lpeg.Cs +local formatters=string.formatters xml.xmlns=xml.xmlns or {} local check=P(false) local parse=check @@ -8049,7 +8077,7 @@ local function add_empty(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top=stack[#stack] dt=top.dt local t={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=top } @@ -8064,7 +8092,7 @@ local function add_begin(spacing,namespace,tag) if #spacing>0 then dt[#dt+1]=spacing end - local resolved=(namespace=="" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved=namespace=="" and xmlns[#xmlns] or nsremap[namespace] or namespace top={ ns=namespace or "",rn=resolved,tg=tag,at=at,dt={},__p__=stack[#stack] } setmetatable(top,mt) dt=top.dt @@ -8078,9 +8106,9 @@ local function add_end(spacing,namespace,tag) local toclose=remove(stack) top=stack[#stack] if #stack<1 then - errorstr=format("nothing to close with %s %s",tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "") elseif toclose.tg~=tag then - errorstr=format("unable to close %s with %s %s",toclose.tg,tag,xml.checkerror(top,toclose) or "") + errorstr=formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "") end dt=top.dt dt[#dt+1]=toclose @@ -8125,9 +8153,9 @@ local function attribute_specification_error(str) return str end xml.placeholders={ - unknown_dec_entity=function(str) return (str=="" and "&error;") or format("&%s;",str) end, - unknown_hex_entity=function(str) return format("&#x%s;",str) end, - unknown_any_entity=function(str) return format("&#x%s;",str) end, + unknown_dec_entity=function(str) return str=="" and "&error;" or formatters["&%s;"](str) end, + unknown_hex_entity=function(str) return formatters["&#x%s;"](str) end, + unknown_any_entity=function(str) return formatters["&#x%s;"](str) end, } local placeholders=xml.placeholders local function fromhex(s) @@ -8135,7 +8163,7 @@ local function fromhex(s) if n then return utfchar(n) else - return format("h:%s",s),true + return formatters["h:%s"](s),true end end local function fromdec(s) @@ -8143,7 +8171,7 @@ local function fromdec(s) if n then return utfchar(n) else - return format("d:%s",s),true + return formatters["d:%s"](s),true end end local rest=(1-P(";"))^0 @@ -8469,9 +8497,9 @@ local function _xmlconvert_(data,settings) if errorhandler then local currentresource=settings.currentresource if currentresource and currentresource~="" then - xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) else - xml.errorhandler(format("load error: %s",errorstr)) + xml.errorhandler(formatters["load error: %s"](errorstr)) end end end @@ -8607,7 +8635,7 @@ local function verbose_element(e,handlers) local ats=eat and next(eat) and {} if ats then for k,v in next,eat do - ats[#ats+1]=format('%s=%q',k,escaped(v)) + ats[#ats+1]=formatters['%s=%q'](k,escaped(v)) end end if ern and trace_entities and ern~=ens then @@ -8722,7 +8750,7 @@ local function xserialize(e,handlers) end local handlers={} local function newhandlers(settings) - local t=table.copy(handlers.verbose or {}) + local t=table.copy(handlers[settings and settings.parent or "verbose"] or {}) if settings then for k,v in next,settings do if type(v)=="table" then @@ -8803,7 +8831,7 @@ local xmlstringhandler=newhandlers { local function xmltostring(root) if not root then return "" - elseif type(root)=='string' then + elseif type(root)=="string" then return root else return serialize(root,xmlstringhandler) or "" @@ -8892,7 +8920,7 @@ end function xml.tocdata(e,wrapper) local whatever=type(e)=="table" and xmltostring(e.dt) or e or "" if wrapper then - whatever=format("<%s>%s</%s>",wrapper,whatever,wrapper) + whatever=formatters["<%s>%s</%s>"](wrapper,whatever,wrapper) end local t={ special=true,ns="",tg="@cd@",at={},rn="",dt={ whatever },__p__=e } setmetatable(t,getmetatable(e)) @@ -11148,6 +11176,99 @@ end -- of closure 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 + +if not modules then modules={} end modules ['trac-xml']={ + version=1.001, + comment="companion to trac-log.mkiv", + author="Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright="PRAGMA ADE / ConTeXt Development Team", + license="see context related readme files" +} +local formatters=string.formatters +local reporters=logs.reporters +local xmlserialize=xml.serialize +local xmlcollected=xml.collected +local xmltext=xml.text +local xmlfirst=xml.first +local function showhelp(specification,...) + local root=xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs=xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref",function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories=select("#",...)==0 and true or table.tohash {... } + local nofcategories=xml.count(root,"/application/flags/category") + local report=specification.report + for category in xmlcollected(root,"/application/flags/category") do + local categoryname=category.at.name or "" + if wantedcategories==true or wantedcategories[categoryname] then + if nofcategories>1 then + report("%s options:",categoryname) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for flag in xmlcollected(subcategory,"/flag") do + local name=flag.at.name + local value=flag.at.value + local short=xmltext(xmlfirst(flag,"/short")) + if value then + report("--%-24s %s",formatters["%s=%s"](name,value),short) + else + report("--%-24s %s",name,short) + end + end + report() + end + end + end + for category in xmlcollected(root,"/application/examples/category") do + local title=xmltext(xmlfirst(category,"/title")) + if title and title~="" then + report() + report(title) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for example in xmlcollected(subcategory,"/example") do + local command=xmltext(xmlfirst(example,"/command")) + local comment=xmltext(xmlfirst(example,"/comment")) + report(command) + end + report() + end + end +end +local reporthelp=reporters.help +local exporthelp=reporters.export +function reporters.help(t,...) + local helpinfo=t.helpinfo + if type(helpinfo)=="string" and string.find(helpinfo,"^<%?xml") then + showhelp(t,...) + else + reporthelp(t,...) + end +end +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) + else + reporters.lines(t,result) + end +end + + +end -- of closure + +do -- create closure to overcome 200 locals limit + package.loaded["data-ini"] = package.loaded["data-ini"] or true -- original size: 7898, stripped down to: 5501 @@ -15390,10 +15511,10 @@ end 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 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 +-- 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 : 636443 --- stripped bytes : 230487 +-- original bytes : 640903 +-- stripped bytes : 231417 -- end library merge @@ -15459,6 +15580,8 @@ local ownlibs = { -- order can be made better 'lxml-aux.lua', 'lxml-xml.lua', + 'trac-xml.lua', + 'data-ini.lua', 'data-exp.lua', 'data-env.lua', @@ -15603,59 +15726,85 @@ if not environment.experiments then environment.experiments = e_experiments end local instance = resolvers.reset() local helpinfo = [[ ---script run an mtx script (lua prefered method) (--noquotes), no script gives list ---execute run a script or program (texmfstart method) (--noquotes) ---resolve resolve prefixed arguments ---ctxlua run internally (using preloaded libs) ---internal run script using built in libraries (same as --ctxlua) ---locate locate given filename in database (default) or system (--first --all --detail) - ---autotree use texmf tree cf. env 'texmfstart_tree' or 'texmfstarttree' ---tree=pathtotree use given texmf tree (default file: 'setuptex.tmf') ---environment=name use given (tmf) environment file ---path=runpath go to given path before execution ---ifchanged=filename only execute when given file has changed (md checksum) ---iftouched=old,new only execute when given file has changed (time stamp) - ---makestubs create stubs for (context related) scripts ---removestubs remove stubs (context related) scripts ---stubpath=binpath paths where stubs wil be written ---windows create windows (mswin) stubs ---unix create unix (linux) stubs - ---verbose give a bit more info ---trackers=list enable given trackers ---progname=str format or backend - ---edit launch editor with found file ---launch (--all) launch files like manuals, assumes os support - ---timedrun run a script an time its run ---autogenerate regenerate databases if needed (handy when used to run context in an editor) - ---usekpse use kpse as fallback (when no mkiv and cache installed, often slower) ---forcekpse force using kpse (handy when no mkiv and cache installed but less functionality) - ---prefixes show supported prefixes - ---generate generate file database - ---variables show configuration variables ---configurations show configuration order - ---directives show (known) directives ---trackers show (known) trackers ---experiments show (known) experiments - ---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 - ---pattern=str filter variables +<?xml version="1.0" ?> +<application> + <metadata> + <entry name="name">mtxrun</entry> + <entry name="detail">ConTeXt TDS Runner Tool</entry> + <entry name="version">1.31</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="script"><short>run an mtx script (lua prefered method) (<ref name="noquotes"/>), no script gives list</short></flag> + <flag name="execute"><short>run a script or program (texmfstart method) (<ref name="noquotes"/>)</short></flag> + <flag name="resolve"><short>resolve prefixed arguments</short></flag> + <flag name="ctxlua"><short>run internally (using preloaded libs)</short></flag> + <flag name="internal"><short>run script using built in libraries (same as <ref name="ctxlua"/>)</short></flag> + <flag name="locate"><short>locate given filename in database (default) or system (<ref name="first"/> <ref name="all"/> <ref name="detail"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="autotree"><short>use texmf tree cf. env texmfstart_tree or texmfstarttree</short></flag> + <flag name="tree" value="pathtotree"><short>use given texmf tree (default file: setuptex.tmf)</short></flag> + <flag name="environment" value="name"><short>use given (tmf) environment file</short></flag> + <flag name="path" value="runpath"><short>go to given path before execution</short></flag> + <flag name="ifchanged" value="filename"><short>only execute when given file has changed (md checksum)</short></flag> + <flag name="iftouched" value="old,new"><short>only execute when given file has changed (time stamp)</short></flag> + </subcategory> + <subcategory> + <flag name="makestubs"><short>create stubs for (context related) scripts</short></flag> + <flag name="removestubs"><short>remove stubs (context related) scripts</short></flag> + <flag name="stubpath" value="binpath"><short>paths where stubs wil be written</short></flag> + <flag name="windows"><short>create windows (mswin) stubs</short></flag> + <flag name="unix"><short>create unix (linux) stubs</short></flag> + </subcategory> + <subcategory> + <flag name="verbose"><short>give a bit more info</short></flag> + <flag name="trackers" value="list"><short>enable given trackers</short></flag> + <flag name="progname" value="str"><short>format or backend</short></flag> + </subcategory> + <subcategory> + <flag name="edit"><short>launch editor with found file</short></flag> + <flag name="launch"><short>launch files like manuals, assumes os support (<ref name="all"/>)</short></flag> + </subcategory> + <subcategory> + <flag name="timedrun"><short>run a script an time its run</short></flag> + <flag name="autogenerate"><short>regenerate databases if needed (handy when used to run context in an editor)</short></flag> + </subcategory> + <subcategory> + <flag name="usekpse"><short>use kpse as fallback (when no mkiv and cache installed, often slower)</short></flag> + <flag name="forcekpse"><short>force using kpse (handy when no mkiv and cache installed but less functionality)</short></flag> + </subcategory> + <subcategory> + <flag name="prefixes"><short>show supported prefixes</short></flag> + </subcategory> + <subcategory> + <flag name="generate"><short>generate file database</short></flag> + </subcategory> + <subcategory> + <flag name="variables"><short>show configuration variables</short></flag> + <flag name="configurations"><short>show configuration order</short></flag> + </subcategory> + <subcategory> + <flag name="directives"><short>show (known) directives</short></flag> + <flag name="trackers"><short>show (known) trackers</short></flag> + <flag name="experiments"><short>show (known) experiments</short></flag> + </subcategory> + <subcategory> + <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> + </subcategory> + <subcategory> + <flag name="pattern" value="string"><short>filter variables</short></flag> + </subcategory> + </category> + </flags> +</application> ]] local application = logs.application { @@ -16617,6 +16766,11 @@ elseif e_argument("experiments") then experiments.show() +elseif e_argument("exporthelp") then + + runners.loadbase() + application.export(e_argument("exporthelp"),filename) + elseif e_argument("help") or filename=='help' or filename == "" then application.help() diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf Binary files differindex 172657701..45ca003ab 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex 029e973d8..71514b2c2 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua index 216dc16e8..2bb5844fc 100644 --- a/tex/context/base/lxml-tab.lua +++ b/tex/context/base/lxml-tab.lua @@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['lxml-tab'] = { local trace_entities = false trackers.register("xml.entities", function(v) trace_entities = v end) -local report_xml = logs and logs.reporter("xml","core") or function(...) print(format(...)) end +local report_xml = logs and logs.reporter("xml","core") or function(...) print(string.format(...)) end --[[ldx-- <p>The parser used here is inspired by the variant discussed in the lua book, but @@ -41,10 +41,11 @@ local xml = xml local concat, remove, insert = table.concat, table.remove, table.insert local type, next, setmetatable, getmetatable, tonumber = type, next, setmetatable, getmetatable, tonumber -local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub +local lower, find, match, gsub = string.lower, string.find, string.match, string.gsub local utfchar = utf.char local lpegmatch = lpeg.match local P, S, R, C, V, C, Cs = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.V, lpeg.C, lpeg.Cs +local formatters = string.formatters --[[ldx-- <p>First a hack to enable namespace resolving. A namespace is characterized by @@ -208,7 +209,7 @@ local function add_empty(spacing, namespace, tag) if #spacing > 0 then dt[#dt+1] = spacing end - local resolved = (namespace == "" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved = namespace == "" and xmlns[#xmlns] or nsremap[namespace] or namespace top = stack[#stack] dt = top.dt local t = { ns=namespace or "", rn=resolved, tg=tag, at=at, dt={}, __p__ = top } @@ -224,7 +225,7 @@ local function add_begin(spacing, namespace, tag) if #spacing > 0 then dt[#dt+1] = spacing end - local resolved = (namespace == "" and xmlns[#xmlns]) or nsremap[namespace] or namespace + local resolved = namespace == "" and xmlns[#xmlns] or nsremap[namespace] or namespace top = { ns=namespace or "", rn=resolved, tg=tag, at=at, dt={}, __p__ = stack[#stack] } setmetatable(top, mt) dt = top.dt @@ -239,9 +240,9 @@ local function add_end(spacing, namespace, tag) local toclose = remove(stack) top = stack[#stack] if #stack < 1 then - errorstr = format("nothing to close with %s %s", tag, xml.checkerror(top,toclose) or "") + errorstr = formatters["unable to close %s %s"](tag,xml.checkerror(top,toclose) or "") elseif toclose.tg ~= tag then -- no namespace check - errorstr = format("unable to close %s with %s %s", toclose.tg, tag, xml.checkerror(top,toclose) or "") + errorstr = formatters["unable to close %s with %s %s"](toclose.tg,tag,xml.checkerror(top,toclose) or "") end dt = top.dt dt[#dt+1] = toclose @@ -295,9 +296,9 @@ local function attribute_specification_error(str) end xml.placeholders = { - unknown_dec_entity = function(str) return (str == "" and "&error;") or format("&%s;",str) end, - unknown_hex_entity = function(str) return format("&#x%s;",str) end, - unknown_any_entity = function(str) return format("&#x%s;",str) end, + unknown_dec_entity = function(str) return str == "" and "&error;" or formatters["&%s;"](str) end, + unknown_hex_entity = function(str) return formatters["&#x%s;"](str) end, + unknown_any_entity = function(str) return formatters["&#x%s;"](str) end, } local placeholders = xml.placeholders @@ -307,7 +308,7 @@ local function fromhex(s) if n then return utfchar(n) else - return format("h:%s",s), true + return formatters["h:%s"](s), true end end @@ -316,7 +317,7 @@ local function fromdec(s) if n then return utfchar(n) else - return format("d:%s",s), true + return formatters["d:%s"](s), true end end @@ -680,8 +681,6 @@ local function _xmlconvert_(data, settings) resolve_predefined = true end -- ---~ inspect(settings) - -- stack, top, at, xmlns, errorstr = { }, { }, { }, { }, nil acache, hcache, dcache = { }, { }, { } -- not stored reported_attribute_errors = { } @@ -722,9 +721,9 @@ local function _xmlconvert_(data, settings) if errorhandler then local currentresource = settings.currentresource if currentresource and currentresource ~= "" then - xml.errorhandler(format("load error in [%s]: %s",currentresource,errorstr)) + xml.errorhandler(formatters["load error in [%s]: %s"](currentresource,errorstr)) else - xml.errorhandler(format("load error: %s",errorstr)) + xml.errorhandler(formatters["load error: %s"](errorstr)) end end end @@ -923,7 +922,7 @@ local function verbose_element(e,handlers) -- options local ats = eat and next(eat) and { } if ats then for k,v in next, eat do - ats[#ats+1] = format('%s=%q',k,escaped(v)) + ats[#ats+1] = formatters['%s=%q'](k,escaped(v)) end end if ern and trace_entities and ern ~= ens then @@ -1053,7 +1052,7 @@ end local handlers = { } local function newhandlers(settings) - local t = table.copy(handlers.verbose or { }) -- merge + local t = table.copy(handlers[settings and settings.parent or "verbose"] or { }) -- merge if settings then for k,v in next, settings do if type(v) == "table" then @@ -1177,7 +1176,7 @@ local xmlstringhandler = newhandlers { local function xmltostring(root) -- 25% overhead due to collecting if not root then return "" - elseif type(root) == 'string' then + elseif type(root) == "string" then return root else -- if next(root) then -- next is faster than type (and >0 test) return serialize(root,xmlstringhandler) or "" @@ -1315,7 +1314,7 @@ xml.tocdata(e,"error") function xml.tocdata(e,wrapper) -- a few more in the aux module local whatever = type(e) == "table" and xmltostring(e.dt) or e or "" if wrapper then - whatever = format("<%s>%s</%s>",wrapper,whatever,wrapper) + whatever = formatters["<%s>%s</%s>"](wrapper,whatever,wrapper) end local t = { special = true, ns = "", tg = "@cd@", at = { }, rn = "", dt = { whatever }, __p__ = e } setmetatable(t,getmetatable(e)) diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua index f7de100b2..112f62751 100644 --- a/tex/context/base/lxml-tex.lua +++ b/tex/context/base/lxml-tex.lua @@ -750,37 +750,37 @@ function lxml.main(id) xmlserialize(getid(id),xmltexhandler) -- the real root (@rt@) end ---~ -- lines (untested) ---~ ---~ local buffer = { } ---~ ---~ local xmllinescapture = ( ---~ newline^2 / function() buffer[#buffer+1] = "" end + ---~ newline / function() buffer[#buffer] = buffer[#buffer] .. " " end + ---~ content / function(s) buffer[#buffer] = buffer[#buffer] .. s end ---~ )^0 ---~ ---~ local xmllineshandler = table.copy(xmltexhandler) ---~ ---~ xmllineshandler.handle = function(...) lpegmatch(xmllinescapture,concat{ ... }) end ---~ ---~ function lines(root) ---~ if not root then ---~ -- rawroot = false ---~ -- quit ---~ elseif type(root) == 'string' then ---~ -- rawroot = false ---~ lpegmatch(xmllinescapture,root) ---~ elseif next(root) then -- tr == 'table' ---~ xmlserialize(root,xmllineshandler) ---~ end ---~ end ---~ ---~ function xml.lines(root) -- used at all? ---~ buffer = { "" } ---~ lines(root) ---~ return result ---~ end +-- -- lines (untested) +-- +-- local buffer = { } +-- +-- local xmllinescapture = ( +-- newline^2 / function() buffer[#buffer+1] = "" end + +-- newline / function() buffer[#buffer] = buffer[#buffer] .. " " end + +-- content / function(s) buffer[#buffer] = buffer[#buffer] .. s end +-- )^0 +-- +-- local xmllineshandler = table.copy(xmltexhandler) +-- +-- xmllineshandler.handle = function(...) lpegmatch(xmllinescapture,concat{ ... }) end +-- +-- function lines(root) +-- if not root then +-- -- rawroot = false +-- -- quit +-- elseif type(root) == 'string' then +-- -- rawroot = false +-- lpegmatch(xmllinescapture,root) +-- elseif next(root) then -- tr == 'table' +-- xmlserialize(root,xmllineshandler) +-- end +-- end +-- +-- function xml.lines(root) -- used at all? +-- buffer = { "" } +-- lines(root) +-- return result +-- end local function to_text(e) if e.command == nil then diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex aa7450545..d1d5c4328 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex 44d672007..b97167234 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index 32ae00cd3..cf41da58c 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -4541,6 +4541,18 @@ return { }, { category = "lua", + filename = "trac-xml", + loading = "mtxrun", + status = "okay", + }, + { + category = "lua", + filename = "trac-exp", + loading = "mtxrun", + status = "okay", + }, + { + category = "lua", comment = "experimental code, will be redone when lua 5.2", filename = "trac-pro", loading = "luat-lib", diff --git a/tex/context/base/trac-exp.lua b/tex/context/base/trac-exp.lua new file mode 100644 index 000000000..d1ce3c458 --- /dev/null +++ b/tex/context/base/trac-exp.lua @@ -0,0 +1,190 @@ +if not modules then modules = { } end modules ['trac-exp'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local formatters = string.formatters +local reporters = logs.reporters +local xmlserialize = xml.serialize +local xmlcollected = xml.collected +local xmltext = xml.text +local xmlfirst = xml.first +local xmlfilter = xml.filter + +-- there is no need for a newhandlers { name = "help", parent = "string" } + +local function flagdata(flag) + local name = flag.at.name or "" + local value = flag.at.value or "" + -- local short = xmlfirst(s,"/short") + -- local short = xmlserialize(short,xs) + local short = xmltext(xmlfirst(flag,"/short")) or "" + return name, value, short +end + +local function exampledata(example) + local command = xmltext(xmlfirst(example,"/command")) or "" + local comment = xmltext(xmlfirst(example,"/comment")) or "" + return command, comment +end + +local function categorytitle(category) + return xmltext(xmlfirst(category,"/title")) or "" +end + +local exporters = { } + +exporters.man = function(specification,...) + local root = xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs = xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories = select("#",...) == 0 and true or table.tohash { ... } + local nofcategories = xml.count(root,"/application/flags/category") + local name = xmlfilter(root,"/application/metadata/entry[@name='name']/text()") + local detail = xmlfilter(root,"/application/metadata/entry[@name='detail']/text()") or name + local version = xmlfilter(root,"/application/metadata/entry[@name='version']/text()") or "0.00" + local banner = specification.banner or detail or name + -- + local result = { } + -- + result[#result+1] = formatters['.TH %s\n.SH "NAME"\n%s.SH "SYNOPSIS"\n\\fB%s\\fP [ \\fIOPTIONS\\fP ... ]\n.SH "DESCRIPTION"\n%s\n']( + banner,name,name,detail + ) + for category in xmlcollected(root,"/application/flags/category") do + if nofcategories > 1 then + result[#result+1] = formatters['.SH "OPTIONS: %s"'](string.upper(category.at.name or "all")) + else + result[#result+1] = '.SH "OPTIONS"' + end + for subcategory in xmlcollected(category,"/subcategory") do + for flag in xmlcollected(subcategory,"/flag") do + local name, value, short = flagdata(flag) + if value == "" then + result[#result+1] = formatters[".TP\n.B --%s\n%s"](name,short) + else + result[#result+1] = formatters[".TP\n.B --%s=%s\n%s"](name,value,short) + end + end + end + end + result[#result+1] = formatters['.SH "AUTHOR"\n%s'](specification.moreinfo) + return table.concat(result,"\n") +end + +local craptemplate = [[ +<?xml version="1.0"?> +<application> +<metadata> +<entry name="banner">%s</entry> +</metadata> +<verbose> +%s +</verbose> +]] + +exporters.xml = function(specification,...) + local helpinfo = specification.helpinfo + if type(helpinfo) == "string" then + if string.find(helpinfo,"^<%?xml") then + return helpinfo + end + elseif type(helpinfo) == "table" then + helpinfo = table.concat(helpinfo,"\n\n") + else + helpinfo = "no help" + end + return formatters[craptemplate](specification.banner or "?",helpinfo) +end + +local bodytemplate = [[ +<h1>Command line options</h1> +<table> + <tr> + <th style="width: 10em">flag</th> + <th style="width: 8em">value</th> + <th>description</th> + </tr> + <?lua + for category in xml.collected(variables.root,"/application/flags/category") do + if variables.nofcategories > 1 then + ?><tr><th colspan="3"><?lua inject(category.at.name) ?></td></tr><?lua + end + for subcategory in xml.collected(category,"/subcategory") do + ?><tr><th/><td/><td/></tr><?lua + for flag in xml.collected(subcategory,"/flag") do + local name, value, short = variables.flagdata(flag) + ?> + <tr> + <th>--<?lua inject(name) ?></th> + <td><?lua inject(value) ?></td> + <td><?lua inject(short) ?></td> + </tr> + <?lua + end + end + end + ?> +</table> +<?lua + ?><br/><?lua + for category in xml.collected(variables.root,"/application/examples/category") do + local title = variables.categorytitle(category) + if title ~= "" then + ?><h1><?lua inject(title)?></h1><?lua + end + for subcategory in xml.collected(category,"/subcategory") do + for example in xml.collected(subcategory,"/example") do + local command, comment = variables.exampledata(example) + ?><tt><?lua inject(command) ?></tt><br/><?lua + end + ?><br/><?lua + end + end +?> +]] + +exporters.html = function(specification,...) + local root = xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs = xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories = select("#",...) == 0 and true or table.tohash { ... } + local nofcategories = xml.count(root,"/application/flags/category") + local name = xmlfilter(root,"/application/metadata/entry[@name='name']/text()") + local detail = xmlfilter(root,"/application/metadata/entry[@name='detail']/text()") or name + local version = xmlfilter(root,"/application/metadata/entry[@name='version']/text()") or "0.00" + local banner = specification.banner or detail or name + -- + dofile(resolvers.findfile("trac-lmx.lua","tex")) + -- + local htmltemplate = io.loaddata(resolvers.findfile("context-base.lmx","tex")) or "no template" + -- + local body = lmx.convertstring(bodytemplate, { + nofcategories = nofcategories, + wantedcategories = wantedcategories, + root = root, + -- moreinfo = specification.moreinfo, + flagdata = flagdata, + exampledata = exampledata, + categorytitle = categorytitle, + }) + local html = lmx.convertstring(htmltemplate, { + maintext = body, + title = banner, + bottomtext = "wiki: http://contextgarden.net | mail: ntg-context@ntg.nl | website: http://www.pragma-ade.nl", + }) + -- + return html +end + +logs.exporters = exporters diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 0b229c306..4f1d9ac01 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -84,7 +84,7 @@ local logs = logs local moreinfo = [[ More information about ConTeXt and the tools that come with it can be found at: - +]] .. "\n" .. [[ maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net wiki : http://contextgarden.net @@ -633,11 +633,26 @@ function logs.help () end -- obsolete -- applications +-- local function reportlines(t,str) +-- if str then +-- for line in gmatch(str,"([^\n\r]*)[\n\r]") do +-- t.report(line) +-- end +-- end +-- end + +local Carg, C, lpegmatch = lpeg.Carg, lpeg.C, lpeg.match +local p_newline = lpeg.patterns.newline + +local linewise = ( + Carg(1) * C((1-p_newline)^1) / function(t,s) t.report(s) end + + Carg(1) * p_newline^2 / function(t) t.report() end + + p_newline +)^1 + local function reportlines(t,str) if str then - for line in gmatch(str,"(.-)[\n\r]") do - t.report(line) - end + lpegmatch(linewise,str,1,t) end end @@ -661,8 +676,7 @@ local function reporthelp(t,...) if type(helpinfo) == "string" then reportlines(t,helpinfo) elseif type(helpinfo) == "table" then - local n = select("#",...) - for i=1,n do + for i=1,select("#",...) do reportlines(t,t.helpinfo[select(i,...)]) if i < n then t.report() @@ -673,16 +687,43 @@ end local function reportinfo(t) t.report() - reportlines(t,moreinfo) + reportlines(t,t.moreinfo) +end + +local function reportexport(t,method) + report(t.helpinfo) end +local reporters = { + lines = reportlines, -- not to be overloaded + banner = reportbanner, + version = reportversion, + help = reporthelp, + info = reportinfo, + export = reportexport, +} + +logs.reporters = reporters + function logs.application(t) t.name = t.name or "unknown" t.banner = t.banner + t.moreinfo = moreinfo t.report = logs.reporter(t.name) - t.help = function(...) reportbanner(t) ; reporthelp(t,...) ; reportinfo(t) end - t.identify = function() reportbanner(t) end - t.version = function() reportversion(t) end + t.help = function(...) + reporters.banner(t) + reporters.help(t,...) + reporters.info(t) + end + t.export = function(...) + reporters.export(t,...) + end + t.identify = function() + reporters.banner(t) + end + t.version = function() + reporters.version(t) + end return t end diff --git a/tex/context/base/trac-xml.lua b/tex/context/base/trac-xml.lua new file mode 100644 index 000000000..e44f3c399 --- /dev/null +++ b/tex/context/base/trac-xml.lua @@ -0,0 +1,92 @@ +if not modules then modules = { } end modules ['trac-xml'] = { + version = 1.001, + comment = "companion to trac-log.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local formatters = string.formatters +local reporters = logs.reporters +local xmlserialize = xml.serialize +local xmlcollected = xml.collected +local xmltext = xml.text +local xmlfirst = xml.first + +-- there is no need for a newhandlers { name = "help", parent = "string" } + +local function showhelp(specification,...) + local root = xml.convert(specification.helpinfo or "") + if not root then + return + end + local xs = xml.gethandlers("string") + xml.sethandlersfunction(xs,"short",function(e,handler) xmlserialize(e.dt,handler) end) + xml.sethandlersfunction(xs,"ref", function(e,handler) handler.handle("--"..e.at.name) end) + local wantedcategories = select("#",...) == 0 and true or table.tohash { ... } + local nofcategories = xml.count(root,"/application/flags/category") + local report = specification.report + for category in xmlcollected(root,"/application/flags/category") do + local categoryname = category.at.name or "" + if wantedcategories == true or wantedcategories[categoryname] then + if nofcategories > 1 then + report("%s options:",categoryname) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for flag in xmlcollected(subcategory,"/flag") do + local name = flag.at.name + local value = flag.at.value + -- local short = xmlfirst(s,"/short") + -- local short = xmlserialize(short,xs) + local short = xmltext(xmlfirst(flag,"/short")) + if value then + report("--%-24s %s",formatters["%s=%s"](name,value),short) + else + report("--%-24s %s",name,short) + end + end + report() + end + end + end + for category in xmlcollected(root,"/application/examples/category") do + local title = xmltext(xmlfirst(category,"/title")) + if title and title ~= "" then + report() + report(title) + report() + end + for subcategory in xmlcollected(category,"/subcategory") do + for example in xmlcollected(subcategory,"/example") do + local command = xmltext(xmlfirst(example,"/command")) + local comment = xmltext(xmlfirst(example,"/comment")) + report(command) + end + report() + end + end +end + +local reporthelp = reporters.help +local exporthelp = reporters.export + +function reporters.help(t,...) + local helpinfo = t.helpinfo + if type(helpinfo) == "string" and string.find(helpinfo,"^<%?xml") then + showhelp(t,...) + else + reporthelp(t,...) + end +end + +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) + else + reporters.lines(t,result) + end +end diff --git a/tex/context/base/util-mrg.lua b/tex/context/base/util-mrg.lua index 97a02e7cf..78b23dcbb 100644 --- a/tex/context/base/util-mrg.lua +++ b/tex/context/base/util-mrg.lua @@ -132,7 +132,7 @@ local function self_compact(data) if merger.strip_comment then local before = #data data = lpegmatch(compact,data) - data = lpegmatch(strip,data) + data = lpegmatch(strip,data) -- also strips in longstrings ... alas -- data = string.strip(data) local after = #data delta = before - after |