diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-01-12 17:15:43 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-01-12 17:15:43 +0100 |
commit | 52c5102fab837626fe9bb359b3eda6066e1a968e (patch) | |
tree | 6dfd2d9eeafa7aaa7fea55394e496762b2f8a489 | |
parent | d0edf3e90e8922d9c672f24ecdc5d44fe2716f31 (diff) | |
download | context-52c5102fab837626fe9bb359b3eda6066e1a968e.tar.gz |
2018-01-12 16:04:00
37 files changed, 539 insertions, 152 deletions
diff --git a/context/data/scite/context/lexers/scite-context-lexer-tex.lua b/context/data/scite/context/lexers/scite-context-lexer-tex.lua index 422d5a4dc..fa065239a 100644 --- a/context/data/scite/context/lexers/scite-context-lexer-tex.lua +++ b/context/data/scite/context/lexers/scite-context-lexer-tex.lua @@ -416,7 +416,7 @@ local luaenvironment = P("lua") * (P("setups") + P("code") + P(true)) local inlinelua = P("\\") * ( P("ctx") * (P("lua") + P("command") + P("late") * (P("lua") + P("command")) + P("function")) + P("cld") * (P("command") + P("context")) - + P("luaexpr") + + P("lua") * (P("expr") + P("script") + P("thread")) + (P("direct") + P("late")) * P("lua") ) diff --git a/doc/context/documents/general/manuals/cld-mkiv.pdf b/doc/context/documents/general/manuals/cld-mkiv.pdf Binary files differindex 5dfa14a4a..a2cdb7fc9 100644 --- a/doc/context/documents/general/manuals/cld-mkiv.pdf +++ b/doc/context/documents/general/manuals/cld-mkiv.pdf diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 4e2a317eb..2ffb19efa 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex b23404020..e82e59d07 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex 0dfec2ab9..38c4532e4 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 9bcb77016..29f08846d 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 23d5ba4af..02df2354e 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex 695f21829..c301caabc 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex bce5e40ee..87fdaf725 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex 2087f28aa..c8088953f 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex b9110b36b..2a10daed4 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex 5092cd018..0997f1662 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex 7b55474ab..18cbbedf6 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex d85c7319c..a9e83a207 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex d98bdb987..5137d53cb 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex 382c2de42..75c8f9455 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/sources/general/manuals/cld/cld-abitoflua.tex b/doc/context/sources/general/manuals/cld/cld-abitoflua.tex index 5716be6d6..e61507929 100644 --- a/doc/context/sources/general/manuals/cld/cld-abitoflua.tex +++ b/doc/context/sources/general/manuals/cld/cld-abitoflua.tex @@ -803,6 +803,35 @@ seen from their meaning: \cldcommand #1{\directlua{context.#1}} \stoptyping +The \type {\directlua{}} command can also be implemented using the token parser +and \LUA\ itself. A variant is therefore \type {\luascript{}} which can be +considered an alias but with a bit different error reporting. A variant on this +is the \type {\luathread {name} {code}} command. Here is an example of their +usage: + +\startbuffer +\luascript { context("foo 1:") context(i) } \par +\luathread {test} { i = 10 context("bar 1:") context(i) } \par +\luathread {test} { context("bar 2:") context(i) } \par +\luathread {test} {} % resets +\luathread {test} { context("bar 3:") context(i) } \par +\luascript { context("foo 2:") context(i) } \par +\stopbuffer + +\typebuffer + +These commands result in: + +\startpacked \getbuffer \stoppacked + +% \testfeatureonce{100000}{\directlua {local a = 10 local a = 10 local a = 10}} % 0.53s +% \testfeatureonce{100000}{\luascript {local a = 10 local a = 10 local a = 10}} % 0.62s +% \testfeatureonce{100000}{\luathread {test} {local a = 10 local a = 10 local a = 10}} % 0.79s + +The variable \type {i} is local to the thread (which is not really a thread in +\LUA\ but more a named piece of code that provides an environment which is shared +over the calls with the same name. You will probably never need these. + Each time a call out to \LUA\ happens the argument eventually gets parsed, converted into tokens, then back into a string, compiled to bytecode and executed. The next example code shows a mechanism that avoids this: diff --git a/doc/context/sources/general/manuals/cld/cld-ctxfunctions.tex b/doc/context/sources/general/manuals/cld/cld-ctxfunctions.tex index f71030e50..11600b847 100644 --- a/doc/context/sources/general/manuals/cld/cld-ctxfunctions.tex +++ b/doc/context/sources/general/manuals/cld/cld-ctxfunctions.tex @@ -520,20 +520,24 @@ node types. \ShowLuaExampleString{nodes.idstostring(tex.box[0])} \ShowLuaExampleString{nodes.idstostring(tex.box[0].list)} -The number of nodes in a list is identified with the \type {count} function. +The number of nodes in a list is identified with the \type {countall} function. Nested nodes are counted too. -\ShowLuaExampleString{nodes.count(tex.box[0])} -\ShowLuaExampleString{nodes.count(tex.box[0].list)} +\ShowLuaExampleString{nodes.countall(tex.box[0])} +\ShowLuaExampleString{nodes.countall(tex.box[0].list)} -There are functions to check node types and node id's: +There are a lot of helpers in the \type {nodes} namespace. In fact, we map all the +helpers provided by the engine itself under \type {nodes} too. These are described +in the \LUATEX\ manual. There are for instance functions to check node types and +node id's: \starttyping local str = node.type(1) local num = node.id("vlist") \stoptyping -These are basic \LUATEX\ functions. In addition to those we also provide a few +These are basic \LUATEX\ functions. In addition to those we also provide a few more +helpers as well as mapping tables. There are two tables that map node id's to strings and backwards: \starttabulate diff --git a/doc/context/sources/general/manuals/cld/cld-luafunctions.tex b/doc/context/sources/general/manuals/cld/cld-luafunctions.tex index 69586887d..b2760e05b 100644 --- a/doc/context/sources/general/manuals/cld/cld-luafunctions.tex +++ b/doc/context/sources/general/manuals/cld/cld-luafunctions.tex @@ -732,27 +732,28 @@ The following table gives an overview of the possible format directives. The \type {s} is the most probably candidate and can handle numbers well as strings. Watch how the minus sign influences the alignment. \footnote {There can be differences between platforms although so far we haven't run into problems. Also, -\LUA\ 5.2 does a bit more checking on correct arguments.} +\LUA\ 5.2 does a bit more checking on correct arguments and \LUA\ 5.3 is more +picky on integers.} \starttabulate[|lB|lT|lT|lT|] \HL -\NC integer \NC \letterpercent i \NC 12345 \NC \cldcontext{"\letterpercent i", 12345 } \NC \NR -\NC integer \NC \letterpercent d \NC 12345 \NC \cldcontext{"\letterpercent d", 12345 } \NC \NR -\NC unsigned \NC \letterpercent u \NC -12345 \NC \cldcontext{"\letterpercent u", 12345 } \NC \NR -\NC character \NC \letterpercent c \NC 123 \NC \cldcontext{"\letterpercent c", 89 } \NC \NR -\NC hexadecimal \NC \letterpercent x \NC 123 \NC \cldcontext{"\letterpercent x", 123 } \NC \NR -\NC \NC \letterpercent X \NC 123 \NC \cldcontext{"\letterpercent X", 123 } \NC \NR -\NC octal \NC \letterpercent o \NC 12345 \NC \cldcontext{"\letterpercent o", 12345 } \NC \NR +\NC integer \NC \letterpercent i \NC 12345 \NC \cldcontext{string.format("\letterpercent i", 12345 )} \NC \NR +\NC integer \NC \letterpercent d \NC 12345 \NC \cldcontext{string.format("\letterpercent d", 12345 )} \NC \NR +\NC unsigned \NC \letterpercent u \NC -12345 \NC \cldcontext{string.format("\letterpercent u", 12345 )} \NC \NR +\NC character \NC \letterpercent c \NC 123 \NC \cldcontext{string.format("\letterpercent c", 89 )} \NC \NR +\NC hexadecimal \NC \letterpercent x \NC 123 \NC \cldcontext{string.format("\letterpercent x", 123 )} \NC \NR +\NC \NC \letterpercent X \NC 123 \NC \cldcontext{string.format("\letterpercent X", 123 )} \NC \NR +\NC octal \NC \letterpercent o \NC 12345 \NC \cldcontext{string.format("\letterpercent o", 12345 )} \NC \NR \HL -\NC string \NC \letterpercent s \NC abc \NC \cldcontext{"\letterpercent s", "abcd"} \NC \NR -\NC \NC \letterpercent -8s \NC 123 \NC \cldcontext{"\letterpercent -8s", 123 } \NC \NR -\NC \NC \letterpercent 8s \NC 123 \NC \cldcontext{"\letterpercent 8s", 123 } \NC \NR +\NC string \NC \letterpercent s \NC abc \NC \cldcontext{string.format("\letterpercent s", "abcd")} \NC \NR +\NC \NC \letterpercent -8s \NC 123 \NC \cldcontext{string.format("\letterpercent -8s", 123 )} \NC \NR +\NC \NC \letterpercent 8s \NC 123 \NC \cldcontext{string.format("\letterpercent 8s", 123 )} \NC \NR \HL -\NC float \NC \letterpercent 0.2f \NC 12.345 \NC \cldcontext{"\letterpercent 0.2f",12.345} \NC \NR -\NC exponential \NC \letterpercent 0.2e \NC 12.345 \NC \cldcontext{"\letterpercent 0.2e",12.345} \NC \NR -\NC \NC \letterpercent 0.2E \NC 12.345 \NC \cldcontext{"\letterpercent 0.2E",12.345} \NC \NR -\NC autofloat \NC \letterpercent 0.2g \NC 12.345 \NC \cldcontext{"\letterpercent 0.2g",12.345} \NC \NR -\NC \NC \letterpercent 0.2G \NC 12.345 \NC \cldcontext{"\letterpercent 0.2G",12.345} \NC \NR +\NC float \NC \letterpercent 0.2f \NC 12.345 \NC \cldcontext{string.format("\letterpercent 0.2f",12.345)} \NC \NR +\NC exponential \NC \letterpercent 0.2e \NC 12.345 \NC \cldcontext{string.format("\letterpercent 0.2e",12.345)} \NC \NR +\NC \NC \letterpercent 0.2E \NC 12.345 \NC \cldcontext{string.format("\letterpercent 0.2E",12.345)} \NC \NR +\NC autofloat \NC \letterpercent 0.2g \NC 12.345 \NC \cldcontext{string.format("\letterpercent 0.2g",12.345)} \NC \NR +\NC \NC \letterpercent 0.2G \NC 12.345 \NC \cldcontext{string.format("\letterpercent 0.2G",12.345)} \NC \NR \HL \stoptabulate @@ -842,58 +843,100 @@ context.typebuffer( { "dummy" }, { numbering = "line" }) The \type {format} function discussed before is the built|-|in. As an alternative \CONTEXT\ provides an additional formatter that has some extensions. Interesting is that that one is often more efficient, although there are cases where the -speed is comparable. In addition to the regular \type {format} function we have -the following extra formatting keys: \footnote {As we run out of keys some are -somewhat counter intuitive, like \type {l} for booleans (logical).} +speed is comparable. As we run out of keys, some extra ones are a bit counter +intuitive, like \type {l} for booleans (logical). \start \setuptype[color=] \starttabulate[|lB|lT|lT|lT|] \HL -\NC utf character \NC \letterpercent c \NC 322 \NC \cldcontext{"\letterpercent c",322} \NC \NR +\NC utf character \NC \letterpercent c \NC 322 \NC \cldcontext{"\letterpercent c",322} \NC \NR \HL -\NC force tostring \NC \letterpercent S \NC nil \NC \cldcontext{"\letterpercent S",nil} \NC \NR -\NC \NC \letterpercent Q \NC nil \NC \cldcontext{"\letterpercent Q",nil} \NC \NR -\NC \NC \letterpercent N \NC 0123 \NC \cldcontext{"\letterpercent N","0123"} \NC \NR +\NC string \NC \letterpercent s \NC foo \NC \cldcontext{"\letterpercent s","foo"} \NC \NR +\NC force tostring \NC \letterpercent S \NC nil \NC \cldcontext{"\letterpercent S",nil} \NC \NR +\NC quoted string \NC \letterpercent q \NC foo \NC \cldcontext{"\letterpercent q","foo"} \NC \NR +\NC force quoted string \NC \letterpercent Q \NC nil \NC \cldcontext{"\letterpercent Q",nil} \NC \NR +\NC \NC \letterpercent N \NC 0123 \NC \cldcontext{"\letterpercent N","0123"} \NC \NR +\NC automatic quoted \NC \letterpercent a \NC true \NC \cldcontext{"\letterpercent a",true} \NC \NR\NC \NR +\NC \NC \letterpercent A \NC true \NC \cldcontext{"\letterpercent A",true} \NC \NR\NC \NR +\NC left aligned utf \NC \letterpercent 30< \NC xx½xx \NC \cldcontext{"\letterpercent 30<","xx½xx"} \NC \NR\NC \NR +\NC right aligned utf \NC \letterpercent 30> \NC xx½xx \NC \cldcontext{"\letterpercent 30>","xx½xx"} \NC \NR\NC \NR \HL -\NC signed number \NC \letterpercent I \NC 1234 \NC \cldcontext{"\letterpercent I",1234} \NC \NR -\NC rounded number \NC \letterpercent r \NC 1234.56 \NC \cldcontext{"\letterpercent r",1234.56} \NC \NR +\NC integer \NC \letterpercent i \NC 1234 \NC \cldcontext{"\letterpercent i",1234} \NC \NR +\NC integer \NC \letterpercent d \NC 1234 \NC \cldcontext{"\letterpercent d",1234} \NC \NR +\NC signed number \NC \letterpercent I \NC 1234 \NC \cldcontext{"\letterpercent I",1234} \NC \NR +\NC rounded number \NC \letterpercent r \NC 1234.56 \NC \cldcontext{"\letterpercent r",1234.56} \NC \NR +\NC stripped number \NC \letterpercent N \NC 000123 \NC \cldcontext{"\letterpercent N","000123"} \NC \NR +\NC comma/period float \NC \letterpercent m \NC 12.34 \NC \cldcontext{"\letterpercent m",12.34} \NC \NR +\NC period/comma float \NC \letterpercent M \NC 12.34 \NC \cldcontext{"\letterpercent M",12.34} \NC \NR \HL -\NC sparseexp \NC \letterpercent 0.2j \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2j",12.345e120} \NC \NR -\NC \NC \letterpercent 0.2J \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2J",12.345e120} \NC \NR +\NC hexadecimal \NC \letterpercent x \NC 1234 \NC \cldcontext{"\letterpercent x",1234} \NC \NR +\NC \NC \letterpercent X \NC 1234 \NC \cldcontext{"\letterpercent X",1234} \NC \NR +\NC octal \NC \letterpercent o \NC 1234 \NC \cldcontext{"\letterpercent o",1234} \NC \NR \HL -\NC unicode value 0x \NC \letterpercent h \NC ł 1234 \NC \cldcontext{"\letterpercent v \letterpercent v", "ł",1234} \NC \NR -\NC \NC \letterpercent H \NC ł 1234 \NC \cldcontext{"\letterpercent V \letterpercent V", "ł",1234} \NC \NR -\NC unicode value U+ \NC \letterpercent u \NC ł 1234 \NC \cldcontext{"\letterpercent u \letterpercent u", "ł",1234} \NC \NR -\NC \NC \letterpercent U \NC ł 1234 \NC \cldcontext{"\letterpercent U \letterpercent U", "ł",1234} \NC \NR +\NC float \NC \letterpercent 0.2f \NC 12.345 \NC \cldcontext{"\letterpercent 0.2f",12.345} \NC \NR +\NC formatted float \NC \letterpercent 2.3k \NC 12.3456 \NC \cldcontext{"\letterpercent 2.3f",12.3456} \NC \NR +\NC checked float \NC \letterpercent 0.2F \NC 12.30 \NC \cldcontext{"\letterpercent 0.2F",12.3} \NC \NR +\NC exponential \NC \letterpercent .2e \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2j",12.345e120} \NC \NR +\NC \NC \letterpercent .2E \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2J",12.345e120} \NC \NR +\NC sparse exp \NC \letterpercent 0.2j \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2j",12.345e120} \NC \NR +\NC \NC \letterpercent 0.2J \NC 12.345e120 \NC \cldcontext{"\letterpercent 0.2J",12.345e120} \NC \NR +\NC autofloat \NC \letterpercent g \NC 12.345 \NC \cldcontext{"\letterpercent 0.2J",12.345} \NC \NR +\NC \NC \letterpercent G \NC 12.345 \NC \cldcontext{"\letterpercent 0.2J",12.345} \NC \NR \HL -\NC points \NC \letterpercent p \NC 1234567 \NC \cldcontext{"\letterpercent p",1234567} \NC \NR -\NC basepoints \NC \letterpercent b \NC 1234567 \NC \cldcontext{"\letterpercent b",1234567} \NC \NR +\NC unicode value 0x \NC \letterpercent h \NC ł 1234 \NC \cldcontext{"\letterpercent v \letterpercent v", "ł",1234} \NC \NR +\NC \NC \letterpercent H \NC ł 1234 \NC \cldcontext{"\letterpercent V \letterpercent V", "ł",1234} \NC \NR +\NC unicode value U+ \NC \letterpercent u \NC ł 1234 \NC \cldcontext{"\letterpercent u \letterpercent u", "ł",1234} \NC \NR +\NC \NC \letterpercent U \NC ł 1234 \NC \cldcontext{"\letterpercent U \letterpercent U", "ł",1234} \NC \NR \HL -\NC table concat \NC \letterpercent t \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent t",{1,2,3}} \NC \NR -\NC \NC \letterpercent *t \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent *t",{1,2,3}} \NC \NR -\NC \NC \letterpercent \arg{ AND }t \NC \arg{a=1,b=3} \NC \cldcontext{"\letterpercent +{ AND }T",{a=1,b=2}} \NC \NR -\NC table serialize \NC \letterpercent T \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent *t",{1,2,3}} \NC \NR -\NC \NC \letterpercent T \NC \arg{a=1,b=3} \NC \let|\relax\cldcontext{"\letterpercent T",{a=1,b=2}} \NC \NR -\NC \NC \letterpercent +T \NC \arg{a=1,b=3} \NC \cldcontext{"\letterpercent [+T]",{a=1,b=2}} \NC \NR +\NC points \NC \letterpercent p \NC 1234567 \NC \cldcontext{"\letterpercent p",1234567} \NC \NR +\NC basepoints \NC \letterpercent b \NC 1234567 \NC \cldcontext{"\letterpercent b",1234567} \NC \NR \HL -\NC boolean (logic) \NC \letterpercent l \NC "a" == "b" \NC \cldcontext{"\letterpercent l","a"=="b"} \NC \NR -\NC \NC \letterpercent L \NC "a" == "b" \NC \cldcontext{"\letterpercent L","a"=="b"} \NC \NR +\NC table concat \NC \letterpercent t \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent t",{1,2,3}} \NC \NR +\NC \NC \letterpercent *t \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent *t",{1,2,3}} \NC \NR +\NC \NC \letterpercent \arg{ AND }t \NC \arg{a=1,b=3} \NC \cldcontext{"\letterpercent +{ AND }T",{a=1,b=2}} \NC \NR +\NC table serialize \NC \letterpercent T \NC \arg{1,2,3} \NC \cldcontext{"\letterpercent *t",{1,2,3}} \NC \NR +\NC \NC \letterpercent T \NC \arg{a=1,b=3} \NC \let|\relax\cldcontext{"\letterpercent T",{a=1,b=2}} \NC \NR +\NC \NC \letterpercent +T \NC \arg{a=1,b=3} \NC \cldcontext{"\letterpercent [+T]",{a=1,b=2}} \NC \NR \HL -\NC whitespace \NC \letterpercent w \NC 3 \NC \obeyspaces\vl\cldcontext{"\letterpercent w",3}\vl \NC \NR -\NC \NC \letterpercent 2w \NC 3 \NC \obeyspaces\vl\cldcontext{"\letterpercent 2w",3}\vl \NC \NR -\NC \NC \letterpercent 4W \NC \NC \obeyspaces\vl\cldcontext{"\letterpercent 4W"}\vl \NC \NR +\NC boolean (logic) \NC \letterpercent l \NC "a" == "b" \NC \cldcontext{"\letterpercent l","a"=="b"} \NC \NR +\NC \NC \letterpercent L \NC "a" == "b" \NC \cldcontext{"\letterpercent L","a"=="b"} \NC \NR \HL -\NC skip \NC \letterpercent 2z \NC 1,2,3,4 \NC \obeyspaces\vl\cldcontext{"\letterpercent s\letterpercent 2z\letterpercent s",1,2,3,4}\vl \NC \NR +\NC whitespace \NC \letterpercent w \NC 3 \NC \obeyspaces\vl\cldcontext{"\letterpercent w",3}\vl \NC \NR +\NC \NC \letterpercent 2w \NC 3 \NC \obeyspaces\vl\cldcontext{"\letterpercent 2w",3}\vl \NC \NR +\NC \NC \letterpercent 4W \NC \NC \obeyspaces\vl\cldcontext{"\letterpercent 4W"}\vl \NC \NR +\HL +\NC skip \NC \letterpercent 2z \NC 1,2,3,4 \NC \obeyspaces\vl\cldcontext{"\letterpercent s\letterpercent 2z\letterpercent s",1,2,3,4}\vl \NC \NR \HL \stoptabulate \stop -There is also a generic formatter: \type {a} and \type {A}. This one converts the -argument into a string and deals with strings, number, booleans, tables and -whatever. We mostly use these in tracing. The lowercase variant uses single -quotes, and the uppercase variant uses double quotes. +The generic formatters \type {a} and \type {A} convert the argument into a string +and deals with strings, number, booleans, tables and whatever. We mostly use +these in tracing. The lowercase variant uses single quotes, and the uppercase +variant uses double quotes. + +A special one is the alignment formatter, which is a variant on the \type {s} one +that also takes an optional positive of negative number: + +\startbuffer +\startluacode +context.start() +context.tttf() +context.verbatim("[[% 30<]]","xxaxx") context.par() +context.verbatim("[[% 30<]]","xx½xx") context.par() +context.verbatim("[[% 30>]]","xxaxx") context.par() +context.verbatim("[[% 30>]]","xx½xx") context.par() +context.verbatim("[[%-30<]]","xxaxx") context.par() +context.verbatim("[[%-30<]]","xx½xx") context.par() +context.verbatim("[[%-30>]]","xxaxx") context.par() +context.verbatim("[[%-30>]]","xx½xx") context.par() +context.stop() +\stopluacode +\stopbuffer + +\typebuffer \getbuffer There are two more formatters plugged in: \type {!xml!} and \type {!tex!}. These are best demonstrated with an example: @@ -1416,50 +1459,52 @@ end In the \type {number} namespace we collect some helpers that deal with numbers as well as bits. Starting with \LUA\ 5.2 a library \type {bit32} is but the language itself doesn't provide for them via operators: the library uses functions to -manipulate numbers upto 2\high{32}. For advanced bit manipulations you should use -the \type {bit32} library, otherwise it's best to stick to the functions -described here. - -\startsummary[title={hasbit setbit clearbit}] - -As bitsets are numbers you will also use numbers to qualify them. So, if you want to -set bits 1, 4 and 8, you can to that using the following specification: - -\starttyping -local b = 1 + 4 + 8 -- 0x1 + 0x4 + 0x8 -local b = 13 -- or 0xC -\stoptyping - -However, changing one bit by adding a number to an existing doesn't work out that well -if that number already has that bit set. Instead we use: - -\starttyping -local b = number.setbit(b,0x4) -\stoptyping +manipulate numbers upto 2\high{32}. In the latest \LUATEX\ you can use the new +bit related operators. -In a similar fashion you can turn of a bit: - -\starttyping -local b = number.clearbit(b,0x4) -\stoptyping - -Testing for a bit(set) is done as follows: - -\starttyping -local okay = number.hasbit(b,0x4) -\stoptyping - -\stopsummary - -\startsummary[title={bit}] - -Where the previously mentioned helpers work with numbers representing one or more -bits, it is sometimes handy to work with positions. The \type {bit} function -returns the associated number value. - -\ShowLuaExampleThree {number} {bit} {5} - -\stopsummary +% For advanced bit manipulations you should use the \type {bit32} library, otherwise +% it's best to stick to the functions described here. +% +% \startsummary[title={hasbit setbit clearbit}] +% +% As bitsets are numbers you will also use numbers to qualify them. So, if you want to +% set bits 1, 4 and 8, you can to that using the following specification: +% +% \starttyping +% local b = 1 + 4 + 8 -- 0x1 + 0x4 + 0x8 +% local b = 13 -- or 0xC +% \stoptyping +% +% However, changing one bit by adding a number to an existing doesn't work out that well +% if that number already has that bit set. Instead we use: +% +% \starttyping +% local b = number.setbit(b,0x4) +% \stoptyping +% +% In a similar fashion you can turn of a bit: +% +% \starttyping +% local b = number.clearbit(b,0x4) +% \stoptyping +% +% Testing for a bit(set) is done as follows: +% +% \starttyping +% local okay = number.hasbit(b,0x4) +% \stoptyping +% +% \stopsummary +% +% \startsummary[title={bit}] +% +% Where the previously mentioned helpers work with numbers representing one or more +% bits, it is sometimes handy to work with positions. The \type {bit} function +% returns the associated number value. +% +% \ShowLuaExampleThree {number} {bit} {5} +% +% \stopsummary \startsummary[title={tobitstring}] @@ -1472,32 +1517,32 @@ we provide a helper: \type {tobitsting}. \stopsummary -\startsummary[title={bits}] - -If you ever want to convert a bitset into a table containing the set bits you can -use this function. - -\ShowLuaExampleTwo {number} {bits} {11} - -\stopsummary - -\startsummary[title={toset}] - -A string or number can be split into digits with \type {toset}. Beware, this -function does not return a function but multiple numbers - -\starttyping -local a, b, c, d = number.toset("1001") -\stoptyping - -The returned values are either numbers or \type {nil} when an valid digit is -seen. - -\ShowLuaExampleSeven {number} {toset} {100101} -\ShowLuaExampleSeven {number} {toset} {"100101"} -\ShowLuaExampleSeven {number} {toset} {"21546"} - -\stopsummary +% \startsummary[title={bits}] +% +% If you ever want to convert a bitset into a table containing the set bits you can +% use this function. +% +% \ShowLuaExampleTwo {number} {bits} {11} +% +% \stopsummary +% +% \startsummary[title={toset}] +% +% A string or number can be split into digits with \type {toset}. Beware, this +% function does not return a function but multiple numbers +% +% \starttyping +% local a, b, c, d = number.toset("1001") +% \stoptyping +% +% The returned values are either numbers or \type {nil} when an valid digit is +% seen. +% +% \ShowLuaExampleSeven {number} {toset} {100101} +% \ShowLuaExampleSeven {number} {toset} {"100101"} +% \ShowLuaExampleSeven {number} {toset} {"21546"} +% +% \stopsummary \startsummary[title={valid}] diff --git a/doc/context/sources/general/manuals/cld/cld-macros.tex b/doc/context/sources/general/manuals/cld/cld-macros.tex index de677e2c1..a177db9f8 100644 --- a/doc/context/sources/general/manuals/cld/cld-macros.tex +++ b/doc/context/sources/general/manuals/cld/cld-macros.tex @@ -163,6 +163,62 @@ is handled automatically. \stopsection +\startsection[title=Looking inside] + +If needed you can access the body of a macro. Take for instance: + +\startbuffer +\def\TestA{A} +\def\TestB{\def\TestC{c}} +\def\TestC{C} +\stopbuffer + +\typebuffer \getbuffer + +The following example demonsttaies how we can look inside these macros. You need +to be aware of the fact that the whole blob of \LUA\ codes is finished before we +return to \TEX, so when we pipe the meaning of \type {TestB} back to \TEX\ it +only gets expanded afterwards. We can use a function to get back to \LUA. It's +only then that the meaning of \type {testC} is changed by the (piped) expansion +of \type {TestB}. + +\startbuffer +\startluacode +context(tokens.getters.macro("TestA")) +context(tokens.getters.macro("TestB")) +context(tokens.getters.macro("TestC")) +tokens.setters.macro("TestA","a") +context(tokens.getters.macro("TestA")) +context(function() + context(tokens.getters.macro("TestA")) + context(tokens.getters.macro("TestB")) + context(tokens.getters.macro("TestC")) +end) +\stopluacode +\stopbuffer + +\typebuffer \getbuffer + +Here is another example: + +\startbuffer +\startluacode +if tokens.getters.macro("fontstyle") == "rm" then + context("serif") +else + context("unknown") +end +\stopluacode +\stopbuffer + +\typebuffer + +Of course this assumes that you have some knowledge of the \CONTEXT\ internals. + +\getbuffer + +\stopsection + \stopchapter \stopcomponent diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 576c95c1f..7dd544b82 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -5930,7 +5930,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 38604, stripped down to: 21710 +-- original size: 38616, stripped down to: 21710 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -21069,8 +21069,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 868797 --- stripped bytes : 316105 +-- original bytes : 868809 +-- stripped bytes : 316117 -- end library merge diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 576c95c1f..7dd544b82 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -5930,7 +5930,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 38604, stripped down to: 21710 +-- original size: 38616, stripped down to: 21710 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -21069,8 +21069,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 868797 --- stripped bytes : 316105 +-- original bytes : 868809 +-- stripped bytes : 316117 -- end library merge diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 576c95c1f..7dd544b82 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -5930,7 +5930,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 38604, stripped down to: 21710 +-- original size: 38616, stripped down to: 21710 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -21069,8 +21069,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 868797 --- stripped bytes : 316105 +-- original bytes : 868809 +-- stripped bytes : 316117 -- end library merge diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index 576c95c1f..7dd544b82 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -5930,7 +5930,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-str"] = package.loaded["util-str"] or true --- original size: 38604, stripped down to: 21710 +-- original size: 38616, stripped down to: 21710 if not modules then modules={} end modules ['util-str']={ version=1.001, @@ -21069,8 +21069,8 @@ end -- of closure -- used libraries : 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-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 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 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 util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 868797 --- stripped bytes : 316105 +-- original bytes : 868809 +-- stripped bytes : 316117 -- end library merge diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 83849d219..81868a917 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{2018.01.08 23:03} +\newcontextversion{2018.01.12 15:56} %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 bf662cb56..4c654db20 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{2018.01.08 23:03} +\edef\contextversion{2018.01.12 15:56} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 48067eba5..df7d91ce0 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.01.08 23:03} +\newcontextversion{2018.01.12 15:56} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 41eab7de7..54316346a 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -41,7 +41,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2018.01.08 23:03} +\edef\contextversion{2018.01.12 15:56} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/meta-nod.mkiv b/tex/context/base/mkiv/meta-nod.mkiv index 1c6f1309d..5c7b3d503 100644 --- a/tex/context/base/mkiv/meta-nod.mkiv +++ b/tex/context/base/mkiv/meta-nod.mkiv @@ -3,7 +3,7 @@ %D version=2016.11.23, %D title=\METAPOST\ Graphics, %D subtitle=Nodes, -%D author=Alan Braslau and Hans Hagen, +%D author={Alan Braslau and Hans Hagen}, %D date=\currentdate, %D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] %C @@ -11,9 +11,6 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D We might add more here. Also, the node module might get preloaded in -%D all instances. - \unprotect \defineMPinstance @@ -37,3 +34,208 @@ % \stopMPdefinitions \protect + +%D This module provides a simple \TEX\ layer on top of the nodes library that +%D is preloaded in \METAFUN. More information can be found in the manual and +%D article. +%D +%D We strongly advice to use the \METAPOST\ interface and only provide this +%D \TEX\ variant as proof of concept. There are no plans to extend this module +%D because we see no advantage in using a \TEX\ interface over a \METAPOST\ +%D one. +%D +%D \startbuffer +%D \startnodes +%D \placenode[0,0]{A} +%D \placenode[1,0]{B} +%D \connectnodes [0,1] [option=doublearrow] +%D \stopnodes +%D +%D \startnodes[dx=2cm,rotation=45] +%D \placenode[0,0]{A} +%D \placenode[1,0]{B} +%D \placenode[1,1]{C} +%D \placenode[0,1]{D} +%D \connectnodes [0,2] [option=doublearrow,label=a,offset=.05] +%D \connectnodes [1,3] [option=doublearrows] +%D \stopnodes +%D +%D \startnodes[dx=2cm,dy=2cm] +%D \nodeMPcode{ahlength := 12pt ; ahangle := 30 ; ahvariant := 1 ;} +%D \mpcode{ahlength := 12pt ; ahangle := 30 ; ahvariant := 1 ;} +%D \placenode[0,1]{\node{A}} +%D \placenode[1,1]{\node{B}} +%D \placenode[0,0]{\node{C}} +%D \placenode[1,0]{\node{D}} +%D \connectnodes [0,3] [option=arrow,label={ }] +%D \connectnodes [1,2] [option=arrow] +%D \stopnodes +%D \stopbuffer +%D +%D \typebuffer +%D +%D \startlinecorrection \getbuffer \stoplinecorrection + +\unprotect + +\installcorenamespace{metanodes} +\installcorenamespace{metanodesoption} +\installcorenamespace{metanodesalternative} +\installcorenamespace{metanodesposition} + +% todo: maybe instances + +\installparameterhandler \??metanodes {metanodes} +\installsetuphandler \??metanodes {metanodes} + +\setupmetanodes + [\c!option =, + \c!alternative =, + \c!offset =0, + \c!position =, + \c!label =, + \c!dx =2\emwidth, + \c!dy =2\emwidth, + \c!rotation =90, + \c!rulethickness =.5pt, + \c!command =] + +\newtoks\t_every_meta_nodes +\newtoks\t_meta_nodes + +\let\stopnodes\relax + +\unexpanded\def\startnodes + {\dosingleempty\meta_nodes_start} + +\def\meta_nodes_start[#1]#2\stopnodes + {\hpack\bgroup + \iffirstargument + \setupcurrentmetanodes[#1]% + \fi + \edef\p_meta_option{\metanodesparameter\c!option}% + \edef\p_meta_alternative{\metanodesparameter\c!alternative}% + \the\t_every_meta_nodes + \t_meta_nodes\emptytoks + #2\removeunwantedspaces + % for alan, will be commented: + \writestatus{metanodes}{\detokenize\expandafter{\the\t_meta_nodes}}% + \startMPcode + mfun_node_init(% + \the\dimexpr\metanodesparameter\c!dx\relax,% + \the\dimexpr\metanodesparameter\c!dy\relax,% + \metanodesparameter\c!rotation% + ) ; + \the\t_meta_nodes ; + mfun_node_flush ; + \stopMPcode + \egroup} + +% \unexpanded\def\grph_nodes_node[#1,#2]#3% +% {\etoksapp\t_meta_nodes{mfun_node_make(\number#1,\number#2,"\metanodesparameter\c!command{#3}");}} + +\unexpanded\def\grph_nodes_node + {\dodoubleempty\grph_nodes_node_two} + +\def\grph_nodes_node_two[#1][#2]% + {\grph_nodes_node_two_indeed[#1][#2]} + +\def\grph_nodes_node_two_indeed[#1,#2][#3]#4% + {\begingroup + \ifsecondargument + \setupcurrentmetanodes[#3]% + \fi + \edef\p_label{#4}% + \normalexpanded{\endgroup\noexpand\etoksapp\t_meta_nodes{% + mfun_node_make(\number#1,\number#2% + \ifx\p_label\empty \else + ,"\metanodesparameter\c!command{\p_label}"% + \fi + );% + }}} + +\appendtoks + \let\placenode\grph_nodes_node +\to \t_every_meta_nodes + +\unexpanded\def\grph_nodes_fromto + {\dodoubleempty\grph_nodes_fromto_two} + +\def\grph_nodes_fromto_two[#1][#2]% + {\grph_nodes_fromto_two_indeed[#1][#2]}% get rid of {n,m} + +\letvalue{\??metanodesposition }\empty +\setvalue{\??metanodesposition top}{.top} +\setvalue{\??metanodesposition bottom}{.bot} +\setvalue{\??metanodesposition left}{.lft} +\setvalue{\??metanodesposition right}{.rt} +\setvalue{\??metanodesposition upperleft}{.ulft} +\setvalue{\??metanodesposition topleft}{.ulft} +\setvalue{\??metanodesposition lefttop}{.ulft} +\setvalue{\??metanodesposition upperright}{.urt} +\setvalue{\??metanodesposition topright}{.urt} +\setvalue{\??metanodesposition righttop}{.urt} +\setvalue{\??metanodesposition lowerleft}{.llft} +\setvalue{\??metanodesposition bottomleft}{.llft} +\setvalue{\??metanodesposition leftbottom}{.llft} +\setvalue{\??metanodesposition lowerright}{.lrt} +\setvalue{\??metanodesposition bottomright}{.lrt} +\setvalue{\??metanodesposition rightbottom}{.lrt} + +\def\grph_nodes_fromto_two_indeed[#1,#2][#3]% we can't group because etoksapp doesn't like that + {\begingroup + \ifsecondargument + \setupcurrentmetanodes[#3]% + \fi + \edef\p_label {\metanodesparameter\c!label}% + \edef\p_rulethickness{\metanodesparameter\c!rulethickness}% + \edef\p_command {\metanodesparameter\c!command}% better get an error early + \normalexpanded{\endgroup\noexpand\etoksapp\t_meta_nodes{% + \ifcsname\??metanodesalternative\metanodesparameter\c!alternative\endcsname + \lastnamedcs + \else + \csname\??metanodesalternative\endcsname + \fi + \space + mfun_nodes_fromto\begincsname\??metanodesposition\metanodesparameter\c!position\endcsname(% + \metanodesparameter\c!offset,% + \number#1,\number#2% + \ifx\p_label\empty \else + ,"\ifx\p_command\empty\p_label\else\p_command{\p_label}\fi"% + \fi + )% + \space + \ifcsname\??metanodesoption\metanodesparameter\c!option\endcsname + \lastnamedcs + \else + \csname\??metanodesoption\endcsname + \fi + \space + \ifx\p_rulethickness\empty \else + withpen pencircle scaled \the\dimexpr\p_rulethickness\relax + \fi + ;% + }}} + +\setvalue{\??metanodesalternative }{draw} +\setvalue{\??metanodesalternative arrow}{drawarrow} +\setvalue{\??metanodesalternative doublearrow}{drawdblarrow} +\setvalue{\??metanodesalternative doublearrows}{drawdoublearrows} + +\setvalue{\??metanodesoption }{} +\setvalue{\??metanodesoption dashed}{dashed evenly} +\setvalue{\??metanodesoption dotted}{dashed withdots scaled .5} + +\appendtoks + \let\connectnodes\grph_nodes_fromto +\to \t_every_meta_nodes + +\unexpanded\def\grph_nodes_code#1% + {\etoksapp\t_meta_nodes{#1}} + +\appendtoks + \let\nodeMPcode\grph_nodes_code + \let\mpcode\grph_nodes_code +\to \t_every_meta_nodes + +\protect \endinput diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 7818625cd..c5feca20c 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex afcb37ae4..044d5ab28 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/strc-con.mkvi b/tex/context/base/mkiv/strc-con.mkvi index 58e83a009..0aa7e69da 100644 --- a/tex/context/base/mkiv/strc-con.mkvi +++ b/tex/context/base/mkiv/strc-con.mkvi @@ -188,6 +188,27 @@ % \ifdefined\dotagsetconstruction \else \let\dotagsetconstruction\relax \fi +% \startuseMPgraphic{MyFrame} +% picture p ; numeric o ; path a, b ; pair c ; +% p := textext.rt("\FunnyFramed{\currentconstructiontext}") ; +% % p := textext.rt("\wrappedconstruction{\FunnyFramed{\currentconstructiontext}}") ; +% % p := textext.rt("\FunnyFramed{\wrappedconstruction{\currentconstructiontext}}") ; +% % p := textext.rt("\FunnyFramed{\wrappedcurrentconstruction}") ; +% ... +% \stopuseMPgraphic +% +% \defineoverlay[MyFrame][\useMPgraphic{MyFrame}] +% +% \defineframedtext +% [MyText] +% [frame=off, +% background=MyFrame] +% +% \defineenumeration[Theorem] +% [alternative=empty, +% before=\startMyText, +% after=\stopMyText] + \newtoks\everyconstruction \unexpanded\def\currentconstructiontext @@ -201,6 +222,24 @@ \p_strc_constructions_sample \endstrut} +\unexpanded\def\wrappedconstruction#1% + {\begingroup + \iftrialtypesetting \else + \currentconstructionsynchronize + \attribute\destinationattribute\currentconstructionattribute\relax + \fi + #1% + \endgroup} + +\unexpanded\def\wrappedcurrentconstruction + {\begingroup + \iftrialtypesetting \else + \currentconstructionsynchronize + \attribute\destinationattribute\currentconstructionattribute\relax + \fi + \currentconstructiontext + \endgroup} + \unexpanded\setvalue{\??constructionmainhandler\v!construction}#1% {\iftrialtypesetting \else \begingroup @@ -481,6 +520,10 @@ [\v!command] [\c!renderingsetup=\??constructionrenderings:\v!command] +\defineconstructionalternative + [\v!empty] + [\c!renderingsetup=\??constructionrenderings:\v!empty] + \newbox \constructionheadbox \newskip \leftconstructionskip \newskip \rightconstructionskip @@ -857,6 +900,12 @@ \ignorespaces \stopsetups +\startsetups[\??constructionrenderings:\v!empty] + \noindent + \useconstructionstyleandcolor\c!style\c!color + \ignorespaces +\stopsetups + % you can use \placeclosesymbol or \qed to place a symbol at the end of a % construction diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua index f15f291ee..52ecf71ad 100644 --- a/tex/context/base/mkiv/util-str.lua +++ b/tex/context/base/mkiv/util-str.lua @@ -296,7 +296,7 @@ end -- -- integer %...i number -- integer %...d number --- unsigned %...u number +-- unsigned %...u number -- no tused -- character %...c number -- hexadecimal %...x number -- HEXADECIMAL %...X number diff --git a/tex/context/fonts/mkiv/type-imp-libertine.mkiv b/tex/context/fonts/mkiv/type-imp-libertine.mkiv index 4620995b9..4fac1a6aa 100644 --- a/tex/context/fonts/mkiv/type-imp-libertine.mkiv +++ b/tex/context/fonts/mkiv/type-imp-libertine.mkiv @@ -47,12 +47,13 @@ \starttypescript [\s!sans] [biolinum] [\s!name] \setups[\s!font:\s!fallback:\s!sans] - \definefontsynonym [\s!Sans] [Biolinum-Regular] [\s!features=\s!default] - \definefontsynonym [\s!SansBold] [Biolinum-Bold] [\s!features=\s!default] - \definefontsynonym [\s!SansItalic] [Biolinum-Italic] [\s!features=\s!default] - \definefontsynonym [\s!SansSlanted] [Biolinum-Slanted] [\s!features=\s!default] - \definefontsynonym [\s!SansBoldItalic] [Biolinum-BoldSlanted] [\s!features=\s!default] - \definefontsynonym [SansCaps] [Biolinum-Regular] [\s!features=\s!smallcaps] + \definefontsynonym [\s!Sans] [Biolinum-Regular] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [Biolinum-Bold] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [Biolinum-Italic] [\s!features=\s!default] + \definefontsynonym [\s!SansSlanted] [Biolinum-Slanted] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic] [Biolinum-BoldSlanted] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldSlanted] [Biolinum-BoldSlanted] [\s!features=\s!default] + \definefontsynonym [SansCaps] [Biolinum-Regular] [\s!features=\s!smallcaps] \stoptypescript \starttypescript [libertine] @@ -60,6 +61,7 @@ \definetypeface [libertine] [\s!ss] [\s!sans] [biolinum] [\s!default] \definetypeface [libertine] [\s!tt] [\s!mono] [default] [\s!default] %definetypeface [libertine] [\s!mm] [\s!math] [times] [\s!default] + \definetypeface [libertine] [\s!mm] [\s!math] [default] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex 0dfec2ab9..38c4532e4 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex d98590aeb..53ce66a29 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index e828c3023..6da2415ad 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 : 01/08/18 23:03:13 +-- merge date : 01/12/18 15:56:34 do -- begin closure to overcome local limits and interference |