diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-05-14 19:58:50 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-05-14 19:58:50 +0200 |
commit | fd0c4577a4b6e85ca2db664906e1a03807ce133f (patch) | |
tree | fa23fcc04248d03ff82e34634b8ef1bb9cf28acb /tex/context/modules/mkiv/m-asymptote.lua | |
parent | db581096187dc2d3cbdbe4cdc39d247c168b1607 (diff) | |
download | context-fd0c4577a4b6e85ca2db664906e1a03807ce133f.tar.gz |
2017-05-14 19:15:00
Diffstat (limited to 'tex/context/modules/mkiv/m-asymptote.lua')
-rw-r--r-- | tex/context/modules/mkiv/m-asymptote.lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tex/context/modules/mkiv/m-asymptote.lua b/tex/context/modules/mkiv/m-asymptote.lua new file mode 100644 index 000000000..de8d032c8 --- /dev/null +++ b/tex/context/modules/mkiv/m-asymptote.lua @@ -0,0 +1,48 @@ +if not modules then modules = { } end modules ['m-asymptote'] = { + version = 1.001, + comment = "companion to m-pstricks.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- See m-asymptote.mkiv for some comment. + +local context = context +local replacesuffix = file.replacesuffix + +moduledata.asymptote = { } + +sandbox.registerrunner { + name = "asymptote prc", + program = "asy", + method = "execute", + template = '-noV -config="" -tex=context -outformat="prc" "%filename%"', + checkers = { filename = "readable" }, +} + +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 |