diff options
author | Taco Hoekwater <taco@elvenkind.com> | 2009-08-23 11:11:32 +0000 |
---|---|---|
committer | Taco Hoekwater <taco@elvenkind.com> | 2009-08-23 11:11:32 +0000 |
commit | 8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch) | |
tree | 3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/scripts/context/lua/mtx-metatex.lua | |
parent | 850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff) |
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-metatex.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-metatex.lua | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua b/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua new file mode 100644 index 00000000000..f8c871a7b1c --- /dev/null +++ b/Master/texmf-dist/scripts/context/lua/mtx-metatex.lua @@ -0,0 +1,69 @@ +if not modules then modules = { } end modules ['mtx-metatex'] = { + version = 1.001, + comment = "companion to mtxrun.lua", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- future versions will deal with specific variants of metatex + +scripts = scripts or { } +scripts.metatex = scripts.metatex or { } + +-- metatex + +function scripts.metatex.make() + local command = "luatools --make --compile metatex" + logs.simple("running command: %s",command) + os.spawn(command) +end + +--~ function scripts.metatex.run() +--~ local name = environment.files[1] or "" +--~ if name ~= "" then +--~ local command = "luatools --fmt=metatex " .. name +--~ logs.simple("running command: %s",command) +--~ os.spawn(command) +--~ end +--~ end + +function scripts.metatex.run(ctxdata,filename) + local filename = environment.files[1] or "" + if filename ~= "" then + local formatfile, scriptfile = resolvers.locate_format("metatex") + if formatfile and scriptfile then + local command = string.format("luatex --fmt=%s --lua=%s %s", + string.quote(formatfile), string.quote(scriptfile), string.quote(filename)) + logs.simple("running command: %s",command) + os.spawn(command) + elseif formatname then + logs.simple("error, no format found with name: %s",formatname) + else + logs.simple("error, no format found (provide formatname or interface)") + end + end +end + +function scripts.metatex.timed(action) + statistics.timed(action) +end + +logs.extendbanner("MetaTeX Tools 0.10",true) + +messages.help = [[ +--run process (one or more) files (default action) +--make create metatex format(s) +]] + +if environment.argument("run") then + scripts.metatex.timed(scripts.metatex.run) +elseif environment.argument("make") then + scripts.metatex.timed(scripts.metatex.make) +elseif environment.argument("help") then + logs.help(messages.help,false) +elseif environment.files[1] then + scripts.metatex.timed(scripts.metatex.run) +else + logs.help(messages.help,false) +end |