diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-12-02 12:05:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-12-02 12:05:00 +0100 |
commit | f0515ed4b1a731629538988c70d8309f44391bf2 (patch) | |
tree | 807746fe9712e126dd7fc32f8c1864b420399a63 /scripts | |
parent | 85d005e999920a82d104e89012385adb864d7a10 (diff) | |
download | context-f0515ed4b1a731629538988c70d8309f44391bf2.tar.gz |
beta 2010.12.02 12:05
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtx-interface.lua | 23 | ||||
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 1 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 1 | ||||
-rwxr-xr-x | scripts/context/stubs/unix/mtxrun | 1 |
4 files changed, 26 insertions, 0 deletions
diff --git a/scripts/context/lua/mtx-interface.lua b/scripts/context/lua/mtx-interface.lua index ed0792d32..9659dce90 100644 --- a/scripts/context/lua/mtx-interface.lua +++ b/scripts/context/lua/mtx-interface.lua @@ -300,6 +300,24 @@ function scripts.interface.context() end end +function scripts.interface.preprocess() + require("luat-mac.lua") + local newsuffix = environment.argument("suffix") or "tex" + local force = environment.argument("force") + for i=1,#environment.files do + local oldname = environment.files[i] + local newname = file.replacesuffix(oldname,newsuffix) + if oldname == newname then + logs.simple("skipping '%s' because old and new name are the same",oldname) + elseif io.exists(newname) and not force then + logs.simple("skipping '%s' because new file exists, use --force",oldname) + else + logs.simple("processing '%s' into '%s'",oldname,newname) + io.savedata(newname,resolvers.macros.preprocessed(io.loaddata(oldname))) + end + end +end + function scripts.interface.messages() local filename = resolvers.findfile(environment.files[1] or "mult-mes.lua") or "" if filename ~= "" then @@ -338,6 +356,9 @@ messages.help = [[ --raw report commands to the console --check generate check file --context generate context definition files +--preprocess preprocess mkvi files to tex files [force,suffix] +--suffix use given suffix for output files +--force force action even when in doubt --messages generate context message files ]] @@ -345,6 +366,8 @@ local ea = environment.argument if ea("context") then scripts.interface.context() +elseif ea("preprocess") then + scripts.interface.preprocess() elseif ea("messages") then scripts.interface.messages() elseif ea("scite") or ea("bbedit") or ea("jedit") or ea("textpad") or ea("text") or ea("raw") then diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index bb16aaec0..a80e4c730 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -13906,6 +13906,7 @@ function runners.execute_program(fullname) return true elseif state == "run" then local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end environment.initializearguments(after) fullname = fullname:gsub("^bin:","") local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index bb16aaec0..a80e4c730 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -13906,6 +13906,7 @@ function runners.execute_program(fullname) return true elseif state == "run" then local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end environment.initializearguments(after) fullname = fullname:gsub("^bin:","") local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index bb16aaec0..a80e4c730 100755 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -13906,6 +13906,7 @@ function runners.execute_program(fullname) return true elseif state == "run" then local before, after = environment.splitarguments(fullname) + for k=1,#after do after[k] = resolvers.resolve(after[k]) end environment.initializearguments(after) fullname = fullname:gsub("^bin:","") local command = fullname .. " " .. (environment.reconstructcommandline(after or "",noquote) or "") |