From 898d8e12e219efa15e367285cee56cab77f84339 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 4 Aug 2021 18:47:30 +0200 Subject: 2021-08-04 17:50:00 --- .../general/manuals/fonts/fonts-appendix.tex | 2 +- .../general/manuals/fonts/fonts-environment.tex | 2 + .../general/manuals/fonts/fonts-extensions.tex | 2 +- .../general/manuals/fonts/fonts-features.tex | 62 +++--- .../general/manuals/fonts/fonts-formats.tex | 2 +- .../sources/general/manuals/fonts/fonts-hooks.tex | 2 +- .../general/manuals/fonts/fonts-introduction.tex | 2 +- .../general/manuals/fonts/fonts-lookups.tex | 2 +- .../sources/general/manuals/fonts/fonts-math.tex | 2 +- .../general/manuals/fonts/fonts-methods.tex | 2 +- .../sources/general/manuals/fonts/fonts-mkiv.tex | 2 +- .../sources/general/manuals/fonts/fonts-modes.tex | 2 +- .../general/manuals/fonts/fonts-scripts.tex | 2 +- .../sources/general/manuals/fonts/fonts-tricks.tex | 2 +- .../general/manuals/metafun/metafun-effects.tex | 3 +- .../general/manuals/metafun/metafun-sneaky.tex | 9 +- .../general/manuals/metafun/metafun-text.tex | 244 ++++++++++----------- .../sources/general/manuals/metafun/metafun.tex | 11 +- .../sources/general/manuals/sql/sql-mkiv.tex | 2 +- .../sources/general/manuals/steps/steps-mkiv.tex | 2 + .../sources/general/manuals/svg/svg-lmtx.tex | 4 +- metapost/context/base/mpxl/mp-lmtx.mpxl | 2 +- metapost/context/base/mpxl/mp-tool.mpxl | 2 +- scripts/context/lua/mtx-context.lua | 2 +- scripts/context/lua/mtxrun.lua | 27 ++- scripts/context/stubs/mswin/mtxrun.lua | 27 ++- scripts/context/stubs/unix/mtxrun | 27 ++- scripts/context/stubs/win64/mtxrun.lua | 27 ++- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/mult-pe.mkii | 24 ++ tex/context/base/mkiv/buff-ini.lua | 40 +++- tex/context/base/mkiv/buff-ini.mkiv | 55 ++++- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/grph-fil.lua | 89 +++++--- tex/context/base/mkiv/l-io.lua | 7 +- tex/context/base/mkiv/lang-def.mkiv | 3 +- tex/context/base/mkiv/lpdf-wid.lua | 26 ++- tex/context/base/mkiv/meta-blb.lua | 2 +- tex/context/base/mkiv/mult-def.lua | 65 ++++++ tex/context/base/mkiv/scrn-ini.lua | 2 +- tex/context/base/mkiv/status-files.pdf | Bin 24854 -> 24898 bytes tex/context/base/mkiv/status-lua.pdf | Bin 250063 -> 250052 bytes tex/context/base/mkiv/strc-blk.lua | 41 +++- tex/context/base/mkiv/strc-blk.mkiv | 4 +- tex/context/base/mkiv/strc-usr.mkiv | 55 +++-- tex/context/base/mkiv/util-lib-imp-gm.lua | 4 + tex/context/base/mkiv/util-lib-imp-gs.lua | 4 + tex/context/base/mkiv/util-lib.lua | 2 + tex/context/base/mkiv/util-sql-imp-ffi.lua | 3 +- tex/context/base/mkiv/util-sql-imp-sqlite.lua | 14 -- tex/context/base/mkiv/util-sql-imp-swiglib.lua | 4 + tex/context/base/mkiv/util-sql-tracers.lua | 2 +- tex/context/base/mkiv/util-sql.lua | 8 +- tex/context/base/mkiv/util-str.lua | 41 +++- tex/context/base/mkxl/anch-pos.mkxl | 3 + tex/context/base/mkxl/back-lua.lmt | 10 +- tex/context/base/mkxl/buff-ini.lmt | 116 +++++++--- tex/context/base/mkxl/buff-ini.mkxl | 54 ++++- tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/file-mod.lmt | 6 +- tex/context/base/mkxl/file-mod.mklx | 3 + tex/context/base/mkxl/font-chk.lmt | 6 +- tex/context/base/mkxl/font-ctx.lmt | 2 +- tex/context/base/mkxl/grph-fig.mkxl | 4 +- tex/context/base/mkxl/lang-def.mkxl | 3 +- tex/context/base/mkxl/lpdf-mis.lmt | 29 +-- tex/context/base/mkxl/lpdf-wid.lmt | 15 +- tex/context/base/mkxl/luat-log.lmt | 25 +-- tex/context/base/mkxl/mlib-fio.lmt | 1 + tex/context/base/mkxl/mult-def.mkxl | 16 +- tex/context/base/mkxl/pack-mrl.mkxl | 2 +- tex/context/base/mkxl/scrn-ini.lmt | 54 +++++ tex/context/base/mkxl/scrn-ini.mklx | 55 +---- tex/context/base/mkxl/strc-blk.mkxl | 2 + tex/context/base/mkxl/strc-con.mklx | 15 +- tex/context/base/mkxl/strc-des.mklx | 12 +- tex/context/base/mkxl/strc-enu.mklx | 28 +-- tex/context/base/mkxl/strc-lab.mkxl | 4 +- tex/context/base/mkxl/strc-not.mklx | 45 ++-- tex/context/base/mkxl/strc-sec.mkxl | 2 +- tex/context/base/mkxl/strc-usr.mkxl | 53 +++-- tex/context/base/mkxl/typo-shp.mkxl | 41 +++- tex/context/interface/mkii/keys-pe.xml | 24 ++ tex/context/modules/mkiv/s-fonts-charts.mkiv | 11 +- tex/context/modules/mkiv/s-fonts-missing.lua | 94 ++++---- tex/context/modules/mkiv/s-fonts-tables.lua | 2 + tex/context/modules/mkiv/s-present-stepper.mkiv | 18 +- tex/context/modules/mkiv/s-present-steps.mkiv | 4 + tex/generic/context/luatex/luatex-fonts-merged.lua | 21 +- tex/generic/context/luatex/luatex-mplib.lua | 5 +- 93 files changed, 1139 insertions(+), 630 deletions(-) create mode 100644 tex/context/base/mkxl/scrn-ini.lmt diff --git a/doc/context/sources/general/manuals/fonts/fonts-appendix.tex b/doc/context/sources/general/manuals/fonts/fonts-appendix.tex index 2eab26a93..fab0907b9 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-appendix.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-appendix.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-appendix diff --git a/doc/context/sources/general/manuals/fonts/fonts-environment.tex b/doc/context/sources/general/manuals/fonts/fonts-environment.tex index c884d97e5..4ec877efd 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-environment.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-environment.tex @@ -1,3 +1,5 @@ +% language=us runpath=texruns:manuals/fonts + \startenvironment fonts-environment % we need to do this beforehand diff --git a/doc/context/sources/general/manuals/fonts/fonts-extensions.tex b/doc/context/sources/general/manuals/fonts/fonts-extensions.tex index afe6fd823..f28a21d02 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-extensions.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-extensions.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-extensions diff --git a/doc/context/sources/general/manuals/fonts/fonts-features.tex b/doc/context/sources/general/manuals/fonts/fonts-features.tex index bf9f39385..e9677fe84 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-features.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-features.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-features @@ -883,7 +883,7 @@ results might differ a bit. \stopcombination \stopplacefigure - \definefont[emoji][file:emojionecolor-svginot.ttf*default,svg] + \definefont[Emoji][file:emojionecolor-svginot.ttf*default,svg] \def\FourFaces{\char128104\zwj\char128105\zwj\char128102\zwj\char128102\relax} @@ -892,67 +892,67 @@ results might differ a bit. \def\Boy {\char"1F466\relax} \def\Girl {\char"1F467\relax} - How do we know what faces add up to the ligature {\emoji\Man \zwj \Woman \zwj + How do we know what faces add up to the ligature {\Emoji\Man \zwj \Woman \zwj \Girl \zwj \Boy} and how are we supposed to know that there should {\darkgray \type {zwj}} in between? When we input four faces separated by zero width joiners, we get a four face symbol instead. The reason for having the joiners in between is probably to avoid unexpected ligatures. The sequence \type {man}, \type {woman}, \type {boy}, \type {boy} gives \type {family}: % - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Woman} + {\darkgray \type {zwj}} - {\emoji\Boy} + {\darkgray \type {zwj}} - {\emoji\Boy} = {\emoji\Man \zwj \Woman \zwj \Boy \zwj \Boy}, + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Woman} + {\darkgray \type {zwj}} + {\Emoji\Boy} + {\darkgray \type {zwj}} + {\Emoji\Boy} = {\Emoji\Man \zwj \Woman \zwj \Boy \zwj \Boy}, % but two girls also work: % - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Woman} + {\darkgray \type {zwj}} - {\emoji\Girl} + {\darkgray \type {zwj}} - {\emoji\Girl} = {\emoji\Man \zwj \Woman \zwj \Girl \zwj \Girl}, + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Woman} + {\darkgray \type {zwj}} + {\Emoji\Girl} + {\darkgray \type {zwj}} + {\Emoji\Girl} = {\Emoji\Man \zwj \Woman \zwj \Girl \zwj \Girl}, % so does a mixture of kids: % - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Woman} + {\darkgray \type {zwj}} - {\emoji\Girl} + {\darkgray \type {zwj}} - {\emoji\Boy} = {\emoji\Man \zwj \Woman \zwj \Girl \zwj \Boy}, + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Woman} + {\darkgray \type {zwj}} + {\Emoji\Girl} + {\darkgray \type {zwj}} + {\Emoji\Boy} = {\Emoji\Man \zwj \Woman \zwj \Girl \zwj \Boy}, % although (at least currently): % - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Woman} + {\darkgray \type {zwj}} - {\emoji\Boy} + {\darkgray \type {zwj}} - {\emoji\Girl} = {\emoji\Man \zwj \Woman \zwj \Boy \zwj \Girl}, + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Woman} + {\darkgray \type {zwj}} + {\Emoji\Boy} + {\darkgray \type {zwj}} + {\Emoji\Girl} = {\Emoji\Man \zwj \Woman \zwj \Boy \zwj \Girl}, % - gives twin boys. Of course the real family emoj is {\emoji\char"1F46A}. + gives twin boys. Of course the real family emoj is {\Emoji\char"1F46A}. In our times for sure many combinations are possible, so: % - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Man} + {\darkgray \type {zwj}} - {\emoji\Girl} + {\darkgray \type {zwj}} - {\emoji\Girl} = {\emoji\Man \zwj \Man \zwj \Girl \zwj \Girl}, + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Man} + {\darkgray \type {zwj}} + {\Emoji\Girl} + {\darkgray \type {zwj}} + {\Emoji\Girl} = {\Emoji\Man \zwj \Man \zwj \Girl \zwj \Girl}, % indeed gives a family, but I wonder at what point cultural bias will creep into font design. One can even wonder how clothing and haircut will demand frequent - font updates: {\emoji\char"1F46B}, {\emoji\char"1F46C}, {\emoji\char"1F46D}. + font updates: {\Emoji\char"1F46B}, {\Emoji\char"1F46C}, {\Emoji\char"1F46D}. In the math alphabets we have a couple of annoying holes because some characters were already present in \UNICODE. The bad thing here is that we now always have to deal with these exceptions. But not so with emojis because here eventually all variants will show up. Where a character \type {A} in red or blue uses the same - code point, a white telephone {\emoji\char"1F57E} and black telephone - {\emoji\char"1F57F} have their own. And because obsolete scripts are already + code point, a white telephone {\Emoji\char"1F57E} and black telephone + {\Emoji\char"1F57F} have their own. And because obsolete scripts are already supported in \UNICODE\ and more get added, we can expect old artifacts also - showing up at some time. Soon the joystick {\emoji\char"1F579} will be an unknown + showing up at some time. Soon the joystick {\Emoji\char"1F579} will be an unknown item to most of us, while the \MICROSOFT\ hololens migth get its slot. \startplacefigure[title={Will all animals come in stages of development?}] \startcombination [3*1] - {\scale[width=.3\textwidth]{\emoji\char"1F423}} {\type{U+1F423}: hatching chick} - {\scale[width=.3\textwidth]{\emoji\char"1F424}} {\type{U+1F424}: baby chick} - {\scale[width=.3\textwidth]{\emoji\char"1F425}} {\type{U+1F425}: front-facing baby chick} + {\scale[width=.3\textwidth]{\Emoji\char"1F423}} {\type{U+1F423}: hatching chick} + {\scale[width=.3\textwidth]{\Emoji\char"1F424}} {\type{U+1F424}: baby chick} + {\scale[width=.3\textwidth]{\Emoji\char"1F425}} {\type{U+1F425}: front-facing baby chick} \stopcombination \stopplacefigure diff --git a/doc/context/sources/general/manuals/fonts/fonts-formats.tex b/doc/context/sources/general/manuals/fonts/fonts-formats.tex index 9ad6bc9bd..7028b17af 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-formats.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-formats.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-formats diff --git a/doc/context/sources/general/manuals/fonts/fonts-hooks.tex b/doc/context/sources/general/manuals/fonts/fonts-hooks.tex index 7ee5dc198..b85b801c0 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-hooks.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-hooks.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-hooks diff --git a/doc/context/sources/general/manuals/fonts/fonts-introduction.tex b/doc/context/sources/general/manuals/fonts/fonts-introduction.tex index 0ca91ee9f..d0e844d1f 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-introduction.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-introduction.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-introduction diff --git a/doc/context/sources/general/manuals/fonts/fonts-lookups.tex b/doc/context/sources/general/manuals/fonts/fonts-lookups.tex index e9448b884..642cb1a5f 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-lookups.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-lookups.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-lookups diff --git a/doc/context/sources/general/manuals/fonts/fonts-math.tex b/doc/context/sources/general/manuals/fonts/fonts-math.tex index 766204937..745a5e9cb 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-math.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-math.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts % todo: diff --git a/doc/context/sources/general/manuals/fonts/fonts-methods.tex b/doc/context/sources/general/manuals/fonts/fonts-methods.tex index eac86d694..9acbf26b9 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-methods.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-methods.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-methods diff --git a/doc/context/sources/general/manuals/fonts/fonts-mkiv.tex b/doc/context/sources/general/manuals/fonts/fonts-mkiv.tex index fa53492f0..3a55df4b9 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-mkiv.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-mkiv.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts % author : Hans Hagen % copyright : PRAGMA ADE & ConTeXt Development Team diff --git a/doc/context/sources/general/manuals/fonts/fonts-modes.tex b/doc/context/sources/general/manuals/fonts/fonts-modes.tex index 95cb95732..253942736 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-modes.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-modes.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \definefontfeature [otftracker-husayni] diff --git a/doc/context/sources/general/manuals/fonts/fonts-scripts.tex b/doc/context/sources/general/manuals/fonts/fonts-scripts.tex index aed4f0a5c..78293393f 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-scripts.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-scripts.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-scripts diff --git a/doc/context/sources/general/manuals/fonts/fonts-tricks.tex b/doc/context/sources/general/manuals/fonts/fonts-tricks.tex index 65b210e2c..70cf4c95c 100644 --- a/doc/context/sources/general/manuals/fonts/fonts-tricks.tex +++ b/doc/context/sources/general/manuals/fonts/fonts-tricks.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/fonts \startcomponent fonts-tricks diff --git a/doc/context/sources/general/manuals/metafun/metafun-effects.tex b/doc/context/sources/general/manuals/metafun/metafun-effects.tex index f5b772ec2..0b7984e9e 100644 --- a/doc/context/sources/general/manuals/metafun/metafun-effects.tex +++ b/doc/context/sources/general/manuals/metafun/metafun-effects.tex @@ -247,7 +247,8 @@ fill p rotated 330 withcolor (0,0,1) withtransparency("\MPvar{a}",.5) ; } \startcombination {\useMPgraphic{test}{a=normal}} {\tttf normal} - {\useMPgraphic{test}{a=multiply}} {\tttf multiply} + % {\useMPgraphic{test}{a=multiply}} {\tttf multiply} % here the mu in multiply triggers lookahead in lmtx + {\useMPgraphic{test}{a=2}} {\tttf multiply} % so we go for the numeric value instead (for now) {\useMPgraphic{test}{a=screen}} {\tttf screen} {\useMPgraphic{test}{a=overlay}} {\tttf overlay} {\useMPgraphic{test}{a=softlight}} {\tttf softlight} diff --git a/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex b/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex index b02ce2dab..b8ff1c30b 100644 --- a/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex +++ b/doc/context/sources/general/manuals/metafun/metafun-sneaky.tex @@ -159,9 +159,12 @@ The result is predictable: Of course there is also a \type {cld} approach possible: +% context.startMPpage { offset = "10pt" } +% context.stopMPpage() + \startbuffer \startluacode - context.startMPcode() -- context.startMPpage { offset = "10pt" } + context.startMPcode() for i=0,100,20 do context ( [[draw fullcircle scaled (%s * cm) withcolor "darkmagenta" withpen pencircle scaled 1cm ;]], i) @@ -170,7 +173,7 @@ Of course there is also a \type {cld} approach possible: context ( [[draw fullcircle scaled (%s * cm) withcolor "darkcyan" withpen pencircle scaled 1cm ;]], i) end - context.stopMPcode() -- context.stoppage() + context.stopMPcode() \stopluacode \stopbuffer @@ -186,8 +189,6 @@ All these methods are rather efficient because all happens in memory and without intermediate runs. It is this kind of features that the tight integration of \TEX, \METAPOST\ and \LUA\ make possible. -\stoptext - \stopsection \stopchapter diff --git a/doc/context/sources/general/manuals/metafun/metafun-text.tex b/doc/context/sources/general/manuals/metafun/metafun-text.tex index 2870fbb3b..e6ab26dc4 100644 --- a/doc/context/sources/general/manuals/metafun/metafun-text.tex +++ b/doc/context/sources/general/manuals/metafun/metafun-text.tex @@ -177,7 +177,7 @@ You may consider coloring the dots to be an exercise in clipping. \resetMPenvironment An environment can be reset with \typ {\resetMPenvironment} or by passing \type -{reset} to \typ {\startMPenvironment}. +{reset} as first argument: \starttyping \startMPenvironment[reset] @@ -265,8 +265,8 @@ width in an array (\type {len}). The number of characters is stored in~\type {n} In a few paragraphs we will see why the other arrays are needed. While defining the graphic, we need \TEX\ to do some calculations. Therefore, we -will use \type {\startMPdrawing} to stepwise construct the definition. The basic -pattern we will follow is: +will use \typ {\startMPdrawing ... \stopMPdrawing} to stepwise construct the +definition. The basic pattern we will follow is: \starttyping \resetMPdrawing @@ -695,133 +695,133 @@ In the examples, the text is typeset along the path with: \typebuffer[toks] -\startlinecorrection[blank] -\getbuffer[toks] -\stoplinecorrection - -Since we did not set a path, a dummy path is used. We can provide a path by -(re)defining the graphic \type {followtokens}. - -\startbuffer[trac] -\startMPinclusions - boolean TraceRot ; TraceRot := true ; -\stopMPinclusions -\stopbuffer - -\startbuffer[draw] -\startuseMPgraphic{followtokens} - path RotPath ; RotPath := fullcircle ; -\stopuseMPgraphic -\stopbuffer - -\startbuffer -\typebuffer[draw] -\startlinecorrection[blank] -\hbox - {\getbuffer[draw,toks]\hskip1cm - \getbuffer[trac,draw,toks]} -\stoplinecorrection -\stopbuffer +% \startlinecorrection[blank] +% \getbuffer[toks] +% \stoplinecorrection -\getbuffer - -\startbuffer[draw] -\startuseMPgraphic{followtokens} - path RotPath ; RotPath := reverse fullcircle ; -\stopuseMPgraphic -\stopbuffer +% Since we did not set a path, a dummy path is used. We can provide a path by +% (re)defining the graphic \type {followtokens}. -\getbuffer +% \startbuffer[trac] +% \startMPinclusions +% boolean TraceRot ; TraceRot := true ; +% \stopMPinclusions +% \stopbuffer \startbuffer[draw] \startuseMPgraphic{followtokens} - path RotPath ; RotPath := (-3cm,-1cm)--(0,1cm)--(3cm,-1cm) ; + path RotPath ; RotPath := fullcircle ; \stopuseMPgraphic \stopbuffer -\getbuffer - -\startbuffer[draw] -\startuseMPgraphic{followtokens} - path RotPath ; RotPath := (-3cm,0)--(3cm,1cm) ; -\stopuseMPgraphic -\stopbuffer - -\getbuffer - -\startbuffer[draw] -\startuseMPgraphic{followtokens} - path RotPath ; RotPath := (-3cm,0)..(-1cm,1cm)..(3cm,0) ; -\stopuseMPgraphic -\stopbuffer - -\getbuffer - -\startbuffer[draw] -\startuseMPgraphic{followtokens} - path RotPath ; RotPath := (-3cm,0)..(-1cm,1cm)..(0cm,-2cm)..(3cm,0) ; -\stopuseMPgraphic -\stopbuffer - -\getbuffer - -When turned on, tracing will produce bounding boxes as well as draw the path. -Tracing can be turned on by saying: - -\typebuffer[trac] - -% let's turn it off now - -\startMPinclusions - boolean TraceRot ; TraceRot := false ; -\stopMPinclusions - -The next example is dedicated to Giuseppe Bilotta who wants to handle multiple -strings and uses a patched version of \type {\followtokens}. To avoid a -complicated explanation, we will present an alternative here that uses overlays. -This method also avoids complicated path definitions. - -\startbuffer -\startoverlay - {\startuseMPgraphic{followtokens} - draw fullcircle scaled 5cm . - withpen pencircle scaled 1pt withcolor .625yellow ; - draw fullsquare scaled 5.25cm - withpen pencircle scaled 1pt withcolor .625red ; - drawoptions (withcolor .625red) ; - path RotPath ; RotPath := halfcircle scaled 5cm ; - setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; - \stopuseMPgraphic - \followtokens { Met{\`a} superiore }} - {\startuseMPgraphic{followtokens} - drawoptions (withcolor .625red) ; - path RotPath ; RotPath := halfcircle rotated 90 scaled 5cm ; - setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; - \stopuseMPgraphic - \followtokens { {$\star$} }} - {\startuseMPgraphic{followtokens} - drawoptions (withcolor .625red) ; - path RotPath ; RotPath := halfcircle rotated 180 scaled 5cm ; - setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; - \stopuseMPgraphic - \followtokens { Met{\`a} inferiore }} - {\startuseMPgraphic{followtokens} - drawoptions (withcolor .625red) ; - path RotPath ; RotPath := halfcircle rotated 270 scaled 5cm ; - setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; - \stopuseMPgraphic - \followtokens { {$\star$} }} -\stopoverlay -\stopbuffer - -\typebuffer - -In order to fool the overlay macro that each graphic has the same size, we force -a bounding box. - -\startlinecorrection[blank] -\getbuffer -\stoplinecorrection + \startbuffer + \typebuffer[draw] + \startlinecorrection[blank] + \hbox + {\getbuffer[draw,toks]\hskip1cm + \getbuffer[trac,draw,toks]} + \stoplinecorrection + \stopbuffer + + \getbuffer + + \startbuffer[draw] + \startuseMPgraphic{followtokens} + path RotPath ; RotPath := reverse fullcircle ; + \stopuseMPgraphic + \stopbuffer + + \getbuffer + + \startbuffer[draw] + \startuseMPgraphic{followtokens} + path RotPath ; RotPath := (-3cm,-1cm)--(0,1cm)--(3cm,-1cm) ; + \stopuseMPgraphic + \stopbuffer + + \getbuffer + + \startbuffer[draw] + \startuseMPgraphic{followtokens} + path RotPath ; RotPath := (-3cm,0)--(3cm,1cm) ; + \stopuseMPgraphic + \stopbuffer + + \getbuffer + + \startbuffer[draw] + \startuseMPgraphic{followtokens} + path RotPath ; RotPath := (-3cm,0)..(-1cm,1cm)..(3cm,0) ; + \stopuseMPgraphic + \stopbuffer + + \getbuffer + + \startbuffer[draw] + \startuseMPgraphic{followtokens} + path RotPath ; RotPath := (-3cm,0)..(-1cm,1cm)..(0cm,-2cm)..(3cm,0) ; + \stopuseMPgraphic + \stopbuffer + + \getbuffer + + When turned on, tracing will produce bounding boxes as well as draw the path. + Tracing can be turned on by saying: + + \typebuffer[trac] + + % let's turn it off now + + \startMPinclusions + boolean TraceRot ; TraceRot := false ; + \stopMPinclusions + + The next example is dedicated to Giuseppe Bilotta who wants to handle multiple + strings and uses a patched version of \type {\followtokens}. To avoid a + complicated explanation, we will present an alternative here that uses overlays. + This method also avoids complicated path definitions. + + \startbuffer + \startoverlay + {\startuseMPgraphic{followtokens} + draw fullcircle scaled 5cm . + withpen pencircle scaled 1pt withcolor .625yellow ; + draw fullsquare scaled 5.25cm + withpen pencircle scaled 1pt withcolor .625red ; + drawoptions (withcolor .625red) ; + path RotPath ; RotPath := halfcircle scaled 5cm ; + setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; + \stopuseMPgraphic + \followtokens { Met{\`a} superiore }} + {\startuseMPgraphic{followtokens} + drawoptions (withcolor .625red) ; + path RotPath ; RotPath := halfcircle rotated 90 scaled 5cm ; + setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; + \stopuseMPgraphic + \followtokens { {$\star$} }} + {\startuseMPgraphic{followtokens} + drawoptions (withcolor .625red) ; + path RotPath ; RotPath := halfcircle rotated 180 scaled 5cm ; + setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; + \stopuseMPgraphic + \followtokens { Met{\`a} inferiore }} + {\startuseMPgraphic{followtokens} + drawoptions (withcolor .625red) ; + path RotPath ; RotPath := halfcircle rotated 270 scaled 5cm ; + setbounds currentpicture to boundingbox fullcircle scaled 5.25cm ; + \stopuseMPgraphic + \followtokens { {$\star$} }} + \stopoverlay + \stopbuffer + + \typebuffer + + In order to fool the overlay macro that each graphic has the same size, we force + a bounding box. + + \startlinecorrection[blank] + \getbuffer + \stoplinecorrection \stopsection diff --git a/doc/context/sources/general/manuals/metafun/metafun.tex b/doc/context/sources/general/manuals/metafun/metafun.tex index cbbc7e3ed..8d3b513e0 100644 --- a/doc/context/sources/general/manuals/metafun/metafun.tex +++ b/doc/context/sources/general/manuals/metafun/metafun.tex @@ -1,4 +1,4 @@ -% language=us runpath=texruns:manuals/metafun macros=mkvi +% language=us runpath=texruns:manuals/metafun % author : Hans Hagen % copyright : PRAGMA ADE & ConTeXt Development Team @@ -32,8 +32,15 @@ % comment : Before I started updating the manual to lmtx (luametafun) I made sure that it % processed okay in the february 2021 version of lmtx. The runtime for 448 pages % (which is 20 more than the previous test) is some 16.5 seconds (just below 16 -% with compact fonts). So we can safely conclude that we're not worse off with +% with compact fonts). So we can safely conclude that we're not worse of with % respect to performance. (I use the same machine.) +% +% comment : June 31 2020, in the process of checking manuals with the runpath feature, the +% manual has 414 (some mkii and mkiv stuff has been removed) pages and processing +% takes 14.2 seconds (13.7 with compact fonts). With about 29 pps for the removed +% pages we then come to about 15.5 seconds so again we gained some (which is what +% I expect with the more efficient \LUA|-|\METAPOST\ interfacing). It also means +% that \LUAMETATEX|-|\LMTX\ is now comparable with \LUAJITTEX|-|\MKIV. % \enableexperiments[fonts.compact] diff --git a/doc/context/sources/general/manuals/sql/sql-mkiv.tex b/doc/context/sources/general/manuals/sql/sql-mkiv.tex index 27be160f7..3ae929125 100644 --- a/doc/context/sources/general/manuals/sql/sql-mkiv.tex +++ b/doc/context/sources/general/manuals/sql/sql-mkiv.tex @@ -1,4 +1,4 @@ -% language=uk +% language=us runpath=texruns:manuals/sql % author : Hans Hagen % copyright : PRAGMA ADE & ConTeXt Development Team diff --git a/doc/context/sources/general/manuals/steps/steps-mkiv.tex b/doc/context/sources/general/manuals/steps/steps-mkiv.tex index f0ca51613..540cc3ceb 100644 --- a/doc/context/sources/general/manuals/steps/steps-mkiv.tex +++ b/doc/context/sources/general/manuals/steps/steps-mkiv.tex @@ -1,3 +1,5 @@ +% language=us runpath=texruns:manuals/steps + % author : Hans Hagen % copyright : PRAGMA ADE & ConTeXt Development Team % license : Creative Commons Attribution ShareAlike 4.0 International diff --git a/doc/context/sources/general/manuals/svg/svg-lmtx.tex b/doc/context/sources/general/manuals/svg/svg-lmtx.tex index 11cf33895..44fec26cd 100644 --- a/doc/context/sources/general/manuals/svg/svg-lmtx.tex +++ b/doc/context/sources/general/manuals/svg/svg-lmtx.tex @@ -1,9 +1,9 @@ -% language=us +% language=us runpath=texruns:manuals/svg % \enabletrackers[metapost.svg.result] % \enabletrackers[metapost.svg.path] -\enabledirectives[pdf.compact] +% \enabledirectives[pdf.compact] % \nopdfcompression diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl index c7461a5d1..40c910b68 100644 --- a/metapost/context/base/mpxl/mp-lmtx.mpxl +++ b/metapost/context/base/mpxl/mp-lmtx.mpxl @@ -365,7 +365,7 @@ vardef lmt_do_followtext = interim tracingfollowtext := if getparameter "trace" : 1 else : 0 fi ; draw followtext ( if (getparameter "reverse") : reverse fi (getparameter "path"), - getparameter "text" + (getparameter "text") ) ; popparameters ; ) diff --git a/metapost/context/base/mpxl/mp-tool.mpxl b/metapost/context/base/mpxl/mp-tool.mpxl index 05302493b..a318c39ca 100644 --- a/metapost/context/base/mpxl/mp-tool.mpxl +++ b/metapost/context/base/mpxl/mp-tool.mpxl @@ -256,7 +256,7 @@ def stopsavingdata = enddef ; def finishsavingdata = - lua.mp.mf_finish_saving_data() ; + % lua.mp.mf_finish_saving_data() ; enddef ; %D Instead of a keystroke eating save and allocation sequence, you can use the \quote diff --git a/scripts/context/lua/mtx-context.lua b/scripts/context/lua/mtx-context.lua index 963afcec9..505f63b17 100644 --- a/scripts/context/lua/mtx-context.lua +++ b/scripts/context/lua/mtx-context.lua @@ -868,7 +868,7 @@ function scripts.context.run(ctxdata,filename) -- local usedname = jobname local engine = analysis.engine or "luametatex" - if lmtx and (mainfile == usedfiles.yes or mainfile == usedfiles.nop) and not getargument("redirected") then + if engine == "luametatex" and (mainfile == usedfiles.yes or mainfile == usedfiles.nop) and not getargument("redirected") then mainfile = "" -- we don't need that usedname = fulljobname end diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index e35763c09..1f85f9fe7 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -3285,7 +3285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-io"] = package.loaded["l-io"] or true --- original size: 11829, stripped down to: 6331 +-- original size: 11951, stripped down to: 6430 if not modules then modules={} end modules ['l-io']={ version=1.001, @@ -3352,9 +3352,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -6522,7 +6525,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 45129, stripped down to: 23525 +-- original size: 45866, stripped down to: 23846 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6534,7 +6537,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -6887,12 +6890,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, @@ -25921,8 +25932,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1025470 --- stripped bytes : 402390 +-- original bytes : 1026329 +-- stripped bytes : 402829 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index e35763c09..1f85f9fe7 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -3285,7 +3285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-io"] = package.loaded["l-io"] or true --- original size: 11829, stripped down to: 6331 +-- original size: 11951, stripped down to: 6430 if not modules then modules={} end modules ['l-io']={ version=1.001, @@ -3352,9 +3352,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -6522,7 +6525,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 45129, stripped down to: 23525 +-- original size: 45866, stripped down to: 23846 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6534,7 +6537,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -6887,12 +6890,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, @@ -25921,8 +25932,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1025470 --- stripped bytes : 402390 +-- original bytes : 1026329 +-- stripped bytes : 402829 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index e35763c09..1f85f9fe7 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -3285,7 +3285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-io"] = package.loaded["l-io"] or true --- original size: 11829, stripped down to: 6331 +-- original size: 11951, stripped down to: 6430 if not modules then modules={} end modules ['l-io']={ version=1.001, @@ -3352,9 +3352,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -6522,7 +6525,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 45129, stripped down to: 23525 +-- original size: 45866, stripped down to: 23846 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6534,7 +6537,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -6887,12 +6890,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, @@ -25921,8 +25932,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1025470 --- stripped bytes : 402390 +-- original bytes : 1026329 +-- stripped bytes : 402829 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index e35763c09..1f85f9fe7 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -3285,7 +3285,7 @@ do -- create closure to overcome 200 locals limit package.loaded["l-io"] = package.loaded["l-io"] or true --- original size: 11829, stripped down to: 6331 +-- original size: 11951, stripped down to: 6430 if not modules then modules={} end modules ['l-io']={ version=1.001, @@ -3352,9 +3352,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -6522,7 +6525,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 45129, stripped down to: 23525 +-- original size: 45866, stripped down to: 23846 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -6534,7 +6537,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -6887,12 +6890,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, @@ -25921,8 +25932,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua libs-ini.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1025470 --- stripped bytes : 402390 +-- original bytes : 1026329 +-- stripped bytes : 402829 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 4ff589018..7853fc50f 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{2021.07.30 00:41} +\newcontextversion{2021.08.04 17:48} %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 ecb8d8069..1dab0354a 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{2021.07.30 00:41} +\edef\contextversion{2021.08.04 17:48} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index 49abd76c3..0395abe44 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -79,6 +79,7 @@ \setinterfacevariable{anchor}{anchor} \setinterfacevariable{and}{and} \setinterfacevariable{answerarea}{answerarea} +\setinterfacevariable{append}{append} \setinterfacevariable{appendices}{پیوستها} \setinterfacevariable{appendix}{پیوست} \setinterfacevariable{april}{آوریل} @@ -207,6 +208,8 @@ \setinterfacevariable{fixed}{ثابت} \setinterfacevariable{flexible}{انعطافپذیر} \setinterfacevariable{float}{شناور} +\setinterfacevariable{flushbackward}{flushbackward} +\setinterfacevariable{flushforward}{flushforward} \setinterfacevariable{flushinner}{پمپ‌داخلی} \setinterfacevariable{flushleft}{پمپ‌چپ} \setinterfacevariable{flushouter}{پمپ‌خارجی} @@ -434,6 +437,7 @@ \setinterfacevariable{postscript}{پست‌اسکریپت} \setinterfacevariable{precedingpage}{precedingpage} \setinterfacevariable{preference}{ترجیح} +\setinterfacevariable{prepend}{prepend} \setinterfacevariable{preview}{پیش‌دید} \setinterfacevariable{previous}{قبلی} \setinterfacevariable{previousevenpage}{صفحه‌زوج‌قبلی} @@ -1365,6 +1369,8 @@ \setinterfaceelement{load}{بارگذاشتن} \setinterfaceelement{local}{موضعی} \setinterfaceelement{makeup}{آرایش} +\setinterfaceelement{namednotation}{namednotation} +\setinterfaceelement{namedtyping}{namedtyping} \setinterfaceelement{next}{بعدی} \setinterfaceelement{place}{مکان} \setinterfaceelement{previous}{قبلی} @@ -1533,6 +1539,7 @@ \setinterfacecommand{definereferencelist}{تعریف‌لیست‌مرجع} \setinterfacecommand{defineregister}{تعریف‌ثبت} \setinterfacecommand{definerule}{تعریف‌خط‌حائل} +\setinterfacecommand{definesavebuffer}{startsavebuffer} \setinterfacecommand{definesection}{تعریف‌بخش} \setinterfacecommand{definesectionblock}{تعریف‌بلوک‌بخش} \setinterfacecommand{definesorting}{تعریف‌ترتیب} @@ -1709,6 +1716,9 @@ \setinterfacecommand{moveformula}{انتقال‌فرمول} \setinterfacecommand{moveongrid}{انتقال‌به‌توری} \setinterfacecommand{movesidefloat}{انتقال‌کنار‌شناور} +\setinterfacecommand{namedconstruction}{namedconstruction} +\setinterfacecommand{nameddescription}{nameddescription} +\setinterfacecommand{namedenumeration}{namedenumeration} \setinterfacecommand{navigating}{هدایت} \setinterfacecommand{nodimension}{بدون‌بعد} \setinterfacecommand{noheaderandfooterlines}{بدون‌خط‌سروته‌برگ} @@ -2080,6 +2090,13 @@ \setinterfacecommand{startmakeup}{شروع‌آرایش} \setinterfacecommand{startmarginblock}{شروع‌بلوک‌حاشیه} \setinterfacecommand{startmarginrule}{شروع‌خط‌حاشیه} +\setinterfacecommand{startnamedconstruction}{startnamedconstruction} +\setinterfacecommand{startnameddescription}{startnameddescription} +\setinterfacecommand{startnamedenumeration}{startnamedenumeration} +\setinterfacecommand{startnamedmatrix}{startnamedmatrix} +\setinterfacecommand{startnamedsection}{startnamedsection} +\setinterfacecommand{startnamedsubformulas}{startnamedsubformulas} +\setinterfacecommand{startnamedtyping}{startnamedtyping} \setinterfacecommand{startnarrower}{شروع‌باریکتر} \setinterfacecommand{startopposite}{شروع‌مخالف} \setinterfacecommand{startoverlay}{شروع‌پوشش} @@ -2123,6 +2140,13 @@ \setinterfacecommand{stopmakeup}{پایان‌آرایش} \setinterfacecommand{stopmarginblock}{پایان‌بلوک‌حاشیه} \setinterfacecommand{stopmarginrule}{پایان‌خط‌حاشیه} +\setinterfacecommand{stopnamedconstruction}{stopnamedconstruction} +\setinterfacecommand{stopnameddescription}{stopnameddescription} +\setinterfacecommand{stopnamedenumeration}{stopnamedenumeration} +\setinterfacecommand{stopnamedmatrix}{stopnamedmatrix} +\setinterfacecommand{stopnamedsection}{stopnamedsection} +\setinterfacecommand{stopnamedsubformulas}{stopnamedsubformulas} +\setinterfacecommand{stopnamedtyping}{stopnamedtyping} \setinterfacecommand{stopnarrower}{پایان‌نازکتر} \setinterfacecommand{stopopposite}{پایان‌مخالف} \setinterfacecommand{stopoverlay}{پایان‌پوشش} diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua index 4589e5498..8a8ec67c7 100644 --- a/tex/context/base/mkiv/buff-ini.lua +++ b/tex/context/base/mkiv/buff-ini.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['buff-ini'] = { local concat = table.concat local type, next, load = type, next, load -local sub, format = string.sub, string.format +local sub, format, find = string.sub, string.format, string.find local splitlines, validstring, replacenewlines = string.splitlines, string.valid, string.replacenewlines local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match local utfchar = utf.char @@ -55,6 +55,7 @@ local replacesuffix = file.replacesuffix local registertempfile = luatex.registertempfile local v_yes = variables.yes +local v_append = variables.append local eol = patterns.eol local space = patterns.space @@ -120,6 +121,14 @@ local function exists(name) return cache[name] end +local function empty(name) + if find(getcontent(name),"%S") then + return false + else + return true + end +end + local function getcontent(name) local buffer = name and cache[name] return buffer and buffer.data or "" @@ -201,6 +210,7 @@ buffers.assign = assign buffers.prepend = prepend buffers.append = append buffers.exists = exists +buffers.empty = empty buffers.getcontent = getcontent buffers.getlines = getlines buffers.collectcontent = collectcontent @@ -642,7 +652,7 @@ implement { end } -local function savebuffer(list,name,prefix) -- name is optional +local function savebuffer(list,name,prefix,option,directory) -- name is optional if not list or list == "" then list = name end @@ -656,13 +666,16 @@ local function savebuffer(list,name,prefix) -- name is optional if prefix == v_yes then name = addsuffix(tex.jobname .. "-" .. name,"tmp") end - io.savedata(name,replacenewlines(content)) + if directory ~= "" and dir.makedirs(directory) then + name = file.join(directory,name) + end + io.savedata(name,replacenewlines(content),"\n",option == v_append) end implement { name = "savebuffer", actions = savebuffer, - arguments = "3 strings", + arguments = "5 strings", } -- we can consider adding a size to avoid unlikely clashes @@ -675,7 +688,7 @@ local runner = sandbox.registerrunner { name = "run buffer", program = "context", method = "execute", - template = jit and "--purgeall --jit %filename%" or "--purgeall %filename%", + template = (jit and "--jit " or "") .. "--purgeall %?path: --path=%path% ?% %filename%", reporter = report_typeset, checkers = { filename = "readable", @@ -769,7 +782,10 @@ local function runbuffer(name,encapsulate,runnername,suffixes) end savedata(filename,content) report_typeset("processing saved buffer %a\n",filename) - runner { filename = filename } + runner { + filename = filename, + path = environment.arguments.path, -- maybe take all set paths + } end new[tag] = (new[tag] or 0) + 1 report_typeset("no changes in %a, processing skipped",name) @@ -849,6 +865,12 @@ implement { arguments = "string" } +implement { + name = "doifelsebufferempty", + actions = { empty, commands.doifelse }, + arguments = "string" +} + -- This only used for mp buffers and is a kludge. Don't change the -- texprint into texsprint as it fails because "penddef" becomes -- "penddef" then. @@ -885,10 +907,10 @@ end -- moved here: function buffers.samplefile(name) - if not buffers.exists(name) then - buffers.assign(name,io.loaddata(resolvers.findfile(name))) + if not exists(name) then + assign(name,io.loaddata(resolvers.findfile(name))) end - buffers.get(name) + getbuffer(name) end implement { diff --git a/tex/context/base/mkiv/buff-ini.mkiv b/tex/context/base/mkiv/buff-ini.mkiv index a8a120d90..071a18987 100644 --- a/tex/context/base/mkiv/buff-ini.mkiv +++ b/tex/context/base/mkiv/buff-ini.mkiv @@ -22,8 +22,8 @@ \let\currentbuffer\empty -\def\doifelsebuffer#1% - {\clf_doifelsebuffer{#1}} + \def\doifelsebuffer #1{\clf_doifelsebuffer {#1}} +\unexpanded\def\doifelsebufferempty#1{\clf_doifelsebufferempty{#1}} \let\doifbufferelse\doifelsebuffer @@ -246,12 +246,14 @@ % \savebufferinfile[x][temp.log] % gets name: temp.log \installcorenamespace{savebuffer} +\installcorenamespace{savebuffercounter} -\installsetuponlycommandhandler \??savebuffer {savebuffer} +\installcommandhandler \??savebuffer {savebuffer} \??savebuffer \setupsavebuffer [\c!list=, \c!file=, + \c!directory=, \c!prefix=\v!yes] \unexpanded\def\savebuffer @@ -262,9 +264,54 @@ \doifelseassignment{#1} {\setupcurrentsavebuffer[#1]}% {\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}% - \clf_savebuffer{\directsavebufferparameter\c!list}{\directsavebufferparameter\c!file}{\directsavebufferparameter\c!prefix}% + \clf_savebuffer % will become key/value + {\savebufferparameter\c!list}% + {\savebufferparameter\c!file}% + {\savebufferparameter\c!prefix}% + {\savebufferparameter\c!option}% + {\savebufferparameter\c!directory}% \endgroup} +%D \starttyping +%D \definesavebuffer[slide] +%D +%D \starttext +%D \startslide +%D \starttext +%D \stopslide +%D \startslide +%D slide 1 +%D \stopslide +%D text 1 \par +%D \startslide +%D slide 2 +%D \stopslide +%D text 2 \par +%D \startslide +%D \stoptext +%D \stopslide +%D \stoptext +%D \stoptyping + +\appendtoks + \ifcsname\e!stop\currentsavebuffer\endcsname\else + \definebuffer[\currentsavebuffer]% + \expandafter\newcount\csname\??savebuffercounter\currentsavebuffer\endcsname + \setuevalue{\e!stop\currentsavebuffer}{\buff_stop_save_buffer{\currentsavebuffer}}% + \setsavebufferparameter\c!file{\currentsavebuffer.tex}% + \fi +\to \everydefinesavebuffer + +\protected\def\buff_stop_save_buffer#1% + {\edef\currentsavebuffer{#1}% + \global\advance\csname\??savebuffercounter\currentsavebuffer\endcsname\plusone + \clf_savebuffer % will become key/value + {\thedefinedbuffer{\currentsavebuffer}}% + {\savebufferparameter\c!file}% + {\savebufferparameter\c!prefix}% + {\ifnum\csname\??savebuffercounter\currentsavebuffer\endcsname>\plusone\v!append\fi}% + {\savebufferparameter\c!directory}} + %D Experimental: no expansion of commands in buffer! % \startbuffer[what] diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index d454c8d15..29108424f 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.30 00:41} +\newcontextversion{2021.08.04 17:48} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 32af5b99b..aa17074b9 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.07.30 00:41} +\edef\contextversion{2021.08.04 17:48} %D Kind of special: diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua index 005657947..1044d29d9 100644 --- a/tex/context/base/mkiv/grph-fil.lua +++ b/tex/context/base/mkiv/grph-fil.lua @@ -49,89 +49,106 @@ job.register('job.files.collected', tobesaved, initializer) local runner = sandbox.registerrunner { name = "hashed context run", program = "context", - template = [[%options% --path=%path% %filename%]], - template = [[%options% %?path: --path=%path% ?% %?runpath: --runpath=%runpath% ?% %filename%]], + template = [[%options% %?path: --runpath=%path% ?% %filename%]], checkers = { options = "string", filename = "readable", path = "string", - runpath = "string", + -- runpath = "string", } } -function jobfiles.run(name,action) - local usedname = addsuffix(name,inputsuffix) -- we assume tex if not set - local oldchecksum = collected[usedname] - local newchecksum = checksum(usedname) - local resultfile = replacesuffix(usedname,resultsuffix) +-- we can also use: +-- +-- local jobvariables = job.variables +-- jobvariables.getchecksum(tag) +-- jobvariables.makechecksum(data) +-- jobvariables.setchecksum(tag,checksum) + +-- The runpath features makes things more complex than needed, so we need to wrap +-- that some day in a helper. This is also very sensitive for both being set! + +local function analyzed(name) + local actiontype = type(action) + local usedname = addsuffix(name,inputsuffix) -- we assume tex if not set + local resultname = replacesuffix(name,resultsuffix) -- we assume tex if not set + local pathname = file.pathpart(usedname) + local runpath = environment.arguments.path -- sic, no runpath + if pathname ~= "" then + if runpath then + runpath = file.join(action.path,pathname) + else + runpath = pathname + end + usedname = file.basename(usedname) + end + return { + options = options, + path = runpath, + filename = usedname, + result = resultname, + } +end + +function jobfiles.run(action) + local filename = action.filename + local result = action.result + local oldchecksum = collected[filename] + local newchecksum = checksum(filename) local tobedone = false if jobfiles.forcerun then tobedone = true if trace_run then - report_run("processing file, changes in %a, %s",name,"processing forced") + report_run("processing file, changes in %a, %s",filename,"processing forced") end end if not tobedone and not oldchecksum then tobedone = true if trace_run then - report_run("processing file, changes in %a, %s",name,"no checksum yet") + report_run("processing file, changes in %a, %s",filename,"no checksum yet") end end if not tobedone and oldchecksum ~= newchecksum then tobedone = true if trace_run then - report_run("processing file, changes in %a, %s",name,"checksum mismatch") + report_run("processing file, changes in %a, %s",filename,"checksum mismatch") end end - if not tobedone and not isfile(resultfile) then + if not tobedone and not isfile(result) then tobedone = true if trace_run then - report_run("processing file, changes in %a, %s",name,"no result file") + report_run("processing file, changes in %a, %s",filename,"no result file") end end if tobedone then - local ta = type(action) - if ta == "function" then - action(name) - elseif ta == "string" and action ~= "" then - -- can be anything but we assume it gets checked by the sandbox - os.execute(action) - elseif ta == "table" then - -- these paths will be ignored when they are not set - local path = action.path - local runpath = action.runpath - action.path = environment.arguments.path - action.runpath = environment.arguments.runpath - runner(action) - action.path = path - action.runpath = runpath - else - report_run("processing file, no action given for processing %a",name) - end + runner(action) elseif trace_run then report_run("processing file, no changes in %a, not processed",name) end - tobesaved[name] = newchecksum + tobesaved[filename] = newchecksum end -- local done = { } -function jobfiles.context(name,options) +function jobfiles.context(name,options) -- runpath ? if type(name) == "table" then local result = { } for i=1,#name do result[#result+1] = jobfiles.context(name[i],options) end return result - else - local result = replacesuffix(name,resultsuffix) + elseif name ~= "" then + local action = analyzed(name,options) + local result = action.result if not done[result] then - jobfiles.run(name, { options = options, filename = name }) + jobfiles.run(action) done[result] = true end return result + else + return { } end end diff --git a/tex/context/base/mkiv/l-io.lua b/tex/context/base/mkiv/l-io.lua index a955262a3..f72995abd 100644 --- a/tex/context/base/mkiv/l-io.lua +++ b/tex/context/base/mkiv/l-io.lua @@ -147,9 +147,12 @@ function io.copydata(source,target,action) end end -function io.savedata(filename,data,joiner) - local f = open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f = open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end") > 0 then + f:write(joiner) + end if type(data) == "table" then f:write(concat(data,joiner or "")) elseif type(data) == "function" then diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv index cc94bf7ae..603935097 100644 --- a/tex/context/base/mkiv/lang-def.mkiv +++ b/tex/context/base/mkiv/lang-def.mkiv @@ -564,8 +564,7 @@ \c!rightquote=\upperrightsingleninequote, %U+2019, \c!leftquotation=\upperleftdoublesixquote, %U+201C, \c!rightquotation=\upperrightdoubleninequote, %U+201D, - \c!date={\v!year,~m.,\space,\v!month,\space,\v!day,~d.}, - \c!date={\v!day-a\space de\space \v!month\space \v!year}, + \c!date={\v!day,-a\space de\space,\v!month,\space \v!year}, \s!patterns=eo, \s!lefthyphenmin=2, \s!righthyphenmin=2] diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index f0156075a..1e91ecd56 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -69,17 +69,18 @@ local pdfreference = lpdf.reference local pdfunicode = lpdf.unicode local pdfstring = lpdf.string local pdfboolean = lpdf.boolean +local pdfaction = lpdf.action +local pdfborder = lpdf.border + +local pdftransparencyvalue = lpdf.transparencyvalue +local pdfcolorvalues = lpdf.colorvalues + local pdfflushobject = lpdf.flushobject local pdfflushstreamobject = lpdf.flushstreamobject local pdfflushstreamfileobject = lpdf.flushstreamfileobject local pdfreserveobject = lpdf.reserveobject local pdfpagereference = lpdf.pagereference local pdfshareobjectreference = lpdf.shareobjectreference -local pdfaction = lpdf.action -local pdfborder = lpdf.border - -local pdftransparencyvalue = lpdf.transparencyvalue -local pdfcolorvalues = lpdf.colorvalues -- symbols @@ -258,7 +259,7 @@ local function flushembeddedfiles() for tag, reference in sortedhash(filestreams) do if not reference then report_attachment("unreferenced file, tag %a",tag) - elseif referenced[tag] == "hidden" then + elseif referenced[tag] == "hidden" or referenced[tag] == "forced" then e[#e+1] = pdfstring(tag) e[#e+1] = reference -- already a reference f[#f+1] = reference -- collect all file description references @@ -368,6 +369,9 @@ function codeinjections.embedfile(specification) } local r = pdfreference(pdfflushobject(d)) filestreams[hash] = r + if specification.forcereference == true then + referenced[hash] = "forced" + end return r end end @@ -651,9 +655,6 @@ local function insertrenderingwindow(specification) } local width = specification.width or 0 local height = specification.height or 0 - if height == 0 or width == 0 then - -- todo: sound needs no window - end context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref return pdfreference(r) end @@ -704,9 +705,10 @@ local function insertrendering(specification) descriptor = pdfreference(pdfflushobject(descriptor)) elseif option[v_embed] then descriptor = codeinjections.embedfile { - file = filename, - mimetype = mimetype, -- yes or no - compress = false, + file = filename, + mimetype = mimetype, -- yes or no + compress = false, + forcereference = true, } end local clip = pdfdictionary { diff --git a/tex/context/base/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua index e57bc3c23..c042451f2 100644 --- a/tex/context/base/mkiv/meta-blb.lua +++ b/tex/context/base/mkiv/meta-blb.lua @@ -200,7 +200,7 @@ metapost.installplugin { } -- Here follows an example of usage of the above: a more modern --- version of followokens (in meta-imp-txt.mkiv). +-- version of followtokens (in meta-imp-txt.mkiv). local nodecodes = nodes.nodecodes local kerncodes = nodes.kerncodes diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua index d65c7bcf6..af7804506 100644 --- a/tex/context/base/mkiv/mult-def.lua +++ b/tex/context/base/mkiv/mult-def.lua @@ -7271,6 +7271,62 @@ return { ["pe"]="بنویس‌درثبت", ["ro"]="scrieinregistru", }, + -- we still need to add some new ones here as i completely forgot that it's + -- needed ... maybe ws has a backlog for setups that we can use + ["definesavebuffer"]={ + ["en"]="startsavebuffer", + }, + ["startnamedtyping"]={ + ["en"]="startnamedtyping", + }, + ["stopnamedtyping"]={ + ["en"]="stopnamedtyping", + }, + ["namedconstruction"]={ + ["en"]="namedconstruction", + }, + ["startnamedconstruction"]={ + ["en"]="startnamedconstruction", + }, + ["stopnamedconstruction"]={ + ["en"]="stopnamedconstruction", + }, + ["nameddescription"]={ + ["en"]="nameddescription", + }, + ["startnameddescription"]={ + ["en"]="startnameddescription", + }, + ["stopnameddescription"]={ + ["en"]="stopnameddescription", + }, + ["namedenumeration"]={ + ["en"]="namedenumeration", + }, + ["startnamedenumeration"]={ + ["en"]="startnamedenumeration", + }, + ["stopnamedenumeration"]={ + ["en"]="stopnamedenumeration", + }, + ["startnamedsection"]={ + ["en"]="startnamedsection", + }, + ["stopnamedsection"]={ + ["en"]="stopnamedsection", + }, + ["startnamedmatrix"]={ + ["en"]="startnamedmatrix", + }, + ["stopnamedmatrix"]={ + ["en"]="stopnamedmatrix", + }, + ["startnamedsubformulas"]={ + ["en"]="startnamedsubformulas", + }, + ["stopnamedsubformulas"]={ + ["en"]="stopnamedsubformulas", + }, }, ["constants"]={ ["action"]={ @@ -12887,6 +12943,9 @@ return { ["namedtyping"]={ ["en"]="namedtyping", }, + ["namednotation"]={ + ["en"]="namednotation", + }, ["next"]={ ["cs"]="dalsi", ["de"]="folgende", @@ -14505,6 +14564,12 @@ return { ["pe"]="answerarea", ["ro"]="answerarea", }, + ["append"]={ + ["en"]="append", + }, + ["prepend"]={ + ["en"]="prepend", + }, ["appendices"]={ ["cs"]="dodatky", ["de"]="anhaenge", diff --git a/tex/context/base/mkiv/scrn-ini.lua b/tex/context/base/mkiv/scrn-ini.lua index ce9f9f71b..bf7afccb6 100644 --- a/tex/context/base/mkiv/scrn-ini.lua +++ b/tex/context/base/mkiv/scrn-ini.lua @@ -33,7 +33,7 @@ interfaces.implement { arguments = { { { "title" }, - { "subtitle" }, + { "subtitle"}, { "author" }, { "creator" }, { "date" }, diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 4edea249a..873f89595 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index a3561d70c..2de5b578b 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-blk.lua b/tex/context/base/mkiv/strc-blk.lua index 6717c3777..f627ad3ea 100644 --- a/tex/context/base/mkiv/strc-blk.lua +++ b/tex/context/base/mkiv/strc-blk.lua @@ -95,8 +95,11 @@ function blocks.setstate(state,name,tag) end end -function blocks.select(state,name,tag,criterium) - criterium = criterium or "text" + +local function selectblocks(state,name,tag,criterium,action) + if not criterium or criterium == "" then + criterium = "text" + end if find(tag,"=",1,true) then tag = "" end @@ -115,14 +118,19 @@ function blocks.select(state,name,tag,criterium) local metadata = ri.metadata if names[metadata.name] then if all then - printblock(ri.index,name,ri.data,hide) + if action(ri.index,name,ri.data,hide) then + return + end else local mtags = metadata.tags if mtags then for tag, sta in next, tags do if mtags[tag] then - printblock(ri.index,name,ri.data,hide) - break + if action(ri.index,name,ri.data,hide) then + return + else + break + end end end end @@ -131,6 +139,20 @@ function blocks.select(state,name,tag,criterium) end end +function blocks.select(state,name,tag,criterium) + selectblocks(state,name,tag,criterium,printblock) +end + +function blocks.empty(state,name,tag,criterium) + local found = false + local function checkempty(_,_,data) + found = type(data) == "string" and find(data,"%S") + return found + end + selectblocks(state,name,tag,criterium,checkempty) + return not found +end + function blocks.save(name,tag,userdata,buffer) -- wrong, not yet adapted local data = buffers.getcontent(buffer) local tags = settings_to_set(tag) @@ -183,6 +205,7 @@ function blocks.save(name,tag,userdata,buffer) -- wrong, not yet adapted buffers.erase(buffer) end + -- interface implement { name = "definestructureblock", actions = blocks.define, arguments = "string" } @@ -190,3 +213,11 @@ implement { name = "savestructureblock", actions = blocks.save, implement { name = "selectstructureblock", actions = blocks.select, arguments = "4 strings" } implement { name = "setstructureblockstate", actions = blocks.setstate, arguments = "3 strings" } implement { name = "structureblockuservariable", actions = blocks.uservariable, arguments = { "integer", "string" } } + +implement { + name = "doifelsestructureblocksempty", + arguments = "3 strings", + actions = function(name,tag,criterium) + commands.doifelse(blocks.empty(false,name,tag,criterium)) + end, +} diff --git a/tex/context/base/mkiv/strc-blk.mkiv b/tex/context/base/mkiv/strc-blk.mkiv index e52198721..0b41b6dc2 100644 --- a/tex/context/base/mkiv/strc-blk.mkiv +++ b/tex/context/base/mkiv/strc-blk.mkiv @@ -1,4 +1,4 @@ -%D \module +D \module %D [ file=strc-blk, %D version=2008.10.20, %D title=\CONTEXT\ Structure Macros, @@ -177,4 +177,6 @@ \unexpanded\def\processblocks{\doquadrupleempty\strc_blocks_select [process]} \unexpanded\def\selectblocks {\doquadrupleempty\strc_blocks_select [use]} +unexpanded\def\doifelseblocksempty{\clf_doifelsestructureblocksempty} % {name}{tag}{criterium} + \protect \endinput diff --git a/tex/context/base/mkiv/strc-usr.mkiv b/tex/context/base/mkiv/strc-usr.mkiv index 97b656fa0..cbf910616 100644 --- a/tex/context/base/mkiv/strc-usr.mkiv +++ b/tex/context/base/mkiv/strc-usr.mkiv @@ -91,21 +91,16 @@ \installcommandhandler \????userdata {userdata} \????userdata \installcommandhandler \????userdataalternative {userdataalternative} \????userdataalternative +\appendtoks + \setuevalue{\e!start\currentuserdata}{\dodoubleempty\userdata_start_instance[\currentuserdata]}% + \setuevalue{\e!stop \currentuserdata}{\userdata_stop_instance}% +\to \everydefineuserdata + \unexpanded\def\startuserdata {\begingroup \let\currentuserdata\empty \doifelsenextoptionalcs\userdata_start_delayed\userdata_start_indeed} -% This variant works only when the userdata instance exists while the assignment check -% can also be used with undefined instances which falls back to the global settings. -% -% \def\userdata_start_delayed[#1]% -% {\ifcsname\nameduserdatahash{\detokenize\expandafter{\normalexpanded{#1}}}\s!parent\endcsname -% \expandafter\userdata_start_delayed_name -% \else -% \expandafter\userdata_start_delayed_parameters -% \fi[#1]} - \def\userdata_start_delayed[#1]% {\doifelseassignmentcs{#1}% \userdata_start_delayed_parameters @@ -121,26 +116,27 @@ \checkuserdataparent \doifelsenextoptionalcs\userdata_start_delayed_parameters\userdata_start_indeed} +\unexpanded\def\userdata_start_instance[#1][#2]% + {\begingroup + \edef\currentuserdata{#1}% + \setupcurrentuserdata[#2]% + \grabbufferdatadirect + {\s!userdata:\currentuserdata}% + {\e!start\currentuserdata}% + {\e!stop \currentuserdata}} + \def\userdata_start_indeed - {\grabbufferdatadirect\s!userdata{\csstring\startuserdata}{\csstring\stopuserdata}} - -% \unexpanded\def\stopuserdata -% {\useuserdatastyleandcolor\c!style\c!color -% \usealignparameter\userdataparameter -% \edef\currentuserdataalternative{\userdataparameter\c!alternative}% -% \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else -% \let\currentuserdataalternative\s!default -% \fi -% \edef\p_renderingsetup{\userdataalternativeparameter\c!renderingsetup}% -% \directsetup\p_renderingsetup -% \endgroup} + {\grabbufferdatadirect + {\s!userdata:\currentuserdata}% + {\csstring\startuserdata}% + {\csstring\stopuserdata}} \unexpanded\def\stopuserdata - {\userdataparameter\c!before % HH: moved, so we obey the outer spacing - \dostarttagged\t!userdata\currentuserdata % HH: added, maybe move up ? + {\userdataparameter\c!before + \dostarttagged\t!userdata\currentuserdata \begingroup \useuserdatastyleandcolor\c!style\c!color - \usealignparameter\userdataparameter % HH: added + \usealignparameter\userdataparameter \edef\currentuserdataalternative{\userdataparameter\c!alternative}% \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else \let\currentuserdataalternative\s!default @@ -150,14 +146,13 @@ \directsetup\p_renderingsetup \endgroup \dostoptagged - \userdataparameter\c!after % HH: moved + \userdataparameter\c!after \endgroup} -\unexpanded\def\getuserdata - {\getbufferdata[\s!userdata]} +\let\userdata_stop_instance\stopuserdata -\unexpanded\def\getinlineuserdata - {\inlinebuffer[\s!userdata]} +\unexpanded\def\getuserdata {\getbufferdata[\s!userdata]} +\unexpanded\def\getinlineuserdata{\inlinebuffer[\s!userdata]} \defineuserdataalternative [\s!default] diff --git a/tex/context/base/mkiv/util-lib-imp-gm.lua b/tex/context/base/mkiv/util-lib-imp-gm.lua index d1ffde879..99c62451c 100644 --- a/tex/context/base/mkiv/util-lib-imp-gm.lua +++ b/tex/context/base/mkiv/util-lib-imp-gm.lua @@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-lib-imp-gm'] = { license = "see context related readme files", } +if true then + logs.report("warning","swiglib is no longer supported") +end + local graphicmagick = utilities.graphicmagick or { } utilities.graphicmagick = graphicmagick diff --git a/tex/context/base/mkiv/util-lib-imp-gs.lua b/tex/context/base/mkiv/util-lib-imp-gs.lua index 0eceda7aa..305f4103b 100644 --- a/tex/context/base/mkiv/util-lib-imp-gs.lua +++ b/tex/context/base/mkiv/util-lib-imp-gs.lua @@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-lib-imp-gs'] = { license = "see context related readme files", } +if true then + logs.report("warning","swiglib is no longer supported") +end + local insert = table.insert local formatters = string.formatters diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua index be763d92e..77ec7cd7e 100644 --- a/tex/context/base/mkiv/util-lib.lua +++ b/tex/context/base/mkiv/util-lib.lua @@ -245,6 +245,8 @@ end resolvers.locatelib = locate -- for now +-- swiglib is no longer officially supported + do local report_swiglib = logs.reporter("swiglib") diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua index f44069502..cbfd7bcf5 100644 --- a/tex/context/base/mkiv/util-sql-imp-ffi.lua +++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua @@ -8,8 +8,7 @@ if not modules then modules = { } end modules ['util-sql-imp-ffi'] = { -- I looked at luajit-mysql to see how the ffi mapping was done but it didn't work -- out that well (at least not on windows) but I got the picture. As I have somewhat --- different demands I simplified / redid the ffi bit and just took the swiglib --- variant and adapted that. +-- different demands I simplified. local tonumber = tonumber local concat = table.concat diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua index a88035f68..781c92c89 100644 --- a/tex/context/base/mkiv/util-sql-imp-sqlite.lua +++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua @@ -22,20 +22,6 @@ local preparetemplate = helpers.preparetemplate local setmetatable = setmetatable local formatters = string.formatters ------ sqlite = require("swiglib.sqlite.core") ------ swighelpers = require("swiglib.helpers.core") ------ ------ get_list_item = sqlite.char_p_array_getitem ------ is_okay = sqlite.SQLITE_OK ------ execute_query = sqlite.sqlite3_exec_lua_callback ------ error_message = sqlite.sqlite3_errmsg ------ ------ new_db = sqlite.new_sqlite3_p_array ------ open_db = sqlite.sqlite3_open ------ get_db = sqlite.sqlite3_p_array_getitem ------ close_db = sqlite.sqlite3_close ------ dispose_db = sqlite.delete_sqlite3_p_array - local ffi = require("ffi") ffi.cdef [[ diff --git a/tex/context/base/mkiv/util-sql-imp-swiglib.lua b/tex/context/base/mkiv/util-sql-imp-swiglib.lua index 786b4bffc..16f6d533a 100644 --- a/tex/context/base/mkiv/util-sql-imp-swiglib.lua +++ b/tex/context/base/mkiv/util-sql-imp-swiglib.lua @@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-sql-imp-swiglib'] = { license = "see context related readme files" } +if true then + logs.report("warning","swiglib is no longer supported") +end + -- As the regular library is flawed (i.e. there are crashes in the table -- construction code) and also not that efficient, Luigi Scarso looked into -- a swig binding. This is a bit more low level approach but as we stay diff --git a/tex/context/base/mkiv/util-sql-tracers.lua b/tex/context/base/mkiv/util-sql-tracers.lua index 44e32d256..0780f4d5b 100644 --- a/tex/context/base/mkiv/util-sql-tracers.lua +++ b/tex/context/base/mkiv/util-sql-tracers.lua @@ -10,7 +10,7 @@ local sql = utilities.sql local tracers = { } sql.tracers = tracers -sql.setmethod("swiglib") +sql.setmethod("library") local gsub, lower = string.gsub, string.lower diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua index 36f3eab19..ce4a37f07 100644 --- a/tex/context/base/mkiv/util-sql.lua +++ b/tex/context/base/mkiv/util-sql.lua @@ -26,7 +26,6 @@ if not modules then modules = { } end modules ['util-sql'] = { -- util-sql-imp-client.lua -- util-sql-imp-library.lua --- util-sql-imp-swiglib.lua -- util-sql-imp-lmxsql.lua -- local sql = require("util-sql") @@ -36,8 +35,7 @@ if not modules then modules = { } end modules ['util-sql'] = { -- { name = "data",type = "string" }, -- } -- --- local execute = sql.methods.swiglib.execute --- -- local execute = sql.methods.library.execute +-- local execute = sql.methods.library.execute -- -- local execute = sql.methods.client.execute -- -- local execute = sql.methods.lmxsql.execute -- @@ -114,7 +112,6 @@ if optional then local methods = { ffi = "mysql", library = "mysql", - swiglib = "mysql", postgress = "postgress", sqlite = "sqlite", sqlite3 = "sqlite", @@ -192,8 +189,7 @@ local function makeconverter(entries,celltemplate,wraptemplate) assignments[#assignments+1] = format("[%q] = %s,",name,value) end end - local code = format(wraptemplate,concat(shortcuts,"\n"),key and "{ }" or "data",key or "i",concat(assignments,"\n ")) - -- print(code) + local code = format(wraptemplate,concat(shortcuts,"\n"),key and "{ }" or "data",key or "i",concat(assignments,"\n ")) local func = load(code) return func and func() end diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index 0d1f39de9..e58befe30 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -10,7 +10,7 @@ utilities = utilities or { } utilities.strings = utilities.strings or { } local strings = utilities.strings -local format, gsub, rep, sub, find = string.format, string.gsub, string.rep, string.sub, string.find +local format, gsub, rep, sub, find, char = string.format, string.gsub, string.rep, string.sub, string.find, string.char local load, dump = load, string.dump local tonumber, type, tostring, next, setmetatable = tonumber, type, tostring, next, setmetatable local unpack, concat = table.unpack, table.concat @@ -622,14 +622,22 @@ local template = [[ return function(%s) return %s end ]] --- this might move +-- We only use fast serialize in controlled cases. + +-- local pattern = Cs(Cc('"') * ( +-- (1-S('"\\\n\r'))^1 +-- + P('"') / '\\"' +-- + P('\\') / '\\\\' +-- + P('\n') / '\\n' +-- + P('\r') / '\\r' +-- )^0 * Cc('"')) local pattern = Cs(Cc('"') * ( (1-S('"\\\n\r'))^1 - + P('"') / '\\"' - + P('\\') / '\\\\' - + P('\n') / '\\n' - + P('\r') / '\\r' + + P('"') / '\\034' + + P('\\') / '\\020' + + P('\n') / '\\013' + + P('\r') / '\\010' )^0 * Cc('"')) patterns.escapedquotes = pattern @@ -638,6 +646,27 @@ function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern = (1 - P("\\"))^1 ; pattern = Cs ( + pattern + * ( (P("\\") / "" * (digit^-3 / function(s) return char(tonumber(s)) end)) + pattern )^1 +) + +patterns.unescapedquotes = pattern + +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end + +-- function string.longifneeded(s) +-- if find(s,'["\\\n\r]') then +-- return "[===[" .. s .. "]===]" +-- else +-- return '"' .. s ..'"' +-- end +-- end + +string.texnewlines = lpeg.replacer(patterns.newline,"\r",true) + -- print(string.escapedquotes('1\\23\n"')) -- but for now here diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl index e5acca5c3..2bf7fab6f 100644 --- a/tex/context/base/mkxl/anch-pos.mkxl +++ b/tex/context/base/mkxl/anch-pos.mkxl @@ -286,6 +286,9 @@ % beware we need to pass \somethingexpanded or { } +% Is this really always needed? We use \enabletextarearegistration for page areas so why +% not also for this. + \protected\def\anch_mark_column_box#1#2% box n {\global\advance\c_anch_column\plusone \clf_markregionboxtaggedn#1{columnarea:\the\c_anch_column}#2\relax} % extra height diff --git a/tex/context/base/mkxl/back-lua.lmt b/tex/context/base/mkxl/back-lua.lmt index dc836f12b..f74dfaeb5 100644 --- a/tex/context/base/mkxl/back-lua.lmt +++ b/tex/context/base/mkxl/back-lua.lmt @@ -67,16 +67,16 @@ end local function result() -- todo: we're now still in the pdf backend but need different codeinjections local codeinjections = backends.pdf.codeinjections - local getvariable = codeinjections.getidentityvariable or function() end + local identity = interactions.general.getidentity() local jobname = environment.jobname or tex.jobname or "unknown" return { metadata = { unit = "bp", jobname = jobname, - title = getvariable("title") or jobname, - subject = getvariable("subject"), - author = getvariable("author"), - keywords = getvariable("keywords"), + title = identity.title, + subject = identity.subject, + author = identity.author, + keywords = identity.keywords, time = os.date("%Y-%m-%d %H:%M"), engine = environment.luatexengine .. " " .. environment.luatexversion, context = environment.version, diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt index 107ff3fdd..a646962e5 100644 --- a/tex/context/base/mkxl/buff-ini.lmt +++ b/tex/context/base/mkxl/buff-ini.lmt @@ -8,9 +8,10 @@ if not modules then modules = { } end modules ['buff-ini'] = { local concat = table.concat local type, next, load = type, next, load -local sub, format = string.sub, string.format +local sub, format, find, match = string.sub, string.format, string.find, string.match local splitlines, validstring, replacenewlines = string.splitlines, string.valid, string.replacenewlines -local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match +local P, S, C, Ct, Cs = lpeg.P, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cs +local patterns, lpegmatch = lpeg.patterns, lpeg.match local utfchar = utf.char local nameonly = file.nameonly local totable = string.totable @@ -54,6 +55,7 @@ local replacesuffix = file.replacesuffix local registertempfile = luatex.registertempfile local v_yes = variables.yes +local v_append = variables.append local eol = patterns.eol local space = patterns.space @@ -86,33 +88,63 @@ local function erase(name) cache[name] = nil end -local function assign(name,str,catcodes) - cache[name] = { - data = str, - catcodes = catcodes, - typeset = false, - } -end - -local function combine(name,str,prepend) - local buffer = cache[name] - if buffer then - buffer.data = prepend and (str .. buffer.data) or (buffer.data .. str) - buffer.typeset = false - else +local assign do + + -- Ther eis no gain in an immediate concatenating lpeg + + local action = whitespace^0 * C(P("+")^1 + P("*")) * whitespace^0 + local equal = whitespace^0 * patterns.equal * whitespace^0 + local name = C((1-action)^1) + local pattern = C((1-equal)^1) * equal * Ct((action + name)^1) + + assign = function(name,str,catcodes) + local target, content = lpegmatch(pattern,name) + if target and content then + for i=1,#content do + local c = content[i] + if c == "+" then + content[i] = "" + elseif c == "++" then + content[i] = " " + elseif c == "+++" then + content[i] = "\r\r" + elseif c == "*" then + content[i] = str + else + local s = cache[c] + content[i] = s and s.data or "" + end + end + name = target + str = concat(content) + end cache[name] = { data = str, + catcodes = catcodes, typeset = false, } end -end -local function prepend(name,str) - combine(name,str,true) end -local function append(name,str) - combine(name,str) +local prepend, append do + + local function combine(name,str,prepend) + local buffer = cache[name] + if buffer then + buffer.data = prepend and (str .. buffer.data) or (buffer.data .. str) + buffer.typeset = false + else + cache[name] = { + data = str, + typeset = false, + } + end + end + + prepend = function(name,str) combine(name,str,true) end + append = function(name,str) combine(name,str) end + end local function exists(name) @@ -124,6 +156,14 @@ local function getcontent(name) return buffer and buffer.data or "" end +local function empty(name) + if find(getcontent(name),"%S") then + return false + else + return true + end +end + local function getlines(name) local buffer = name and cache[name] return buffer and splitlines(buffer.data) @@ -200,6 +240,7 @@ buffers.assign = assign buffers.prepend = prepend buffers.append = append buffers.exists = exists +buffers.empty = empty buffers.getcontent = getcontent buffers.getlines = getlines buffers.collectcontent = collectcontent @@ -642,7 +683,7 @@ implement { end } -local function savebuffer(list,name,prefix) -- name is optional +local function savebuffer(list,name,prefix,option,directory) -- name is optional if not list or list == "" then list = name end @@ -656,13 +697,16 @@ local function savebuffer(list,name,prefix) -- name is optional if prefix == v_yes then name = addsuffix(tex.jobname .. "-" .. name,"tmp") end - io.savedata(name,replacenewlines(content)) + if directory ~= "" and dir.makedirs(directory) then + name = file.join(directory,name) + end + io.savedata(name,replacenewlines(content),"\n",option == v_append) end implement { name = "savebuffer", actions = savebuffer, - arguments = "3 strings", + arguments = "5 strings", } -- we can consider adding a size to avoid unlikely clashes @@ -675,10 +719,11 @@ local runner = sandbox.registerrunner { name = "run buffer", program = "context", method = "execute", - template = jit and "--purgeall --jit %filename%" or "--purgeall %filename%", + template = [[--purgeall %?path: --path=%path% ?% %filename%]], reporter = report_typeset, checkers = { filename = "readable", + path = "string", } } @@ -769,7 +814,10 @@ local function runbuffer(name,encapsulate,runnername,suffixes) end savedata(filename,content) report_typeset("processing saved buffer %a\n",filename) - runner { filename = filename } + runner { + filename = filename, + path = environment.arguments.path, -- maybe take all set paths + } end new[tag] = (new[tag] or 0) + 1 report_typeset("no changes in %a, processing skipped",name) @@ -846,6 +894,16 @@ implement { implement { name = "doifelsebuffer", actions = { exists, commands.doifelse }, + public = true, + -- protected = false, + arguments = "string" +} + +implement { + name = "doifelsebufferempty", + actions = { empty, commands.doifelse }, + public = true, + protected = true, arguments = "string" } @@ -885,10 +943,10 @@ end -- moved here: function buffers.samplefile(name) - if not buffers.exists(name) then - buffers.assign(name,io.loaddata(resolvers.findfile(name))) + if not exists(name) then + assign(name,io.loaddata(resolvers.findfile(name))) end - buffers.get(name) + getbuffer(name) end implement { diff --git a/tex/context/base/mkxl/buff-ini.mkxl b/tex/context/base/mkxl/buff-ini.mkxl index 7512dea02..a91e3272b 100644 --- a/tex/context/base/mkxl/buff-ini.mkxl +++ b/tex/context/base/mkxl/buff-ini.mkxl @@ -24,7 +24,8 @@ \mutable\let\currentbuffer\empty -\permanent\def\doifelsebuffer#1{\clf_doifelsebuffer{#1}} % expandable, todo: use public implementor +% \doifelsebuffer {#1} % expandable +% \doifelsebufferempty {#1} % non expandable \aliased\let\doifbufferelse\doifelsebuffer @@ -188,12 +189,14 @@ % \savebufferinfile[x][temp.log] % gets name: temp.log \installcorenamespace{savebuffer} +\installcorenamespace{savebuffercounter} -\installsetuponlycommandhandler \??savebuffer {savebuffer} +\installcommandhandler \??savebuffer {savebuffer} \??savebuffer \setupsavebuffer [\c!list=, \c!file=, + \c!directory=, \c!prefix=\v!yes] \permanent\tolerant\protected\def\savebuffer[#1]#*[#2]% @@ -203,9 +206,54 @@ \else \setupcurrentsavebuffer[\c!list={#1},\c!file=#2]% \fi - \clf_savebuffer{\directsavebufferparameter\c!list}{\directsavebufferparameter\c!file}{\directsavebufferparameter\c!prefix}% + \clf_savebuffer % will become key/value + {\savebufferparameter\c!list}% + {\savebufferparameter\c!file}% + {\savebufferparameter\c!prefix}% + {\savebufferparameter\c!option}% + {\savebufferparameter\c!directory}% \endgroup} +%D \starttyping +%D \definesavebuffer[slide] +%D +%D \starttext +%D \startslide +%D \starttext +%D \stopslide +%D \startslide +%D slide 1 +%D \stopslide +%D text 1 \par +%D \startslide +%D slide 2 +%D \stopslide +%D text 2 \par +%D \startslide +%D \stoptext +%D \stopslide +%D \stoptext +%D \stoptyping + +\appendtoks + \ifcsname\e!stop\currentsavebuffer\endcsname\else + \definebuffer[\currentsavebuffer]% + \expandafter\newcount\csname\??savebuffercounter\currentsavebuffer\endcsname + \protected\edefcsname\e!stop\currentsavebuffer\endcsname{\buff_stop_save_buffer{\currentsavebuffer}}% + \setsavebufferparameter\c!file{\currentsavebuffer.tex}% + \fi +\to \everydefinesavebuffer + +\protected\def\buff_stop_save_buffer#1% + {\edef\currentsavebuffer{#1}% + \global\advance\csname\??savebuffercounter\currentsavebuffer\endcsname\plusone + \clf_savebuffer % will become key/value + {\thedefinedbuffer{\currentsavebuffer}}% + {\savebufferparameter\c!file}% + {\savebufferparameter\c!prefix}% + {\ifnum\csname\??savebuffercounter\currentsavebuffer\endcsname>\plusone\v!append\fi}% + {\savebufferparameter\c!directory}} + %D Experimental: no expansion of commands in buffer! % \startbuffer[what] diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 3d35f23e0..3b0b1b446 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.30 00:41} +\newcontextversion{2021.08.04 17:48} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 3a28a1a84..d90cbc657 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.07.30 00:41} +\immutable\edef\contextversion{2021.08.04 17:48} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/file-mod.lmt b/tex/context/base/mkxl/file-mod.lmt index 6af5d8816..d10abf533 100644 --- a/tex/context/base/mkxl/file-mod.lmt +++ b/tex/context/base/mkxl/file-mod.lmt @@ -177,7 +177,11 @@ function environment.usemodules(prefix,askedname,truename) for i=1,#prefixes do -- todo: reconstruct name i.e. basename local thename = prefixes[i] .. "-" .. truename - if usemodule(thename) then + if thename == tex.jobname then + -- in case we process a module + status = 1 + break + elseif usemodule(thename) then status = 1 break end diff --git a/tex/context/base/mkxl/file-mod.mklx b/tex/context/base/mkxl/file-mod.mklx index 24471e30f..ddcbcba3f 100644 --- a/tex/context/base/mkxl/file-mod.mklx +++ b/tex/context/base/mkxl/file-mod.mklx @@ -259,4 +259,7 @@ \aliased\let\fetchruntimecommand\fetchmodulecommand % obsolete +% \permanent\protected\def\moduleoverloaded +% {\enforced} + \protect \endinput diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt index 1587919f0..801132daa 100644 --- a/tex/context/base/mkxl/font-chk.lmt +++ b/tex/context/base/mkxl/font-chk.lmt @@ -159,9 +159,9 @@ checkers.mapping = mapping -- sure the dimensions are known at the lua and tex end. For previous variants see -- the mkiv files or older lmtx files. I decided to just drop the old stuff here. -function checkers.placeholder(font,char) - local category = chardata[char].category or "lu" -- todo: unknown - local fakedata = mapping[category] +function checkers.placeholder(font,char,category) + local category = category or chardata[char].category or "lu" -- todo: unknown + local fakedata = mapping[category] or mapping.lu local tfmdata = fontdata[font] local units = tfmdata.parameters.units or 1000 local slant = (tfmdata.parameters.slant or 0)/65536 diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index a6e962872..ed8c22f58 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -3033,7 +3033,7 @@ end do - local getfontoffamily = font.getfontoffamily + local getfontoffamily = tex.getfontoffamily local new_glyph = nodes.pool.glyph local fontproperties = fonts.hashes.properties diff --git a/tex/context/base/mkxl/grph-fig.mkxl b/tex/context/base/mkxl/grph-fig.mkxl index d06e185dd..4a717a8c9 100644 --- a/tex/context/base/mkxl/grph-fig.mkxl +++ b/tex/context/base/mkxl/grph-fig.mkxl @@ -78,7 +78,9 @@ \installcorenamespace{typesettingfile} \tolerant\permanent\protected\def\definetypesetting[#1]#*[#2]#*[#3]% options settings-a - {\ifparameter#1\or\setuvalue{\??typesettingfile#1}{\grph_typesetting_process_indeed{#2}{#3}}\fi} + {\ifparameter#1\or + \frozen\instance\protected\defcsname\??typesettingfile#1\endcsname{\grph_typesetting_process_indeed{#2}{#3}}% + \fi} \tolerant\permanent\protected\def\typesetfile[#1]#*[#2]#*[#3]% filename settings-b | filename options settings {\ifcsname\??typesettingfile#1\endcsname diff --git a/tex/context/base/mkxl/lang-def.mkxl b/tex/context/base/mkxl/lang-def.mkxl index cc94bf7ae..603935097 100644 --- a/tex/context/base/mkxl/lang-def.mkxl +++ b/tex/context/base/mkxl/lang-def.mkxl @@ -564,8 +564,7 @@ \c!rightquote=\upperrightsingleninequote, %U+2019, \c!leftquotation=\upperleftdoublesixquote, %U+201C, \c!rightquotation=\upperrightdoubleninequote, %U+201D, - \c!date={\v!year,~m.,\space,\v!month,\space,\v!day,~d.}, - \c!date={\v!day-a\space de\space \v!month\space \v!year}, + \c!date={\v!day,-a\space de\space,\v!month,\space \v!year}, \s!patterns=eo, \s!lefthyphenmin=2, \s!righthyphenmin=2] diff --git a/tex/context/base/mkxl/lpdf-mis.lmt b/tex/context/base/mkxl/lpdf-mis.lmt index 73f7bcf06..db8ad2cbe 100644 --- a/tex/context/base/mkxl/lpdf-mis.lmt +++ b/tex/context/base/mkxl/lpdf-mis.lmt @@ -186,21 +186,7 @@ end lpdf.registerpagefinalizer (flushpageactions, "page actions") lpdf.registerdocumentfinalizer(flushdocumentactions,"document actions") ---- info : this can change and move elsewhere - -local identity = { } - -function codeinjections.setupidentity(specification) - for k, v in next, specification do - if v ~= "" then - identity[k] = v - end - end -end - -function codeinjections.getidentityvariable(name) - return identity[name] -end +-- the code above will move to scrn-ini local done = false -- using "setupidentity = function() end" fails as the meaning is frozen in register @@ -212,22 +198,21 @@ local function setupidentity() local time = metadata.time local jobname = environment.jobname or tex.jobname or "unknown" -- + local identity = interactions.general.getidentity() + -- local title = identity.title - if not title or title == "" then - title = tex.jobname - end addtoinfo("Title", pdfunicode(title), title) - local subtitle = identity.subtitle or "" + local subtitle = identity.subtitle if subtitle ~= "" then addtoinfo("Subject", pdfunicode(subtitle), subtitle) end - local author = identity.author or "" + local author = identity.author if author ~= "" then addtoinfo("Author", pdfunicode(author), author) -- '/Author' in /Info, 'Creator' in XMP end addtoinfo("Creator", pdfunicode(creator), creator) addtoinfo("CreationDate", pdfstring(formattedtimestamp(time))) - local date = identity.date or "" + local date = identity.date local pdfdate = date and formattedtimestamp(date) if pdfdate then addtoinfo("ModDate", pdfstring(pdfdate), date) @@ -236,7 +221,7 @@ local function setupidentity() -- and if not provided that way we use the creation time instead addtoinfo("ModDate", pdfstring(formattedtimestamp(time)),time) end - local keywords = identity.keywords or "" + local keywords = identity.keywords if keywords ~= "" then keywords = concat(settings_to_array(keywords), " ") addtoinfo("Keywords", pdfunicode(keywords), keywords) diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt index a75053c94..fcc7b9c99 100644 --- a/tex/context/base/mkxl/lpdf-wid.lmt +++ b/tex/context/base/mkxl/lpdf-wid.lmt @@ -259,7 +259,7 @@ local function flushembeddedfiles() for tag, reference in sortedhash(filestreams) do if not reference then report_attachment("unreferenced file, tag %a",tag) - elseif referenced[tag] == "hidden" then + elseif referenced[tag] == "hidden" or referenced[tag] == "forced" then e[#e+1] = pdfstring(tag) e[#e+1] = reference -- already a reference f[#f+1] = reference -- collect all file description references @@ -369,6 +369,9 @@ function codeinjections.embedfile(specification) } local r = pdfreference(pdfflushobject(d)) filestreams[hash] = r + if specification.forcereference == true then + referenced[hash] = "forced" + end return r end end @@ -652,9 +655,6 @@ local function insertrenderingwindow(specification) } local width = specification.width or 0 local height = specification.height or 0 - if height == 0 or width == 0 then - -- todo: sound needs no window - end context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref return pdfreference(r) end @@ -705,9 +705,10 @@ local function insertrendering(specification) descriptor = pdfreference(pdfflushobject(descriptor)) elseif option[v_embed] then descriptor = codeinjections.embedfile { - file = filename, - mimetype = mimetype, -- yes or no - compress = false, + file = filename, + mimetype = mimetype, -- yes or no + compress = false, + forcereference = true, } end local clip = pdfdictionary { diff --git a/tex/context/base/mkxl/luat-log.lmt b/tex/context/base/mkxl/luat-log.lmt index ee8ad4fa3..2b5b60dd9 100644 --- a/tex/context/base/mkxl/luat-log.lmt +++ b/tex/context/base/mkxl/luat-log.lmt @@ -14,7 +14,8 @@ if not modules then modules = { } end modules ['luat-log'] = { -- mtxrun. -- -- We use different targets: "terminal" "logfile", "both" and have no number --- channel. +-- channel. Actually, the log channels are now numeric (1,2,3) as with other +-- symbolics. local next, type, select, print = next, type, select, print local format, gmatch, find = string.format, string.gmatch, string.find @@ -120,21 +121,17 @@ do status_yes = formatters["%-15s : %s\n"], status_nop = formatters["%-15s :\n"], }, - targets = setmetatableindex( { --- logfile = "logfile", --- log = "logfile", --- file = "logfile", --- console = "terminal", --- terminal = "terminal", --- both = "terminal_and_logfile", + targets = setmetatableindex( { -- 1, 2, 3, logfile = 2, log = 2, file = 2, console = 1, terminal = 1, both = 3, --- }, function(t,k) local v = "terminal_and_logfile" t[k] = v return v end), - }, function(t,k) local v = 3 t[k] = v return v end), + }, + function(t,k) + local v = 3 t[k] = v return v + end), }, ansi = { formats = { @@ -149,17 +146,13 @@ do status_yes = formatters["%-15s : %s\n"], status_nop = formatters["%-15s :\n"], }, - targets = setmetatableindex( { + targets = setmetatableindex( { 1, 1, 1, logfile = false, log = false, file = false, --- console = "terminal", --- terminal = "terminal", --- both = "terminal", console = 1, terminal = 1, both = 1, --- }, function(t,k) local v = "terminal" t[k] = v return v end), }, function(t,k) local v = 1 t[k] = v return v end), } } @@ -261,7 +254,7 @@ do whereto = "both" target = targets[whereto] end - if target == "terminal" or target == "terminal_and_logfile" then + if target == targets.both or target == targets.terminal then logs.flush = io.flush else logs.flush = ignore diff --git a/tex/context/base/mkxl/mlib-fio.lmt b/tex/context/base/mkxl/mlib-fio.lmt index d51b222cf..d0917392a 100644 --- a/tex/context/base/mkxl/mlib-fio.lmt +++ b/tex/context/base/mkxl/mlib-fio.lmt @@ -286,6 +286,7 @@ function mplib.new(specification) -- random_seed = specification.seed, utf8_mode = true, text_mode = true, + show_mode = true, -- not used -- noninteractive = true; -- ini_version = true, diff --git a/tex/context/base/mkxl/mult-def.mkxl b/tex/context/base/mkxl/mult-def.mkxl index 13e22dade..de57d93b9 100644 --- a/tex/context/base/mkxl/mult-def.mkxl +++ b/tex/context/base/mkxl/mult-def.mkxl @@ -15,14 +15,14 @@ \installcorenamespace{multilingual} -\immutable\setvalue{\??multilingual czech}{cs} -\immutable\setvalue{\??multilingual german}{de} -\immutable\setvalue{\??multilingual english}{en} -\immutable\setvalue{\??multilingual french}{fr} -\immutable\setvalue{\??multilingual italian}{it} -\immutable\setvalue{\??multilingual dutch}{nl} -\immutable\setvalue{\??multilingual persian}{pe} -\immutable\setvalue{\??multilingual romanian}{ro} +\immutable\defcsname\??multilingual czech\endcsname{cs} +\immutable\defcsname\??multilingual german\endcsname{de} +\immutable\defcsname\??multilingual english\endcsname{en} +\immutable\defcsname\??multilingual french\endcsname{fr} +\immutable\defcsname\??multilingual italian\endcsname{it} +\immutable\defcsname\??multilingual dutch\endcsname{nl} +\immutable\defcsname\??multilingual persian\endcsname{pe} +\immutable\defcsname\??multilingual romanian\endcsname{ro} \permanent\def\userinterfacetag{\ifcsname\??multilingual\currentinterface\endcsname\lastnamedcs\else en\fi} \permanent\def\userresponsestag{\ifcsname\??multilingual\currentresponses\endcsname\lastnamedcs\else en\fi} diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl index 0e7540921..bd574be07 100644 --- a/tex/context/base/mkxl/pack-mrl.mkxl +++ b/tex/context/base/mkxl/pack-mrl.mkxl @@ -189,7 +189,7 @@ \s!height\linewidth \s!depth \zeropoint}} -% \let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere .. not any more +\let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere .. in font manual %D \macros %D {hairline, thinrule, thinrules, setupthinrules} diff --git a/tex/context/base/mkxl/scrn-ini.lmt b/tex/context/base/mkxl/scrn-ini.lmt new file mode 100644 index 000000000..82b9bd02e --- /dev/null +++ b/tex/context/base/mkxl/scrn-ini.lmt @@ -0,0 +1,54 @@ +if not modules then modules = { } end modules ['scrn-ini'] = { + version = 1.001, + comment = "companion to scrn-int.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local next = next + +-- We delay preroll because it needs a font and don't want to force a font load (at +-- startup) because we preset a field so some are tokenlists as we need to preserve +-- catcodes. + +interactions = { } +interactions.general = interactions.general or { } +local general = interactions.general + +local expand_macro = token.expand_macro + +local prerolled = { } +local identitydata = { } + +local function setidentityvariable(key,value) + prerolled[key] = value +end + +table.setmetatableindex(identitydata, function(t,k) + if k == "keywords" then + k = "keyword" + end + -- fetch and process at the tex end (catcode etc) + expand_macro("scrn_identity_get",true,k) + -- return the registered return value + local v = prerolled[k] or "" + if k == "title" and v == "" then + v = tex.jobname + end + return v +end) + +function general.getidentityvariable(name) + return identitydata[name] +end + +function general.getidentity() + return identitydata +end + +interfaces.implement { + name = "setidentityvariable", + actions = setidentityvariable, + arguments = "2 strings", +} diff --git a/tex/context/base/mkxl/scrn-ini.mklx b/tex/context/base/mkxl/scrn-ini.mklx index c0246bc83..8a7f89c42 100644 --- a/tex/context/base/mkxl/scrn-ini.mklx +++ b/tex/context/base/mkxl/scrn-ini.mklx @@ -15,7 +15,7 @@ \unprotect -\registerctxluafile{scrn-ini}{} +\registerctxluafile{scrn-ini}{autosuffix} %D There is no interaction at all unless enabled by saying: %D @@ -184,56 +184,11 @@ %D Identity -% \newconditional\c_scrn_identity_preroll -% -% \installtexdirective -% {interaction.identity.preroll} -% {\settrue \c_scrn_identity_preroll} -% {\setfalse\c_scrn_identity_preroll} -% -% \def\scrn_identity_prerolled#1% -% {\begingroup -% \edef\tempstring{\interactionparameter#1}% -% \ifempty\tempstring -% \endgroup -% \else -% \the\everypreroll -% \nodestostring\tempstring{\tempstring}% -% \normalexpanded{\endgroup\setexpandedinteractionparameter{#1}{\tempstring}}% -% \fi} -% -% \def\scrn_identity_synchronize -% {\begingroup -% \ifconditional\c_scrn_identity_preroll -% \scrn_identity_prerolled\c!title -% \scrn_identity_prerolled\c!subtitle -% \scrn_identity_prerolled\c!author -% \scrn_identity_prerolled\c!date -% \scrn_identity_prerolled\c!keyword -% \fi -% \clf_setupidentity -% title {\interactionparameter\c!title}% -% subtitle {\interactionparameter\c!subtitle}% -% author {\interactionparameter\c!author}% -% % creator {ConTeXt - \contextversion}% -% date {\interactionparameter\c!date}% -% keywords {\interactionparameter\c!keyword}% -% \relax -% \endgroup} - -\def\scrn_identity_synchronize - {\clf_setupidentity - title {\prerolltostring{\interactionparameter\c!title}}% - subtitle {\prerolltostring{\interactionparameter\c!subtitle}}% - author {\prerolltostring{\interactionparameter\c!author}}% - % creator {ConTeXt - \contextversion}% fixed - date {\prerolltostring{\interactionparameter\c!date}}% - keywords {\prerolltostring{\interactionparameter\c!keyword}}% - \relax} +%D We want to delay the preroll as it needs fonts so we now actively fetch from +%D the \LUA\ end. So this one gets called by the time we need the value. -\appendtoks - \scrn_identity_synchronize -\to \everysetupinteraction +\def\scrn_identity_get#1% + {\clf_setidentityvariable{#1}{\prerolltostring{\interactionparameter{#1}}}} % this comes before starttext diff --git a/tex/context/base/mkxl/strc-blk.mkxl b/tex/context/base/mkxl/strc-blk.mkxl index 4cfbd51eb..6b1daa0cc 100644 --- a/tex/context/base/mkxl/strc-blk.mkxl +++ b/tex/context/base/mkxl/strc-blk.mkxl @@ -168,4 +168,6 @@ \permanent\protected\def\processblocks{\strc_blocks_select [process]} \permanent\protected\def\selectblocks {\strc_blocks_select [use]} +\permanent\protected\def\doifelseblocksempty{\clf_doifelsestructureblocksempty} % {name}{tag}{criterium} + \protect \endinput diff --git a/tex/context/base/mkxl/strc-con.mklx b/tex/context/base/mkxl/strc-con.mklx index d700899b3..ba9c62d48 100644 --- a/tex/context/base/mkxl/strc-con.mklx +++ b/tex/context/base/mkxl/strc-con.mklx @@ -146,22 +146,21 @@ \appendtoks \ifconditional\c_strc_constructions_define_commands - %% \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\strc_constructions_start{\currentconstruction}}% - \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\strc_constructions_start[\currentconstruction]}% - \protected\instance\edefcsname\e!stop \currentconstruction\endcsname{\strc_constructions_stop}% + \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\startnamedconstruction[\currentconstruction]}% + \protected\instance \defcsname\e!stop \currentconstruction\endcsname{\stopnamedconstruction}% \fi \to \everydefineconstruction %D Just a basic environment (mostly for testing). We will provide a 'setup' based %D plugin once the rest is sorted out. -\tolerant\protected\def\strc_constructions_start[#1]#*[#2]#*[#3]% +\tolerant\permanent\protected\def\startnamedconstruction[#1]#*[#2]#*[#3]% {\begingroup \strc_constructions_initialize{#1}% \strc_constructions_register[#3][\c!label={\constructionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,\c!referencetext=,#2]% \csname\??constructionstarthandler\currentconstructionhandler\endcsname} -\protected\def\strc_constructions_stop +\permanent\protected\def\stopnamedconstruction {\csname\??constructionstophandler\currentconstructionhandler\endcsname \endgroup} @@ -196,11 +195,11 @@ \newconditional\c_strc_constructions_number_state \newconditional\c_strc_constructions_title_state -\protected\setvalue{\??constructioninitializer\v!construction}% +\protected\defcsname\??constructioninitializer\v!construction\endcsname {\setfalse\c_strc_constructions_number_state \setfalse\c_strc_constructions_title_state} -\protected\setvalue{\??constructionfinalizer\v!construction}% +\protected\defcsname\??constructionfinalizer\v!construction\endcsname {} %D We keep the command variant around but rather would move to the start-stop one. @@ -331,7 +330,7 @@ % we also need to make sure that no stretch creeps in (new per 2015-02-02, for Alan) \settrue\c_strc_constructions_distance_none} -\protected\setvalue{\??constructionstarthandler\v!construction}% this will be redone (reorganized) .. too much boxing +\protected\defcsname\??constructionstarthandler\v!construction\endcsname % this will be redone (reorganized) .. too much boxing {\dostarttaggedchained\t!construction\currentconstruction\currentconstructionhash % \dotagsetconstruction \constructionparameter\c!before diff --git a/tex/context/base/mkxl/strc-des.mklx b/tex/context/base/mkxl/strc-des.mklx index 1eab07d7d..835c6807e 100644 --- a/tex/context/base/mkxl/strc-des.mklx +++ b/tex/context/base/mkxl/strc-des.mklx @@ -67,9 +67,9 @@ \defineconstruction[\currentdescription][\s!handler=\v!description,\c!level=1]% \fi % We can combine these but in tracing (or errors) using a different caller is nicer. - \frozen\protected\instance\edefcsname \currentdescription\endcsname{\strc_descriptions_command[\currentdescription]}% - \frozen\protected\instance\edefcsname\e!start\currentdescription\endcsname{\strc_descriptions_start [\currentdescription]}% - \frozen\protected\instance\edefcsname\e!stop \currentdescription\endcsname{\strc_descriptions_stop}% + \frozen\protected\instance\edefcsname \currentdescription\endcsname{\nameddescription[\currentdescription]}% + \frozen\protected\instance\edefcsname\e!start\currentdescription\endcsname{\startnameddescription[\currentdescription]}% + \frozen\protected\instance \defcsname \e!stop\currentdescription\endcsname{\stopnameddescription}% \to \everydefinedescription \let\p_strc_constructions_title \empty @@ -99,7 +99,7 @@ % A bit over the top, the optional title but mkii has it too. -\tolerant\protected\def\strc_descriptions_start[#1]#*[#2]% +\tolerant\permanent\protected\def\startnameddescription[#1]#*[#2]% {\begingroup \strc_constructions_initialize{#1}% \ifhastok={#2}% @@ -130,13 +130,13 @@ {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=,\c!referencetext=]% \csname\??constructionstarthandler\currentconstructionhandler\endcsname} -\protected\def\strc_descriptions_stop +\permanent\protected\def\stopnameddescription {\csname\??constructionstophandler\currentconstructionhandler\endcsname} % \description [reference] text \par % \description [reference] {title} text \par -\tolerant\protected\def\strc_descriptions_command[#1]#*[#2]% +\tolerant\permanent\protected\def\nameddescription[#1]#*[#2]% {\begingroup \strc_constructions_initialize{#1}% \ifhastok={#2}% diff --git a/tex/context/base/mkxl/strc-enu.mklx b/tex/context/base/mkxl/strc-enu.mklx index 4bcdb6c4f..a6ba99ce7 100644 --- a/tex/context/base/mkxl/strc-enu.mklx +++ b/tex/context/base/mkxl/strc-enu.mklx @@ -131,15 +131,15 @@ \protected\def\strc_define_commands_enumeration#tag#level#parent% {\doifelsenothing{#parent} {\normalexpanded{\defineconstruction[#tag][\s!handler=\v!enumeration,\c!level=#level]}% - \setevalue{\??enumeration#tag:\s!parent}{\??enumeration}}% + \edefcsname\??enumeration#tag:\s!parent\endcsname{\??enumeration}}% {\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!enumeration,\c!level=#level]}% - \setevalue{\??enumeration#tag:\s!parent}{\??enumeration#parent}}% - \frozen\instance\setuevalue{\e!next #tag}{\strc_enumerations_next {#tag}{\number#level}}% obsolete - \frozen\instance\setuevalue{\c!reset#tag}{\strc_enumerations_reset {#tag}{\number#level}}% obsolete - %frozen\instance\setuevalue{\c!set #tag}{\strc_enumerations_set {#tag}{\number#level}}% obsolete - \frozen\instance\setuevalue {#tag}{\strc_enumerations_command[#tag]}% we could pass level here as well (faster) - \frozen\instance\setuevalue{\e!start#tag}{\strc_enumerations_start [#tag]}% we could pass level here as well (faster) - \frozen\instance\setuevalue{\e!stop #tag}{\strc_enumerations_stop }} + \edefcsname\??enumeration#tag:\s!parent\endcsname{\??enumeration#parent}}% + \frozen\protected\instance\edefcsname\e!next #tag\endcsname{\strc_enumerations_next{#tag}{\number#level}}% obsolete + \frozen\protected\instance\edefcsname\c!reset#tag\endcsname{\strc_enumerations_reset{#tag}{\number#level}}% obsolete + %frozen\protected\instance\edefcsname\c!set #tag\endcsname{\strc_enumerations_set{#tag}{\number#level}}% obsolete + \frozen\protected\instance\edefcsname #tag\endcsname{\namedenumeration[#tag]}% + \frozen\protected\instance\edefcsname\e!start#tag\endcsname{\startnamedenumeration[#tag]}% + \frozen\protected\instance \defcsname\e!stop #tag\endcsname{\stopnamedenumeration}} \let\m_strc_enumeration_sub\empty @@ -180,7 +180,7 @@ \let\p_strc_constructions_title \empty \let\p_strc_constructions_number\empty -\protected\setvalue{\??constructioninitializer\v!enumeration}% +\protected\defcsname\??constructioninitializer\v!enumeration\endcsname {\let \currentenumeration \currentconstruction \enforced\let\constructionparameter \enumerationparameter \enforced\let\constructionnamespace \??enumeration @@ -205,7 +205,7 @@ \setfalse\c_strc_constructions_title_state \fi} -\protected\setvalue{\??constructionfinalizer\v!enumeration}% +\protected\defcsname\??constructionfinalizer\v!enumeration\endcsname {\ifconditional\c_strc_constructions_number_state \iftrialtypesetting \strc_counters_restore\currentconstructionnumber @@ -214,9 +214,9 @@ %D Interfaces: -\let\strc_enumerations_command\strc_descriptions_command -\let\strc_enumerations_start \strc_descriptions_start -\let\strc_enumerations_stop \strc_descriptions_stop +\let\namedenumeration \nameddescription +\let\startnamedenumeration\startnameddescription +\let\stopnamedenumeration \stopnameddescription \protected\def\strc_enumerations_next {\strc_constructions_next_indeed \namedenumerationparameter} % #1#2 \protected\def\strc_enumerations_reset{\strc_constructions_reset_indeed\namedenumerationparameter} % #1#2 @@ -250,7 +250,7 @@ \letcsname\??constructionstarthandler \v!enumeration\expandafter\endcsname\csname\??constructionstarthandler \v!description\endcsname \letcsname\??constructionstophandler \v!enumeration\expandafter\endcsname\csname\??constructionstophandler \v!description\endcsname -\protected\setvalue{\??constructiontexthandler\v!enumeration}% +\protected\defcsname\??constructiontexthandler\v!enumeration\endcsname {\begingroup \useconstructionstyleandcolor\c!headstyle\c!headcolor \strc_enumerations_text diff --git a/tex/context/base/mkxl/strc-lab.mkxl b/tex/context/base/mkxl/strc-lab.mkxl index 3794fdca9..368a412a7 100644 --- a/tex/context/base/mkxl/strc-lab.mkxl +++ b/tex/context/base/mkxl/strc-lab.mkxl @@ -148,8 +148,8 @@ %D Interfaces: -\protected\def\strc_labels_command{\setfalse\c_strc_constructions_number_keep\strc_descriptions_command} -\protected\def\strc_labels_current{\settrue \c_strc_constructions_number_keep\strc_descriptions_command} +\protected\def\strc_labels_command{\setfalse\c_strc_constructions_number_keep\nameddescription} +\protected\def\strc_labels_current{\settrue \c_strc_constructions_number_keep\nameddescription} \protected\def\strc_labels_next {\strc_constructions_next_indeed \namedlabelparameter} % #1#2 \protected\def\strc_labels_reset {\strc_constructions_reset_indeed\namedlabelparameter} % #1#2 diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx index 0adb23566..e9038b1b9 100644 --- a/tex/context/base/mkxl/strc-not.mklx +++ b/tex/context/base/mkxl/strc-not.mklx @@ -140,11 +140,11 @@ {\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!notation,\c!level=#level]}% \edefcsname\??note #tag:\s!parent\endcsname{\??note#parent}% see later for \s!note \edefcsname\??notation#tag:\s!parent\endcsname{\??notation#parent}}% - \instance\protected\edefcsname\e!next #tag\endcsname{\strc_notations_next {#tag}{\number#level}}% obsolete - \instance\protected\edefcsname\c!reset#tag\endcsname{\strc_notations_reset {#tag}{\number#level}}% obsolete + \instance\protected\edefcsname\e!next #tag\endcsname{\strc_notations_next{#tag}{\number#level}}% obsolete + \instance\protected\edefcsname\c!reset#tag\endcsname{\strc_notations_reset{#tag}{\number#level}}% obsolete \instance\protected\edefcsname #tag\endcsname{\strc_notations_command[#tag]}% - \instance\protected\edefcsname\e!start#tag\endcsname{\strc_notations_start [#tag]}% - \instance\protected\edefcsname\e!stop #tag\endcsname{\strc_notations_stop }} + \instance\protected\edefcsname\e!start#tag\endcsname{\strc_notations_start[#tag]}% + \instance\protected\edefcsname\e!stop #tag\endcsname{\strc_notations_stop}} \let\m_strc_notation_sub\empty @@ -187,7 +187,7 @@ \let\p_strc_constructions_title \empty \let\p_strc_constructions_number\empty -\protected\setvalue{\??constructioninitializer\v!notation}% +\protected\defcsname\??constructioninitializer\v!notation\endcsname {\let \currentnotation \currentconstruction \enforced\let\constructionparameter \notationparameter \enforced\let\constructionnamespace \??notation @@ -212,7 +212,7 @@ \setfalse\c_strc_constructions_title_state \fi} -\protected\setvalue{\??constructionfinalizer\v!notation}% +\protected\defcsname\??constructionfinalizer\v!notation\endcsname {\ifconditional\c_strc_constructions_number_state \iftrialtypesetting \strc_counters_restore\currentconstructionnumber @@ -280,32 +280,45 @@ \strc_constructions_finalize \strc_notations_finalize} -\tolerant\protected\def\strc_notations_start[#1]#*[#2]% +\tolerant\protected\def\strc_notations_start + {\strc_notations_start_indeed{\csname\e!stop\currentnotation\endcsname}} + +\tolerant\protected\defcsname\e!start\e!namednotation\endcsname + {\strc_notations_start_indeed{\csname\e!stop\e!namednotation\endcsname}} + +\ifdefined\startnamednotation + % we're in the english interface +\else + \tolerant\protected\def\startnamednotation + {\strc_notations_start_indeed\stopnamednotation} +\fi + +\tolerant\protected\def\strc_notations_start_indeed#1#*[#2]#*[#3]% {\begingroup - \edef\currentnote{#1}% - \strc_constructions_initialize{#1}% + \edef\currentnote{#2}% + \strc_constructions_initialize{#2}% \strc_notes_synchronize \ifnotesenabled \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel \fi - \ifhastok={#2}% + \ifhastok={#3}% \expandafter\strc_notations_start_setups \else \expandafter\strc_notations_start_reference - \fi[#2]} + \fi#1[#2]} \let\strc_notations_pickup_yes\relax -\protected\def\strc_notations_start_setups[#1]% - {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_setups_indeed[#1]{##1}}}% +\protected\def\strc_notations_start_setups#1[#2]% + {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/#1{\strc_notations_start_setups_indeed[#2]{##1}}}% \strc_notations_pickup_yes} \protected\def\strc_notations_start_setups_indeed[#1]#*#2% {\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=,#1]% \strc_notations_wrapup} -\protected\def\strc_notations_start_reference[#1]% - {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_reference_indeed[#1]{##1}}}% +\protected\def\strc_notations_start_reference#1[#2]% + {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/#1{\strc_notations_start_reference_indeed[#2]{##1}}}% \strc_notations_pickup_yes} \protected\def\strc_notations_start_reference_indeed[#1]#*#2% @@ -323,7 +336,7 @@ \protected\defcsname\??constructionnotehandler\v!notation\endcsname {\csname\??constructionnotehandler\currentconstructionhandler:\constructionparameter\c!type\endcsname} -\protected\defcsname\??constructionnotehandler\v!notation:\endcsname% empty case +\protected\defcsname\??constructionnotehandler\v!notation:\endcsname % empty case {[\currentconstructionhandler:\currentconstruction]} %D Here is a simple renderer for notes diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl index 19eeb262e..54b74fe4c 100644 --- a/tex/context/base/mkxl/strc-sec.mkxl +++ b/tex/context/base/mkxl/strc-sec.mkxl @@ -847,7 +847,7 @@ \permanent\tolerant\protected\def\placeheadtext[#1]% {\dontleavehmode \begingroup - \protected\def\\{\space}% messy here, but the default (and needs to be grouped) + \enforced\permanent\protected\def\\{\space}% messy here, but the default (and needs to be grouped) \global\settrue\headisdisplay % triggers interlinespace checking \edef\currenthead{#1}% maybe only when #1 is given \strc_rendering_initialize_style_and_color\c!textstyle\c!textcolor diff --git a/tex/context/base/mkxl/strc-usr.mkxl b/tex/context/base/mkxl/strc-usr.mkxl index 28d398194..9ecb80ebd 100644 --- a/tex/context/base/mkxl/strc-usr.mkxl +++ b/tex/context/base/mkxl/strc-usr.mkxl @@ -91,21 +91,16 @@ \installcommandhandler \????userdata {userdata} \????userdata \installcommandhandler \????userdataalternative {userdataalternative} \????userdataalternative +\appendtoks + \frozen\protected\instance\edefcsname\e!start\currentuserdata\endcsname{\userdata_start_instance{\currentuserdata}}% + \frozen\protected\instance\letcsname \e!stop \currentuserdata\endcsname\userdata_stop_instance +\to \everydefineuserdata + \permanent\protected\def\startuserdata {\begingroup \let\currentuserdata\empty \doifelsenextoptionalcs\userdata_start_delayed\userdata_start_indeed} -% This variant works only when the userdata instance exists while the assignment check -% can also be used with undefined instances which falls back to the global settings. -% -% \def\userdata_start_delayed[#1]% -% {\ifcsname\nameduserdatahash{\detokenize\expandafter{\normalexpanded{#1}}}\s!parent\endcsname -% \expandafter\userdata_start_delayed_name -% \else -% \expandafter\userdata_start_delayed_parameters -% \fi[#1]} - \def\userdata_start_delayed[#1]% {\doifelseassignmentcs{#1}% \userdata_start_delayed_parameters @@ -121,15 +116,29 @@ \checkuserdataparent \doifelsenextoptionalcs\userdata_start_delayed_parameters\userdata_start_indeed} +\protected\tolerant\def\userdata_start_instance#1#*[#2]% + {\begingroup + \edef\currentuserdata{#1}% + \setupcurrentuserdata[#2]% + \grabbufferdatadirect + % {\s!userdata:\currentuserdata}% + {\s!userdata}% unnested, as before + {\e!start\currentuserdata}% + {\e!stop \currentuserdata}} + \def\userdata_start_indeed - {\grabbufferdatadirect\s!userdata{\csstring\startuserdata}{\csstring\stopuserdata}} + {\grabbufferdatadirect + % {\s!userdata:\currentuserdata}% + {\s!userdata}% unnested, as before + {\csstring\startuserdata}% + {\csstring\stopuserdata}} \permanent\protected\def\stopuserdata - {\userdataparameter\c!before % HH: moved, so we obey the outer spacing - \dostarttagged\t!userdata\currentuserdata % HH: added, maybe move up ? + {\userdataparameter\c!before + \dostarttagged\t!userdata\currentuserdata \begingroup \useuserdatastyleandcolor\c!style\c!color - \usealignparameter\userdataparameter % HH: added + \usealignparameter\userdataparameter \edef\currentuserdataalternative{\userdataparameter\c!alternative}% \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else \let\currentuserdataalternative\s!default @@ -139,14 +148,20 @@ \directsetup\p_renderingsetup \endgroup \dostoptagged - \userdataparameter\c!after % HH: moved + \userdataparameter\c!after \endgroup} -\permanent\protected\def\getuserdata - {\getbufferdata[\s!userdata]} +\aliased\let\userdata_stop_instance\stopuserdata + +% kind of nested, when we need it: +% +% \permanent\tolerant\protected\def\getuserdata [#1]{\normalexpanded{\getbufferdata[\s!userdata:\ifparameter#1\or#1\else\currentuserdata\fi]}} +% \permanent\tolerant\protected\def\getinlineuserdata[#1]{\normalexpanded{\inlinebuffer [\s!userdata:\ifparameter#1\or#1\else\currentuserdata\fi]}} + +% unnested, as before: -\permanent\protected\def\getinlineuserdata - {\inlinebuffer[\s!userdata]} +\permanent\tolerant\protected\def\getuserdata [#1]{\getbufferdata[\s!userdata]} +\permanent\tolerant\protected\def\getinlineuserdata[#1]{\inlinebuffer [\s!userdata]} \defineuserdataalternative [\s!default] diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl index 0f6fdc933..3f1d3f3d8 100644 --- a/tex/context/base/mkxl/typo-shp.mkxl +++ b/tex/context/base/mkxl/typo-shp.mkxl @@ -197,7 +197,33 @@ \egroup \endgroup} -\permanent\protected\def\getshapetext +% \permanent\protected\def\getshapetext +% {\vbox\bgroup +% \forgetall +% \dontcomplain +% \global\advance\shapetextindex\plusone +% \scratchcounter\getshapeparameter{lines}\relax +% \ifnum\scratchcounter>\zerocount +% \scratchwidth \getshapeparameter{width}\scaledpoint\relax +% \scratchheight \getshapeparameter{height}\scaledpoint\relax +% \setbox\scratchbox\vpack to \scratchheight +% {\splittopskip\strutheight +% \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax +% \ifcase\numexpr\getshapeparameter{first}\relax\else +% \vskip\lineheight +% \fi +% \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax +% \hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}% +% \wd\scratchbox\scratchwidth +% \ht\scratchbox\scratchheight +% \dp\scratchbox\zeropoint +% \box\scratchbox +% \else +% % what now +% \fi +% \egroup} + +\pushoverloadmode\permanent\protected\def\getshapetext {\vbox\bgroup \forgetall \dontcomplain @@ -206,21 +232,24 @@ \ifnum\scratchcounter>\zerocount \scratchwidth \getshapeparameter{width}\scaledpoint\relax \scratchheight \getshapeparameter{height}\scaledpoint\relax + \scratchhoffset\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax + \scratchvoffset\dimexpr\getshapeparameter{voffset}\scaledpoint\relax \setbox\scratchbox\vpack to \scratchheight {\splittopskip\strutheight - \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax + \vskip\scratchvoffset \ifcase\numexpr\getshapeparameter{first}\relax\else \vskip\lineheight \fi - \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax + \hskip\scratchhoffset \hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}% - \wd\scratchbox\scratchwidth - \ht\scratchbox\scratchheight - \dp\scratchbox\zeropoint + \wd\scratchbox\dimexpr\scratchwidth +\scratchhoffset\relax + \ht\scratchbox\dimexpr\scratchheight+\scratchvoffset\relax + \dp\scratchbox\strutdp % zeropoint \box\scratchbox \else % what now \fi \egroup} + \protect diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index f41ba8cae..57e767de1 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -82,6 +82,7 @@ + @@ -210,6 +211,8 @@ + + @@ -437,6 +440,7 @@ + @@ -1374,6 +1378,8 @@ + + @@ -1545,6 +1551,7 @@ + @@ -1721,6 +1728,9 @@ + + + @@ -2092,6 +2102,13 @@ + + + + + + + @@ -2135,6 +2152,13 @@ + + + + + + + diff --git a/tex/context/modules/mkiv/s-fonts-charts.mkiv b/tex/context/modules/mkiv/s-fonts-charts.mkiv index 3123cc0d0..36fec22f0 100644 --- a/tex/context/modules/mkiv/s-fonts-charts.mkiv +++ b/tex/context/modules/mkiv/s-fonts-charts.mkiv @@ -54,6 +54,7 @@ \starttexdefinition unexpanded FontChartSetLegend #1 \dontleavehmode +% \kern .5mm \setbox\scratchbox\hbox to 1cm \bgroup \infofont\hss#1\hss \egroup @@ -89,7 +90,8 @@ local filename = settings.filename or settings.name or "" local fontid = true - local newpage = settings.page == interfaces.variables.yes + local newpage = settings.page == interfaces.variables.yes + local all = settings.option == interfaces.variables.all if filename ~= "" then fontid = fonts.definers.internal({ name = filename, size = "10pt" },"chartfont") @@ -101,7 +103,7 @@ local chars = data.characters for u in table.sortedhash(chars) do - if u >= private then + if not all and u >= private then break else ranges[div(u,0xFF)] = true @@ -127,6 +129,7 @@ context.offinterlineskip() ctx_noslot() for i=0,0xF do + ctx_gap() ctx_setlegend(formatters["%03X"](r*0x10+i)) end r = r * 0xFF @@ -169,7 +172,9 @@ \starttext - \showfontchart[filename=aegean,page=yes] + \showfontchart[filename=texgyredejavu-math.otf,page=yes,option=all] + +% \showfontchart[filename=aegean,page=yes] % \showfontchart[filename=veramono.ttf,page=yes] % \showfontchart[filename=CoelacanthSubhdHeavy.otf,page=yes] diff --git a/tex/context/modules/mkiv/s-fonts-missing.lua b/tex/context/modules/mkiv/s-fonts-missing.lua index 7db5c2fb8..a8e2ca21a 100644 --- a/tex/context/modules/mkiv/s-fonts-missing.lua +++ b/tex/context/modules/mkiv/s-fonts-missing.lua @@ -9,35 +9,53 @@ if not modules then modules = { } end modules ['s-fonts-missing'] = { moduledata.fonts = moduledata.fonts or { } moduledata.fonts.missing = moduledata.fonts.missing or { } -local function legend(id) - local privates = fonts.helpers.getprivates(id) - if privates then - local categories = table.swapped(fonts.loggers.category_to_placeholder) - context.starttabulate { "|c|l|" } +local legend = fonts.loggers.category_to_placeholder and + + function(id) + local privates = fonts.helpers.getprivates(id) + if privates then + local categories = table.swapped(fonts.loggers.category_to_placeholder) + context.starttabulate { "|c|l|" } + context.HL() + context.NC() context.bold("symbol") + context.NC() context.bold("name") + context.NC() context.NR() + context.HL() + for k, v in table.sortedhash(privates) do + local tag = characters.categorytags[categories[k]] + if tag and tag ~= "" then + context.NC() context.dontleavehmode() context.char(v) + context.NC() context(k) + context.NC() context.NR() + end + end + context.HL() + context.stoptabulate() + end + end + +or + + function(id) + local mapping = fonts.checkers.mapping + context.starttabulate { "|c|c|l|l|" } context.HL() - context.NC() - context.bold("symbol") - context.NC() - context.bold("name") - context.NC() - context.NR() + context.NC() context.bold("symbol") + context.NC() context.bold("tag") + context.NC() context.bold("name") + context.NC() context.NR() context.HL() - for k, v in table.sortedhash(privates) do - local tag = characters.categorytags[categories[k]] - if tag and tag ~= "" then - context.NC() - context.dontleavehmode() - context.char(v) - context.NC() - context(k) - context.NC() - context.NR() - end + for k, v in table.sortedhash(mapping) do + local p = fonts.helpers.newprivateslot(v[1] .. "-" .. v[2]) + fonts.checkers.placeholder(font.current(),p,k) + context.NC() context.char(p) + context.NC() context(k) + context.NC() context(v[1]) + context.NC() context.NR() end context.HL() context.stoptabulate() end -end function moduledata.fonts.missing.showlegend(specification) specification = interfaces.checkedspecification(specification) @@ -52,30 +70,20 @@ local function missings() for filename, list in table.sortedhash(collected) do if #list > 0 then context.starttabulate { "|l|l|" } - context.NC() - context.bold("filename") - context.NC() - context(file.basename(filename)) - context.NC() - context.NR() - context.NC() - context.bold("missing") - context.NC() - context(#list) - context.NC() - context.NR() + context.NC() context.bold("filename") + context.NC() context(file.basename(filename)) + context.NC() context.NR() + context.NC() context.bold("missing") + context.NC() context(#list) + context.NC() context.NR() context.stoptabulate() context.starttabulate { "|l|c|l|" } for i=1,#list do local u = list[i] - context.NC() - context("%U",u) - context.NC() - context.char(u) - context.NC() - context(characters.data[u].description) - context.NC() - context.NR() + context.NC() context("%U",u) + context.NC() context.char(u) + context.NC() context(characters.data[u].description) + context.NC() context.NR() end context.stoptabulate() end diff --git a/tex/context/modules/mkiv/s-fonts-tables.lua b/tex/context/modules/mkiv/s-fonts-tables.lua index 8673ef398..c9aa7b801 100644 --- a/tex/context/modules/mkiv/s-fonts-tables.lua +++ b/tex/context/modules/mkiv/s-fonts-tables.lua @@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['s-fonts-tables'] = { moduledata.fonts = moduledata.fonts or { } moduledata.fonts.tables = moduledata.fonts.tables or { } +require("font-cft") + local rawget, type = rawget, type local setmetatableindex = table.setmetatableindex diff --git a/tex/context/modules/mkiv/s-present-stepper.mkiv b/tex/context/modules/mkiv/s-present-stepper.mkiv index c2f3c018a..3f5918d5b 100644 --- a/tex/context/modules/mkiv/s-present-stepper.mkiv +++ b/tex/context/modules/mkiv/s-present-stepper.mkiv @@ -13,9 +13,11 @@ %D Optima +% \overloadmode\zerocount % for now (me) + \startmodule[present-stepper] -\usemodule[pre-60] +\usemodule[present-stepwise] \doifmodeelse {atpragma,asintended} { \usetypescriptfile[ghz] @@ -74,12 +76,12 @@ frame=off] \startinteractionmenu[bottom] - \but [firstpage] \symbol[firstpage] \\ - \but [previouspage] \symbol[previouspage] \\ - \but [InvokeStepper] \StartBusy\symbol[PauseRendering]\StopBusy \\ - \but [nextpage] \symbol[nextpage] \\ - \but [lastpage] \symbol[lastpage] \\ - \but [CloseDocument] \symbol[CloseDocument] \\ + \startbut [firstpage] \symbol[firstpage] \stopbut + \startbut [previouspage] \symbol[previouspage] \stopbut + \startbut [InvokeStepper] \StartBusy\symbol[PauseRendering]\StopBusy \stopbut + \startbut [nextpage] \symbol[nextpage] \stopbut + \startbut [lastpage] \symbol[lastpage] \stopbut + \startbut [CloseDocument] \symbol[CloseDocument] \stopbut \stopinteractionmenu % maybe in colo-sjk : \setupcolor[sjk] @@ -189,7 +191,7 @@ {\setups[fonts:normalize] \resetsetups[fonts:normalize] \startstandardmakeup[headerstate=high] - \enforced\protected\def\\{\enforced\protected\def\\{\endgraf\quad\quad}\endgraf\quad\ignorespaces#2}% + \protected\def\\{\protected\def\\{\endgraf\quad\quad}\endgraf\quad\ignorespaces#2}% #1\setstrut\setupinterlinespace\vfil#3\vfil\vfil \stopstandardmakeup} diff --git a/tex/context/modules/mkiv/s-present-steps.mkiv b/tex/context/modules/mkiv/s-present-steps.mkiv index 432650a5e..c588a0d16 100644 --- a/tex/context/modules/mkiv/s-present-steps.mkiv +++ b/tex/context/modules/mkiv/s-present-steps.mkiv @@ -16,6 +16,8 @@ \startmodule[present-steps] +\pushoverloadmode + \startluacode moduledata.steps = moduledata.steps or { } @@ -168,6 +170,8 @@ end \fi \ctxlua{moduledata.steps.stopsubstep()}} +\popoverloadmode + \stopmodule \continueifinputfile{s-present-steps.mkiv} diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index a87c6272c..415ca193a 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 : 2021-07-30 00:41 +-- merge date : 2021-08-04 17:48 do -- begin closure to overcome local limits and interference @@ -2255,9 +2255,12 @@ function io.copydata(source,target,action) flush() end end -function io.savedata(filename,data,joiner) - local f=open(filename,"wb") +function io.savedata(filename,data,joiner,append) + local f=open(filename,append and "ab" or "wb") if f then + if append and joiner and f:seek("end")>0 then + f:write(joiner) + end if type(data)=="table" then f:write(concat(data,joiner or "")) elseif type(data)=="function" then @@ -3118,7 +3121,7 @@ if not modules then modules={} end modules ['util-str']={ utilities=utilities or {} utilities.strings=utilities.strings or {} local strings=utilities.strings -local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,string.find +local format,gsub,rep,sub,find,char=string.format,string.gsub,string.rep,string.sub,string.find,string.char local load,dump=load,string.dump local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable local unpack,concat=table.unpack,table.concat @@ -3471,12 +3474,20 @@ local template=[[ return function(%s) return %s end ]] local pattern=Cs(Cc('"')*( - (1-S('"\\\n\r'))^1+P('"')/'\\"'+P('\\')/'\\\\'+P('\n')/'\\n'+P('\r')/'\\r' + (1-S('"\\\n\r'))^1+P('"')/'\\034'+P('\\')/'\\020'+P('\n')/'\\013'+P('\r')/'\\010' )^0*Cc('"')) patterns.escapedquotes=pattern function string.escapedquotes(s) return lpegmatch(pattern,s) end +local pattern=(1-P("\\"))^1;pattern=Cs ( + pattern*((P("\\")/""*(digit^-3/function(s) return char(tonumber(s)) end))+pattern )^1 +) +patterns.unescapedquotes=pattern +function string.unescapedquotes(s) + return lpegmatch(pattern,s) or s +end +string.texnewlines=lpeg.replacer(patterns.newline,"\r",true) local preamble="" local environment={ global=global or _G, diff --git a/tex/generic/context/luatex/luatex-mplib.lua b/tex/generic/context/luatex/luatex-mplib.lua index c251d88c3..1839c44ee 100644 --- a/tex/generic/context/luatex/luatex-mplib.lua +++ b/tex/generic/context/luatex/luatex-mplib.lua @@ -350,8 +350,9 @@ else if how == "image" then tex.sprint(format("\\MPLIBpdftext{%s}{%s}",what,depth)) else - text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost - tex.sprint(format("\\MPLIBtextext{%s}{%s}{%s}{%s}",font,size,text,depth)) + -- text = gsub(text,".","\\hbox{%1}") -- kerning happens in metapost + -- tex.sprint(format("\\MPLIBtextext{%s}{%s}{%s}{%s}",font,size,text,depth)) + tex.sprint(format("\\MPLIBtextext{%s}{%s}{\\hpack{\\detokenize{%s}}}{%s}",font,size,text,depth)) end end -- cgit v1.2.3