mtx-mk-help.lua /size: 18 Kb    last modification: 2020-07-01 14:35
1if not modules then modules = { } end modules ['mtx-mk-help'] = {
2    version   = 1.001,
3    comment   = "a script for making help files",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9--[[
10
11mtxrun                             --exporthelp=all %targetpath%\mkiv\mtxrun.tmp
12context                            --exporthelp=all %targetpath%\mkiv\context.tmp
13mtxrun --script context            --exporthelp=all %targetpath%\mkiv\mtx-context.tmp
14
15mtxrun --script babel              --exporthelp=all %targetpath%\mkiv\mtx-babel.tmp
16mtxrun --script base               --exporthelp=all %targetpath%\mkiv\mtx-base.tmp
17mtxrun --script cache              --exporthelp=all %targetpath%\mkiv\mtx-cache.tmp
18mtxrun --script chars              --exporthelp=all %targetpath%\mkiv\mtx-chars.tmp
19mtxrun --script check              --exporthelp=all %targetpath%\mkiv\mtx-check.tmp
20mtxrun --script colors             --exporthelp=all %targetpath%\mkiv\mtx-colors.tmp
21mtxrun --script convert            --exporthelp=all %targetpath%\mkiv\mtx-convert.tmp
22mtxrun --script epub               --exporthelp=all %targetpath%\mkiv\mtx-epub.tmp
23mtxrun --script fcd                --exporthelp=all %targetpath%\mkiv\mtx-fcd.tmp
24mtxrun --script flac               --exporthelp=all %targetpath%\mkiv\mtx-flac.tmp
25mtxrun --script fonts              --exporthelp=all %targetpath%\mkiv\mtx-fonts.tmp
26mtxrun --script grep               --exporthelp=all %targetpath%\mkiv\mtx-grep.tmp
27mtxrun --script interface          --exporthelp=all %targetpath%\mkiv\mtx-interface.tmp
28mtxrun --script metapost           --exporthelp=all %targetpath%\mkiv\mtx-metapost.tmp
29mtxrun --script metatex            --exporthelp=all %targetpath%\mkiv\mtx-metatex.tmp
30mtxrun --script modules            --exporthelp=all %targetpath%\mkiv\mtx-modules.tmp
31mtxrun --script mtxworks           --exporthelp=all %targetpath%\mkiv\mtx-mtxworks.tmp
32mtxrun --script package            --exporthelp=all %targetpath%\mkiv\mtx-package.tmp
33mtxrun --script patterns           --exporthelp=all %targetpath%\mkiv\mtx-patterns.tmp
34mtxrun --script pdf                --exporthelp=all %targetpath%\mkiv\mtx-pdf.tmp
35mtxrun --script profile            --exporthelp=all %targetpath%\mkiv\mtx-profile.tmp
36mtxrun --script rsync              --exporthelp=all %targetpath%\mkiv\mtx-rsync.tmp
37mtxrun --script scite              --exporthelp=all %targetpath%\mkiv\mtx-scite.tmp
38mtxrun --script server             --exporthelp=all %targetpath%\mkiv\mtx-server.tmp
39mtxrun --script texworks           --exporthelp=all %targetpath%\mkiv\mtx-texworks.tmp
40mtxrun --script timing             --exporthelp=all %targetpath%\mkiv\mtx-timing.tmp
41mtxrun --script tools              --exporthelp=all %targetpath%\mkiv\mtx-tools.tmp
42mtxrun --script unzip              --exporthelp=all %targetpath%\mkiv\mtx-unzip.tmp
43mtxrun --script update             --exporthelp=all %targetpath%\mkiv\mtx-update.tmp
44mtxrun --script watch              --exporthelp=all %targetpath%\mkiv\mtx-watch.tmp
45
46mtxrun --script mk-help luatools   --exporthelp=all %targetpath%\mkiv\luatools.tmp
47
48mtxrun --script mk-help texmfstart --exporthelp=all %targetpath%\mkii\texmfstart.tmp
49mtxrun --script mk-help texexec    --exporthelp=all %targetpath%\mkii\texexec.tmp
50mtxrun --script mk-help texutil    --exporthelp=all %targetpath%\mkii\texutil.tmp
51mtxrun --script mk-help ctxtools   --exporthelp=all %targetpath%\mkii\ctxtools.tmp
52mtxrun --script mk-help textools   --exporthelp=all %targetpath%\mkii\textools.tmp
53mtxrun --script mk-help pdftools   --exporthelp=all %targetpath%\mkii\pdftools.tmp
54mtxrun --script mk-help tmftools   --exporthelp=all %targetpath%\mkii\tmftools.tmp
55mtxrun --script mk-help xmltools   --exporthelp=all %targetpath%\mkii\xmltools.tmp
56mtxrun --script mk-help pstopdf    --exporthelp=all %targetpath%\mkii\pstopdf.tmp
57mtxrun --script mk-help rlxtools   --exporthelp=all %targetpath%\mkii\rlxtools.tmp
58mtxrun --script mk-help imgtopdf   --exporthelp=all %targetpath%\mkii\imgtopdf.tmp
59
60]]--
61
62local helpinfo = os.resultof("mtxrun --exporthelp") or ""
63local helpinfo = string.match(helpinfo,[[^.-(<application>.-</application>)]]) or [[<application></application>]]
64
65local texmfstart = logs.application {
66    name     = "texmfstart",
67    banner   = "texmfstart 7.0.0",
68    helpinfo = [[<?xml version="1.0"?>]] .. helpinfo,
69}
70
71-- let's also put luatools here:
72
73local helpinfo = os.resultof("luatools --exporthelp") or ""
74local helpinfo = string.match(helpinfo,[[^.-(<application>.-</application>)]]) or [[<application></application>]]
75local helpinfo = string.gsub(helpinfo,"mtx%-base","luatools")
76
77local luatools = logs.application {
78    name     = "luatools",
79    banner   = "luatools 1.35",
80    helpinfo = [[<?xml version="1.0"?>]] .. helpinfo,
81}
82
83--
84
85local helpinfo = [[
86<?xml version="1.0"?>
87<application>
88 <metadata>
89  <entry name="name">texexec</entry>
90  <entry name="detail">TeXExec</entry>
91  <entry name="version">6.2.1</entry>
92 </metadata>
93 <flags>
94  <category name="basic">
95   <subcategory>
96    <flag name="make"><short>make formats</short></flag>
97    <flag name="check"><short>check versions</short></flag>
98    <flag name="process"><short>process file</short></flag>
99    <flag name="mptex"><short>process mp file</short></flag>
100    <flag name="mpxtex"><short>process mpx file</short></flag>
101    <flag name="mpgraphic"><short>process mp file to stand-alone graphics</short></flag>
102    <flag name="mpstatic"><short>process mp/ctx file to stand-alone graphics</short></flag>
103    <flag name="listing"><short>list of file content</short></flag>
104    <flag name="figures"><short>generate overview of figures</short></flag>
105    <flag name="modules"><short>generate module documentation</short></flag>
106    <flag name="pdfarrange"><short>impose pages (booklets)</short></flag>
107    <flag name="pdfselect"><short>select pages from file(s)</short></flag>
108    <flag name="pdfcopy"><short>copy pages from file(s)</short></flag>
109    <flag name="pdftrim"><short>trim pages from file(s)</short></flag>
110    <flag name="pdfcombine"><short>combine multiple pages</short></flag>
111    <flag name="pdfsplit"><short>split file in pages</short></flag>
112   </subcategory>
113  </category>
114 </flags>
115</application>
116]]
117
118local texexec = logs.application {
119    name     = "texexec",
120    banner   = "TeXExec 6.2.1",
121    helpinfo = helpinfo,
122}
123
124local helpinfo = [[
125<?xml version="1.0"?>
126<application>
127 <metadata>
128  <entry name="name">texutil</entry>
129  <entry name="detail">TeXUtil</entry>
130  <entry name="version">9.1.0</entry>
131 </metadata>
132 <flags>
133  <category name="basic">
134   <subcategory>
135    <flag name="references"><short>convert tui file into tuo file</short></flag>
136    <flag name="figures"><short>generate figure dimensions file</short></flag>
137    <flag name="logfile"><short>filter essential log messages</short></flag>
138    <flag name="purgefiles"><short>remove most temporary files</short></flag>
139    <flag name="purgeallfiles"><short>remove all temporary files</short></flag>
140    <flag name="documentation"><short>generate documentation file from source</short></flag>
141    <flag name="analyzefile"><short>analyze pdf file</short></flag>
142   </subcategory>
143  </category>
144 </flags>
145</application>]]
146
147local texutil = logs.application {
148    name     = "texutil",
149    banner   = "TeXUtil 9.1.0",
150    helpinfo = helpinfo,
151}
152
153local helpinfo = [[
154<?xml version="1.0"?>
155<application>
156 <metadata>
157  <entry name="name">ctxtools</entry>
158  <entry name="detail">CtxTools</entry>
159  <entry name="version">1.3.5</entry>
160 </metadata>
161 <flags>
162  <category name="basic">
163   <subcategory>
164    <flag name="touchcontextfile"><short>update context version</short></flag>
165    <flag name="contextversion"><short>report context version</short></flag>
166    <flag name="jeditinterface"><short>generate jedit syntax files [<ref name="pipe]"/></short></flag>
167    <flag name="bbeditinterface"><short>generate bbedit syntax files [<ref name="pipe]"/></short></flag>
168    <flag name="sciteinterface"><short>generate scite syntax files [<ref name="pipe]"/></short></flag>
169    <flag name="rawinterface"><short>generate raw syntax files [<ref name="pipe]"/></short></flag>
170    <flag name="translateinterface"><short>generate interface files (xml) [nl de ..]</short></flag>
171    <flag name="purgefiles"><short>remove temporary files [<ref name="all"/> <ref name="recurse]"/> [basename]</short></flag>
172    <flag name="documentation  generate documentation [--type" value="]"><short>[filename]</short></flag>
173    <flag name="filterpages'"><short>) # no help, hidden temporary feature</short></flag>
174    <flag name="dpxmapfiles"><short>convert pdftex mapfiles to dvipdfmx [<ref name="force]"/> [texmfroot]</short></flag>
175    <flag name="listentities"><short>create doctype entity definition from enco-uc.tex</short></flag>
176    <flag name="brandfiles"><short>add context copyright notice [<ref name="force]"/></short></flag>
177    <flag name="platformize"><short>replace line-endings [<ref name="recurse"/> <ref name="force]"/> [pattern]</short></flag>
178    <flag name="dependencies  analyze depedencies within context [--save --compact --filter" value="[macros|filenames] ]"><short>[filename]</short></flag>
179    <flag name="updatecontext"><short>download latest version and remake formats [<ref name="proxy]"/></short></flag>
180    <flag name="disarmutfbom"><short>remove utf bom [<ref name="force]"/></short></flag>
181   </subcategory>
182  </category>
183 </flags>
184</application>
185]]
186
187local ctxtools = logs.application {
188    name     = "ctxtools",
189    banner   = "CtxTools 1.3.5",
190    helpinfo = helpinfo,
191}
192
193local helpinfo = [[
194<?xml version="1.0"?>
195<application>
196 <metadata>
197  <entry name="name">textools</entry>
198  <entry name="detail">TeXTools</entry>
199  <entry name="version">1.3.1</entry>
200 </metadata>
201 <flags>
202  <category name="basic">
203   <subcategory>
204    <flag name="removemapnames"><short>[pattern]   [<ref name="recurse]"/></short></flag>
205    <flag name="restoremapnames"><short>[pattern]   [<ref name="recurse]"/></short></flag>
206    <flag name="hidemapnames"><short>[pattern]   [<ref name="recurse]"/></short></flag>
207    <flag name="videmapnames"><short>[pattern]   [<ref name="recurse]"/></short></flag>
208    <flag name="findfile"><short>filename    [<ref name="recurse]"/></short></flag>
209    <flag name="unzipfiles"><short>[pattern]   [<ref name="recurse]"/></short></flag>
210    <flag name="fixafmfiles"><short>[pattern]   [<ref name="recurse]"/></short></flag>
211    <flag name="mactodos"><short>[pattern]   [<ref name="recurse]"/></short></flag>
212    <flag name="fixtexmftrees"><short>[texmfroot] [<ref name="force]"/></short></flag>
213    <flag name="replacefile"><short>filename    [<ref name="force]"/></short></flag>
214    <flag name="updatetree"><short>fromroot toroot [<ref name="force"/> <ref name="nocheck"/> <ref name="merge"/> <ref name="delete]"/></short></flag>
215    <flag name="downcasefilenames"><short>[<ref name="recurse]"/> [<ref name="force]"/></short></flag>
216    <flag name="stripformfeeds"><short>[<ref name="recurse]"/> [<ref name="force]"/></short></flag>
217    <flag name="showfont"><short>filename</short></flag>
218    <flag name="encmake"><short>afmfile encodingname</short></flag>
219    <flag name="tpmmake"><short>tpm file (run in texmf root)</short></flag>
220   </subcategory>
221  </category>
222 </flags>
223</application>
224]]
225
226local textools = logs.application {
227    name     = "textools",
228    banner   = "TeXTools 1.3.1",
229    helpinfo = helpinfo,
230}
231
232local helpinfo = [[
233<?xml version="1.0"?>
234<application>
235 <metadata>
236  <entry name="name">pdftools</entry>
237  <entry name="detail">PDFTools</entry>
238  <entry name="version">1.2.1</entry>
239 </metadata>
240 <flags>
241  <category name="basic">
242   <subcategory>
243    <flag name="spotimage  filename --colorspec" value=""><short><ref name="colorname="/>  [<ref name="retain"/> <ref name="invert"/> <ref name="subpath=]"/></short></flag>
244    <flag name="colorimage  filename --colorspec" value=""><short>[<ref name="retain"/> <ref name="invert"/> <ref name="colorname="/> ]</short></flag>
245    <flag name="convertimage"><short>filename [<ref name="retain"/> <ref name="subpath]"/></short></flag>
246    <flag name="downsampleimage"><short>filename [<ref name="retain"/> <ref name="subpath"/> <ref name="lowres"/> <ref name="normal]"/></short></flag>
247    <flag name="info"><short>filename</short></flag>
248    <flag name="countpages"><short>[<ref name="pattern"/> <ref name="threshold]"/></short></flag>
249    <flag name="checkembedded"><short>[<ref name="pattern]"/></short></flag>
250    <flag name="analyzefile"><short>filename</short></flag>
251   </subcategory>
252  </category>
253 </flags>
254</application>
255]]
256
257local pdftools = logs.application {
258    name     = "pdftools",
259    banner   = "PDFTools 1.2.1",
260    helpinfo = helpinfo,
261}
262
263local helpinfo = [[
264<?xml version="1.0"?>
265<application>
266 <metadata>
267  <entry name="name">tmftools</entry>
268  <entry name="detail">TMFTools</entry>
269  <entry name="version">1.1.0</entry>
270 </metadata>
271 <flags>
272  <category name="basic">
273   <subcategory>
274    <flag name="analyze"><short>[<ref name="strict"/> <ref name="sort"/> <ref name="rootpath"/> <ref name="treepath"/> <ref name="delete"/> <ref name="force"/>] [pattern]</short></flag>
275   </subcategory>
276   <subcategory>
277    <flag name="serve"><short>act as kpse server</short></flag>
278   </subcategory>
279  </category>
280 </flags>
281</application>
282]]
283
284local tmftools = logs.application {
285    name     = "tmftools",
286    banner   = "TMFTools 1.2.1",
287    helpinfo = helpinfo,
288}
289
290local helpinfo = [[
291<?xml version="1.0"?>
292<application>
293 <metadata>
294  <entry name="name">xmltools</entry>
295  <entry name="detail">XMLTools</entry>
296  <entry name="version">1.2.2</entry>
297 </metadata>
298 <flags>
299  <category name="basic">
300   <subcategory>
301    <flag name="dir"><short>generate directory listing</short></flag>
302    <flag name="mmlpages"><short>generate graphic from mathml</short></flag>
303    <flag name="analyze"><short>report entities and elements [<ref name="utf"/> <ref name="process"/>]</short></flag>
304    <flag name="cleanup"><short>cleanup xml file [<ref name="force"/>]</short></flag>
305    <flag name="enhance"><short>enhance xml file (partial)</short></flag>
306    <flag name="filter"><short>filter elements from xml file [<ref name="element"/>]</short></flag>
307    <flag name="dir"><short>generate ddirectory listing</short></flag>
308   </subcategory>
309  </category>
310 </flags>
311</application>
312]]
313
314local xmltools = logs.application {
315    name     = "xmltools",
316    banner   = "XMLTools 1.2.1",
317    helpinfo = helpinfo,
318}
319
320local helpinfo = [[
321<?xml version="1.0"?>
322<application>
323 <metadata>
324  <entry name="name">pstopdf</entry>
325  <entry name="detail">PStoPDF</entry>
326  <entry name="version">2.0.1</entry>
327 </metadata>
328 <flags>
329  <category name="basic">
330   <subcategory>
331    <flag name="request"><short>handles exa request file</short></flag>
332    <flag name="watch"><short>watch folders for conversions (untested)</short></flag>
333   </subcategory>
334  </category>
335 </flags>
336</application>
337]]
338
339local pstopdf = logs.application {
340    name     = "pstopdf",
341    banner   = "PStoPDF 2.0.1",
342    helpinfo = helpinfo,
343}
344
345local helpinfo = [[
346<?xml version="1.0"?>
347<application>
348 <metadata>
349  <entry name="name">rlxtools</entry>
350  <entry name="detail">RlxTools</entry>
351  <entry name="version">1.0.1</entry>
352 </metadata>
353 <flags>
354  <category name="basic">
355   <subcategory>
356    <flag name="manipulate"><short>[<ref name="test]"/> manipulatorfile resourselog</short></flag>
357    <flag name="identify"><short>[<ref name="collect]"/> filename</short></flag>
358   </subcategory>
359  </category>
360 </flags>
361</application>
362]]
363
364local rlxtools = logs.application {
365    name     = "rlxtools",
366    banner   = "RlxTools 1.0.1",
367    helpinfo = helpinfo,
368}
369
370local helpinfo = [[
371<?xml version="1.0"?>
372<application>
373 <metadata>
374  <entry name="name">imgtopdf</entry>
375  <entry name="detail">ImgToPdf</entry>
376  <entry name="version">1.1.2</entry>
377 </metadata>
378 <flags>
379  <category name="basic">
380   <subcategory>
381    <flag name="convert"><short>convert image into pdf</short></flag>
382    <flag name="compression"><short>level of compression in percent</short></flag>
383    <flag name="depth"><short>image depth in bits</short></flag>
384    <flag name="colorspace"><short> colorspace (rgb,cmyk,gray)</short></flag>
385    <flag name="quality"><short>quality in percent</short></flag>
386    <flag name="inputpath"><short>path where files are looked for</short></flag>
387    <flag name="outputpath"><short>path where files end up</short></flag>
388    <flag name="auto"><short>determine settings automatically</short></flag>
389   </subcategory>
390  </category>
391 </flags>
392</application>
393]]
394
395local imgtopdf = logs.application {
396    name     = "imgtopdf",
397    banner   = "ImgToPdf 1.1.2",
398    helpinfo = helpinfo,
399}
400
401local helpinfo = [[
402<?xml version="1.0"?>
403<application>
404 <metadata>
405  <entry name="name">mptopdf</entry>
406  <entry name="detail">convert MetaPost figures to PDF</entry>
407  <entry name="version">1.4.1</entry>
408 </metadata>
409 <flags>
410  <category name="basic">
411   <subcategory>
412    <flag name="metafun"><short>use the metafun format to process the file (default is mpost)</short></flag>
413    <flag name="texexec"><short>use texexec (context) to process text snippets</short></flag>
414    <flag name="latex"><short>use latex to process text snippets</short></flag>
415   </subcategory>
416  </category>
417 </flags>
418</application>
419]]
420
421local mptopdf = logs.application {
422    name     = "mptopdf",
423    banner   = "MPtoPDF 1.4.1",
424    helpinfo = helpinfo,
425}
426
427-- texmfstart.rb   is normally replaced by mtxrun
428-- runtools.rb     is run from within context
429-- concheck.rb     is run from within editors
430-- texsync.rb      is no longer in the zip
431-- mpstools.rb     is no longer in the zip
432-- rscortool.rb    is only run indirectly
433-- rsfiltool.rb    is only run indirectly
434-- rslibtool.rb    is only run indirectly
435
436local application = logs.application {
437    name     = "mk-help",
438    banner   = "Mk Help generator 1.00",
439}
440
441local filename  = environment.files[1]
442
443if not filename then
444    application.report("no mk script given")
445    return
446end
447
448local mkapplication
449
450if     filename == "texmfstart" then mkapplication = texmfstart
451elseif filename == "luatools"   then mkapplication = luatools
452elseif filename == "texexec"    then mkapplication = texexec
453elseif filename == "texutil"    then mkapplication = texutil
454elseif filename == "ctxtools"   then mkapplication = ctxtools
455elseif filename == "textools"   then mkapplication = textools
456elseif filename == "pdftools"   then mkapplication = pdftools
457elseif filename == "tmftools"   then mkapplication = tmftools
458elseif filename == "xmltools"   then mkapplication = xmltools
459elseif filename == "pstopdf"    then mkapplication = pstopdf
460elseif filename == "rlxtools"   then mkapplication = rlxtools
461elseif filename == "imgtopdf"   then mkapplication = imgtopdf
462elseif filename == "mptopdf"    then mkapplication = mptopdf  end
463
464if not mkapplication then
465    application.report("no valid mk script given")
466    return
467end
468
469if environment.argument("exporthelp") then
470    mkapplication.export(environment.argument("exporthelp"),environment.files[2])
471else
472    mkapplication.help()
473end
474