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 | |
parent | dc54cea46e02502b4474a0fa132466974a9cc19c (diff) | |
download | context-30ea6ac75b1cf62ea8e17228c07d54824285acfa.tar.gz |
2017-03-26 16:22:00
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/mkii/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkii/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/buff-ini.lua | 73 | ||||
-rw-r--r-- | tex/context/base/mkiv/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-inc.mkiv | 140 | ||||
-rw-r--r-- | tex/context/base/mkiv/grph-u3d.lua | 3 | ||||
-rw-r--r-- | tex/context/base/mkiv/luat-run.lua | 8 | ||||
-rw-r--r-- | tex/context/base/mkiv/status-files.pdf | bin | 25637 -> 25664 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/status-lua.pdf | bin | 422699 -> 422697 bytes | |||
-rw-r--r-- | tex/context/base/mkiv/strc-ren.mkiv | 54 | ||||
-rw-r--r-- | tex/context/interface/mkiv/i-context.pdf | bin | 804374 -> 804294 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-readme.pdf | bin | 60772 -> 60771 bytes | |||
-rw-r--r-- | tex/context/interface/mkiv/i-section.xml | 4 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-asymptote.lua | 44 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-asymptote.mkiv | 43 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
17 files changed, 309 insertions, 70 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 2dd5d3783..515a20ad4 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.03.24 19:06} +\newcontextversion{2017.03.26 16:15} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 5c88b9193..0b8726e31 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2017.03.24 19:06} +\edef\contextversion{2017.03.26 16:15} %D For those who want to use this: diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index a2f8914ff..fd5b047af 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -490,8 +490,8 @@ implement { -- we can consider adding a size to avoid unlikely clashes -local oldhashes = nil -local newhashes = nil +local olddata = nil +local newdata = nil local getrunner = sandbox.getrunner local runner = sandbox.registerrunner { @@ -505,31 +505,54 @@ local runner = sandbox.registerrunner { } } -local function runbuffer(name,encapsulate,runnername,suffix,extra) +local function runbuffer(name,encapsulate,runnername,suffixes) if not runnername or runnername == "" then runnername = "run buffer" end - if not suffix or suffix == "" then - suffix = "pdf" + local suffix = "pdf" + if type(suffixes) == "table" then + suffix = suffixes[1] + elseif type(suffixes) == "string" and suffixes ~= "" then + suffix = suffixes + suffixes = { suffix } + else + suffixes = { suffix } end local runner = getrunner(runnername) if not runner then report_typeset("unknown runner %a",runnername) return end - if not oldhashes then - oldhashes = getdata("typeset buffers","hashes") or { } + if not olddata then + olddata = getdata("buffers","runners") or { } + local suffixes = olddata.suffixes + local hashes = olddata.hashes + if hashes and suffixes then + for k, hash in next, hashes do + for h, v in next, hash do + for s, v in next, suffixes do + local tmp = addsuffix(h,s) + -- report_typeset("mark for deletion: %s",tmp) + registertempfile(tmp) + end + end + end + end end - if not newhashes then - newhashes = { - version = environment.version + if not newdata then + newdata = { + version = environment.version, + suffixes = { }, + hashes = { }, } setdata { - name = "typeset buffers", - tag = "hashes", - data = newhashes, + name = "buffers", + tag = "runners", + data = newdata, } end + local oldhashes = olddata.hashes or { } + local newhashes = newdata.hashes or { } local old = oldhashes[suffix] local new = newhashes[suffix] if not old then @@ -537,8 +560,9 @@ local function runbuffer(name,encapsulate,runnername,suffix,extra) oldhashes[suffix] = old for hash, n in next, old do local tag = formatters["%s-t-b-%s"](tex.jobname,hash) - registertempfile(addsuffix(tag,"tmp")) -- to be sure - registertempfile(addsuffix(tag,suffix)) + local tmp = addsuffix(tag,"tmp") + -- report_typeset("mark for deletion: %s",tmp) + registertempfile(tmp) -- to be sure end end if not new then @@ -558,11 +582,11 @@ local function runbuffer(name,encapsulate,runnername,suffix,extra) local tag = formatters["%s-t-b-%s"](nameonly(tex.jobname),hash) -- make sure we run on the local path -- local filename = addsuffix(tag,"tmp") - local resultname = addsuffix(tag .. (extra or ""),suffix) + local resultname = addsuffix(tag,suffix) -- - if new[hash] then + if new[tag] then -- done - elseif not old[hash] or oldhashes.version ~= newhashes.version or not isfile(resultname) then + elseif not old[tag] or olddata.version ~= newdata.version or not isfile(resultname) then if trace_run then report_typeset("changes in %a, processing forced",name) end @@ -570,12 +594,19 @@ local function runbuffer(name,encapsulate,runnername,suffix,extra) report_typeset("processing saved buffer %a\n",filename) runner { filename = filename } end - new[hash] = (new[hash] or 0) + 1 + new[tag] = (new[tag] or 0) + 1 report_typeset("no changes in %a, processing skipped",name) registertempfile(filename) - registertempfile(resultname,nil,true) + -- report_typeset("mark for persistence: %s",filename) + for i=1,#suffixes do + local suffix = suffixes[i] + newdata.suffixes[suffix] = true + local tmp = addsuffix(tag,suffix) + -- report_typeset("mark for persistance: %s",tmp) + registertempfile(tmp,nil,true) + end -- - return resultname + return resultname -- first result end local function getbuffer(name) diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e382b6282..8a139dd1c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2017.03.24 19:06} +\newcontextversion{2017.03.26 16:15} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 4012e29dd..5220613a6 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -39,7 +39,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2017.03.24 19:06} +\edef\contextversion{2017.03.26 16:15} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/grph-inc.mkiv b/tex/context/base/mkiv/grph-inc.mkiv index 881bf9713..25058b3f7 100644 --- a/tex/context/base/mkiv/grph-inc.mkiv +++ b/tex/context/base/mkiv/grph-inc.mkiv @@ -911,3 +911,143 @@ \unexpanded\def\inlinefigure[#1]{\dontleavehmode\sbox{\externalfigure[#1][\v!inline]}} \protect \endinput + +% Moved here because this already old code is nowhere documents (so I need to +% check it: +% +% \starttext +% +% \startluaparameterset [u3d:myset:controls:1] +% view = { +% name = 'default', +% bg = {1,1,1}, +% mag = 100, +% coo = {0,0,0}, +% c2c = {0,0,1}, +% rot = {40,0,60}, +% roo = 6, +% lights = 'CAD' +% }, +% js = 'cloudq.js' +% \stopluaparameterset +% +% \startluaparameterset [u3d:myset:controls:2] +% views = { +% { +% name = 'AnglePositioning', +% bg = {1,1,1}, +% azimuth = 45, +% altitude = 45, +% roo = 50, +% aac = 2.5, +% lights = 'Artwork' +% }, +% { +% name = 'RotationPositioning', +% bg = {1,1,1}, +% rot = {0,45,45}, +% roo = 50, +% aac = 2.5, +% lights = 'Artwork' +% }, +% { +% name = 'VectorPositioning', +% bg = {1,0,0}, +% c2c = {1,1,math.sqrt(2)}, +% roo = 50, +% aac = 2.5, +% lights = 'CAD' +% }, +% { +% name = 'PositionPositioning', +% bg = {1,0,0}, +% pos = {1+25,1+25,1+50/math.sqrt(2)}, +% aac = 2.5, +% lights = 'CAD' +% }, +% { +% name = 'ortho', +% bg = {1,1,1}, +% mag = 300, +% lights = 'CAD', +% crossection = {} +% } +% }, +% view = { +% name = 'default', +% bg = {1,1,1}, +% c2c = {-1,-1,0}, +% roo = 50, +% aac = 2.5, +% roll = 45, +% lights = 'CAD', +% crossection = { +% normal = {-1,-1,-1}, +% transparent = true +% }, +% nodes = { +% { +% name = 'xlabel', +% visible = false +% }, +% { +% name = 'ylabel', +% opacity = 0.5 +% }, +% { +% name = 'zlabel', +% rendermode = 'Wireframe' +% } +% } +% } +% \stopluaparameterset +% +% \useexternalfigure +% [cloudq] +% [cloudq.u3d] +% [width=0.7\textwidth, +% height=.7\textwidth, +% display=u3d:myset:display:1, +% controls=u3d:myset:controls:1] +% +% \useexternalfigure +% [axes] +% [axes.u3d] +% [width=0.7\textwidth, +% height=.7\textwidth, +% controls=u3d:myset:controls:1] +% +% \startluaparameterset[u3d:myset:display:2] +% toolbar = true, +% preview = 'cloudq.png' +% \stopluaparameterset +% \startluaparameterset[u3d:myset:display:3] +% toolbar = true, +% tree = false, +% preview = 'axes.png' +% \stopluaparameterset +% \startluaparameterset[u3d:myset:display:4] +% toolbar = true, +% tree = false, +% view = { +% name = 'view', +% bg = {0.1,0.1,0.1}, +% c2c = {-1,-1,0}, +% roo = 50, +% aac = 2.5, +% roll = 45, +% lights = 'Red' +% } +% \stopluaparameterset +% \startluaparameterset[u3d:myset:display:5] +% toolbar = true, +% tree = false, +% view = 'ortho' +% \stopluaparameterset +% +% \placefigure[here]{none}{\externalfigure[cloudq][frame=on,display=u3d:myset:display:2]} +% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:3]} +% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:4]} +% \placefigure[here]{none}{\externalfigure[axes] [frame=on,display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]} +% +% \stoptext diff --git a/tex/context/base/mkiv/grph-u3d.lua b/tex/context/base/mkiv/grph-u3d.lua index 6961c5503..748f9808d 100644 --- a/tex/context/base/mkiv/grph-u3d.lua +++ b/tex/context/base/mkiv/grph-u3d.lua @@ -47,5 +47,8 @@ end figures.includers.u3d = figures.includers.nongeneric +-- figures.checkers .prc = figures.checkers.u3d +-- figures.includers.prc = figures.includers.nongeneric + figures.registersuffix("u3d","u3d") figures.registersuffix("prc","u3d") diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua index 66925f19f..d0f894292 100644 --- a/tex/context/base/mkiv/luat-run.lua +++ b/tex/context/base/mkiv/luat-run.lua @@ -118,7 +118,11 @@ function luatex.registertempfile(name,extrasuffix,keep) -- namespace might chang name = name .. ".mkiv-tmp" -- maybe just .tmp end if trace_temp_files and not tempfiles[name] then - report_tempfiles("registering temporary file %a",name) + if keep then + report_tempfiles("%s temporary file %a","registering",name) + else + report_tempfiles("%s temporary file %a","unregistering",name) + end end tempfiles[name] = keep or false return name @@ -128,7 +132,7 @@ function luatex.cleanuptempfiles() for name, keep in next, tempfiles do if not keep then if trace_temp_files then - report_tempfiles("removing temporary file %a",name) + report_tempfiles("%s temporary file %a","removing",name) end os.remove(name) end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 9fdfe1ddd..547accaa3 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex b5e8cb4fd..84ecb4427 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-ren.mkiv b/tex/context/base/mkiv/strc-ren.mkiv index b3b9f04d9..132f0f115 100644 --- a/tex/context/base/mkiv/strc-ren.mkiv +++ b/tex/context/base/mkiv/strc-ren.mkiv @@ -688,23 +688,57 @@ [\c!alternative=\v!vertical, \c!renderingsetup=\??headrenderings:\v!inmargin] +% \startsetups[\??headrenderings:\v!inmargin] +% \vbox { +% \headsetupspacing +% \begstrut % use one \strut here! +% \dontleavehmode % in case there is no strut, else side effects with llap +% \ifconditional\headshownumber +% \llap { +% \signalrightpage +% \hbox { +% \hfill +% \headnumbercontent +% \doifelserightpage{ +% \scratchdistance\leftmargindistance +% } { +% \scratchdistance\rightmargindistance +% } +% \hskip\dimexpr\d_strc_rendering_local_leftoffset+\scratchdistance\relax +% } +% } +% \else +% \fakeheadnumbercontent % will also be done in the other ones (force consistency with numbered) +% \fi +% \headtextcontent +% } +% \stopsetups + \startsetups[\??headrenderings:\v!inmargin] \vbox { \headsetupspacing - \begstrut % use one \strut here! \dontleavehmode % in case there is no strut, else side effects with llap + \begstrut % use one \strut here! \ifconditional\headshownumber - \llap { - \signalrightpage - \hbox { - \hfill + \doifelsesomething {\headparameter\c!location} { + % kind of new + \margindata [\headparameter\c!location] { \headnumbercontent - \doifelserightpage{ - \scratchdistance\leftmargindistance - } { - \scratchdistance\rightmargindistance + } + } { + % normal backward compatible variant + \llap { + \signalrightpage + \hbox { + \hfill + \headnumbercontent + \doifelserightpage{ + \scratchdistance\leftmargindistance + } { + \scratchdistance\rightmargindistance + } + \hskip\dimexpr\d_strc_rendering_local_leftoffset+\scratchdistance\relax } - \hskip\dimexpr\d_strc_rendering_local_leftoffset+\scratchdistance\relax } } \else diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 62445fb29..d01f8a514 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex 8648be396..c23a7c045 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/interface/mkiv/i-section.xml b/tex/context/interface/mkiv/i-section.xml index 2bf8f838d..bcdc836af 100644 --- a/tex/context/interface/mkiv/i-section.xml +++ b/tex/context/interface/mkiv/i-section.xml @@ -200,6 +200,10 @@ <cd:constant type="margintext"/> <cd:constant type="cd:name"/> </cd:parameter> + <cd:parameter name="location"> + <!-- optional margin location --> + <cd:constant type="cd:name"/> + </cd:parameter> <cd:parameter name="width"> <cd:constant type="cd:dimension"/> </cd:parameter> 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 diff --git a/tex/context/modules/mkiv/m-asymptote.mkiv b/tex/context/modules/mkiv/m-asymptote.mkiv index adeb7700f..6252e7a60 100644 --- a/tex/context/modules/mkiv/m-asymptote.mkiv +++ b/tex/context/modules/mkiv/m-asymptote.mkiv @@ -37,11 +37,8 @@ %D context --nonstopmode --purge somefile.tex %D \stoptyping %D -%D Another issue is that prc output only works when we use pdflatex as \TEX\ engine -%D but I might miss some magic flag here. -%D -%D For some reason \type {//} comments don't work, maybe because of some newline -%D issue so one should use \type {/* ... */} instead. +%D For the moment add "settings.prc=true;" to a graphic that is meant to produce that +%D format. See end of file for some examples. \registerctxluafile{m-asymptote}{} @@ -52,10 +49,13 @@ \unexpanded\def\module_asymptote[#1][#2]% {\iffirstargument - \edef\lasttypesetbuffer{\ctxlua{moduledata.asympote.process("asymptote:#1")}}% + \begingroup + \getdummyparameters[#2]% + \edef\lasttypesetbuffer{\ctxlua{moduledata.asympote.process("asymptote:#1","\dummyparameter\c!type")}}% \externalfigure [\lasttypesetbuffer]% [\c!controls=\lasttypesetbuffer,#2]% + \endgroup \fi} \unexpanded\def\startasymptote[#1]% @@ -75,10 +75,8 @@ \starttext -\startasymptote[demo] -/* settings.inlineimage=true; */ -/* settings.embed=true; */ -/* settings.toolbar=false; */ +\startasymptote[demo-1] +settings.prc=true; import graph3; import palette; @@ -119,12 +117,27 @@ draw((1,0,0)--(2,0,-2),black,Arrow3); draw((1,0,0)--(1,1,0),black,Arrow3); \stopasymptote -% \typebuffer[asymptote:demo] +\startasymptote[demo-2] +size(6cm,6cm); + +fill((1cm,2cm)--(3cm,3cm)--(4cm,0cm)--cycle); +\stopasymptote + +% see end of grph-inc.mkiv for some more options: + +\startluaparameterset[demo-1] + toolbar = true, + tree = false, + view = 'ortho' +\stopluaparameterset + +\asymptote[demo-1][type=prc,width=5cm,height=5cm,frame=on,display=yes,controls=yes] +\asymptote[demo-2][type=pdf,width=8cm,frame=on] -\asymptote[demo][width=4cm,frame=on] +% \typebuffer[asymptote:demo-1] -\startasymptotepage - test -\stopasymptotepage +% \startasymptotepage +% test +% \stopasymptotepage \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index bb9728c7c..f1ad29ae5 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 03/24/17 19:06:17 +-- merge date : 03/26/17 16:15:15 do -- begin closure to overcome local limits and interference |