diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/lua/mtx-metapost.lua')
-rw-r--r-- | Master/texmf-dist/scripts/context/lua/mtx-metapost.lua | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua b/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua index 3b9ed6ff17e..08daec978dc 100644 --- a/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua +++ b/Master/texmf-dist/scripts/context/lua/mtx-metapost.lua @@ -7,19 +7,38 @@ if not modules then modules = { } end modules ['mtx-metapost'] = { -- this was m } local helpinfo = [[ ---rawmp raw metapost run ---metafun use metafun instead of plain ---latex force --tex=latex ---texexec force texexec usage (mkii) ---split split single result file into pages - -intended usage: - -mtxrun --script metapost yourfile.mp -mtxrun --script metapost --split yourfile.mp -mtxrun --script metapost yourfile.123 myfile.mps - -other usage resembles mptopdf.pl +<?xml version="1.0"?> +<application> + <metadata> + <entry name="name">mtx-metapost</entry> + <entry name="detail">MetaPost to PDF processor</entry> + <entry name="version">0.10</entry> + </metadata> + <flags> + <category name="basic"> + <subcategory> + <flag name="rawmp"><short>raw metapost run</short></flag> + <flag name="metafun"><short>use metafun instead of plain</short></flag> + <flag name="latex"><short>force <ref name="tex=latex"/></short></flag> + <flag name="texexec"><short>force texexec usage (mkii)</short></flag> + <flag name="split"><short>split single result file into pages</short></flag> + </subcategory> + </category> + </flags> + <examples> + <category> + <title>Examples</title> + <subcategory> + <example><command>mtxrun --script metapost yourfile.mp</command></example> + <example><command>mtxrun --script metapost --split yourfile.mp</command></example> + <example><command>mtxrun --script metapost yourfile.123 myfile.mps</command></example> + </subcategory> + </category> + </examples> + <comments> + <comment>other usage resembles mptopdf.pl</comment> + </comments> +</application> ]] local application = logs.application { @@ -49,7 +68,7 @@ local tempname = "mptopdf-temp.tex" local function do_convert(filename) if find(filename,".%d+$") or find(filename,"%.mps$") then io.savedata(tempname,format(template,filename)) - local resultname = format("%s-%s.pdf",file.nameonly(filename),file.extname(filename)) + local resultname = format("%s-%s.pdf",file.nameonly(filename),file.suffix(filename)) local result = os.execute(format([[context --once --batch --purge --result=%s "%s"]],resultname,tempname)) return lfs.isfile(resultname) and resultname end @@ -166,10 +185,12 @@ function scripts.mptopdf.convertall() end end -if environment.files[1] then +if environment.argument("exporthelp") then + application.export(environment.argument("exporthelp"),environment.files[1]) +elseif environment.files[1] then scripts.mptopdf.convertall() else - if not environment.arguments.help then + if not environment.argument("help") then report("provide MP output file (or pattern)") report() end |