diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-03-26 16:55:00 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-03-26 16:55:00 +0200 |
commit | 30ea6ac75b1cf62ea8e17228c07d54824285acfa (patch) | |
tree | 5a634b0c9ce533cd0da8652cf4db39a696310a3d /tex/context/modules/mkiv/m-asymptote.lua | |
parent | dc54cea46e02502b4474a0fa132466974a9cc19c (diff) | |
download | context-30ea6ac75b1cf62ea8e17228c07d54824285acfa.tar.gz |
2017-03-26 16:22:00
Diffstat (limited to 'tex/context/modules/mkiv/m-asymptote.lua')
-rw-r--r-- | tex/context/modules/mkiv/m-asymptote.lua | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua index 99efc4910..de8d032c8 100644 --- a/tex/context/modules/mkiv/m-asymptote.lua +++ b/tex/context/modules/mkiv/m-asymptote.lua @@ -14,25 +14,35 @@ local replacesuffix = file.replacesuffix moduledata.asymptote = { } sandbox.registerrunner { - name = "asymptote", + name = "asymptote prc", program = "asy", method = "execute", - template = '-noV -config="" -tex=pdflatex -outformat="prc" "%filename%"', - -- template = '-noV -config="" -tex=context -outformat="prc" "%filename%"', - checkers = { - filename = "readable", - } + template = '-noV -config="" -tex=context -outformat="prc" "%filename%"', + checkers = { filename = "readable" }, } -function moduledata.asympote.process(name) - local result = buffers.run( -- experimental - name, -- name of the buffer - false, -- no wrapping - "asymptote", -- name of the process - "prc" -- suffix of result - ) - parametersets[name] = { - js = replacesuffix(result,"js") - } - context(result) +sandbox.registerrunner { + name = "asymptote pdf", + program = "asy", + method = "execute", + template = '-noV -config="" -tex=context -outformat="pdf" "%filename%"', + checkers = { filename = "readable" }, +} + +function moduledata.asympote.process(name,type) + if type == "prc" then + local result = buffers.run(name,false,"asymptote prc","prc") + local jsdata = { js = replacesuffix(result,"js") } + local parset = parametersets[name] + if parset then + -- so we can overload at the tex end + setmetatableindex(parset,jsdata) + else + parametersets[name] = jsdata + end + context(result) + else + local result = buffers.run(name,false,"asymptote pdf","pdf") + context(result) + end end |