summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-cs.mkii7
-rw-r--r--tex/context/base/mkii/mult-de.mkii10
-rw-r--r--tex/context/base/mkii/mult-en.mkii12
-rw-r--r--tex/context/base/mkii/mult-fr.mkii7
-rw-r--r--tex/context/base/mkii/mult-it.mkii12
-rw-r--r--tex/context/base/mkii/mult-pe.mkii9
-rw-r--r--tex/context/base/mkii/mult-ro.mkii12
-rw-r--r--tex/context/base/mkiv/buff-imp-parsed-xml.lua1
-rw-r--r--tex/context/base/mkiv/char-def.lua16
-rw-r--r--tex/context/base/mkiv/char-ini.lua48
-rw-r--r--tex/context/base/mkiv/char-tex.lua24
-rw-r--r--tex/context/base/mkiv/char-utf.lua1
-rw-r--r--tex/context/base/mkiv/colo-icc.lua1
-rw-r--r--tex/context/base/mkiv/colo-ini.mkiv18
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv9
-rw-r--r--tex/context/base/mkiv/core-two.lua1
-rw-r--r--tex/context/base/mkiv/data-env.lua1
-rw-r--r--tex/context/base/mkiv/data-tmp.lua1
-rw-r--r--tex/context/base/mkiv/font-agl.lua2
-rw-r--r--tex/context/base/mkiv/font-aux.lua2
-rw-r--r--tex/context/base/mkiv/font-con.lua103
-rw-r--r--tex/context/base/mkiv/font-ext.lua52
-rw-r--r--tex/context/base/mkiv/font-fbk.lua1
-rw-r--r--tex/context/base/mkiv/font-gbn.lua2
-rw-r--r--tex/context/base/mkiv/font-ini.mkvi2
-rw-r--r--tex/context/base/mkiv/font-lig.lua2
-rw-r--r--tex/context/base/mkiv/font-ocl.lua136
-rw-r--r--tex/context/base/mkiv/font-ots.lua16
-rw-r--r--tex/context/base/mkiv/font-pre.mkiv4
-rw-r--r--tex/context/base/mkiv/font-sel.lua2
-rw-r--r--tex/context/base/mkiv/font-shp.lua2
-rw-r--r--tex/context/base/mkiv/font-tra.mkiv8
-rw-r--r--tex/context/base/mkiv/grph-fig.mkiv5
-rw-r--r--tex/context/base/mkiv/grph-inc.lua27
-rw-r--r--tex/context/base/mkiv/grph-rul.lua2
-rw-r--r--tex/context/base/mkiv/l-lua.lua2
-rw-r--r--tex/context/base/mkiv/l-unicode.lua26
-rw-r--r--tex/context/base/mkiv/l-url.lua2
-rw-r--r--tex/context/base/mkiv/lang-dis.lua152
-rw-r--r--tex/context/base/mkiv/lang-exp.lua219
-rw-r--r--tex/context/base/mkiv/lang-hyp.lua53
-rw-r--r--tex/context/base/mkiv/lang-ini.lua2
-rw-r--r--tex/context/base/mkiv/lang-rep.lua2
-rw-r--r--tex/context/base/mkiv/lang-wrd.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-epa.lua13
-rw-r--r--tex/context/base/mkiv/lpdf-epd.lua2
-rw-r--r--tex/context/base/mkiv/lpdf-fld.lua64
-rw-r--r--tex/context/base/mkiv/lpdf-wid.lua2
-rw-r--r--tex/context/base/mkiv/luat-cod.lua4
-rw-r--r--tex/context/base/mkiv/luat-run.lua1
-rw-r--r--tex/context/base/mkiv/lxml-sor.lua1
-rw-r--r--tex/context/base/mkiv/lxml-xml.lua2
-rw-r--r--tex/context/base/mkiv/math-act.lua49
-rw-r--r--tex/context/base/mkiv/math-fbk.lua2
-rw-r--r--tex/context/base/mkiv/math-ini.lua42
-rw-r--r--tex/context/base/mkiv/math-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/meta-fnt.lua1
-rw-r--r--tex/context/base/mkiv/mlib-lua.lua18
-rw-r--r--tex/context/base/mkiv/mlib-pdf.lua4
-rw-r--r--tex/context/base/mkiv/mlib-pps.lua2
-rw-r--r--tex/context/base/mkiv/mlib-run.lua2
-rw-r--r--tex/context/base/mkiv/mult-aux.lua1
-rw-r--r--tex/context/base/mkiv/mult-def.lua43
-rw-r--r--tex/context/base/mkiv/mult-ini.lua2
-rw-r--r--tex/context/base/mkiv/mult-low.lua3
-rw-r--r--tex/context/base/mkiv/node-fnt.lua62
-rw-r--r--tex/context/base/mkiv/node-nut.lua111
-rw-r--r--tex/context/base/mkiv/node-tra.lua1
-rw-r--r--tex/context/base/mkiv/page-brk.mkiv2
-rw-r--r--tex/context/base/mkiv/page-ffl.mkiv211
-rw-r--r--tex/context/base/mkiv/page-flt.lua1
-rw-r--r--tex/context/base/mkiv/page-lay.mkiv35
-rw-r--r--tex/context/base/mkiv/page-mix.lua25
-rw-r--r--tex/context/base/mkiv/page-mix.mkiv48
-rw-r--r--tex/context/base/mkiv/page-mrk.mkiv40
-rw-r--r--tex/context/base/mkiv/page-otr.mkvi2
-rw-r--r--tex/context/base/mkiv/page-sid.mkiv89
-rw-r--r--tex/context/base/mkiv/publ-ini.lua177
-rw-r--r--tex/context/base/mkiv/scrn-wid.lua2
-rw-r--r--tex/context/base/mkiv/scrp-ini.lua2
-rw-r--r--tex/context/base/mkiv/spac-hor.mkiv6
-rw-r--r--tex/context/base/mkiv/spac-ver.mkiv75
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25825 -> 25766 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250644 -> 249431 bytes
-rw-r--r--tex/context/base/mkiv/strc-blk.lua2
-rw-r--r--tex/context/base/mkiv/strc-enu.mkvi3
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi102
-rw-r--r--tex/context/base/mkiv/strc-itm.mkvi13
-rw-r--r--tex/context/base/mkiv/strc-lst.lua2
-rw-r--r--tex/context/base/mkiv/strc-lst.mkvi3
-rw-r--r--tex/context/base/mkiv/strc-mat.mkiv13
-rw-r--r--tex/context/base/mkiv/strc-not.mkvi10
-rw-r--r--tex/context/base/mkiv/strc-ref.lua2
-rw-r--r--tex/context/base/mkiv/strc-reg.lua1
-rw-r--r--tex/context/base/mkiv/strc-sec.mkiv48
-rw-r--r--tex/context/base/mkiv/strc-syn.mkiv24
-rw-r--r--tex/context/base/mkiv/supp-box.lua2
-rw-r--r--tex/context/base/mkiv/supp-box.mkiv3
-rw-r--r--tex/context/base/mkiv/syst-aux.lua2
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv5
-rw-r--r--tex/context/base/mkiv/tabl-mis.mkiv13
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkiv21
-rw-r--r--tex/context/base/mkiv/tabl-xtb.lua70
-rw-r--r--tex/context/base/mkiv/tabl-xtb.mkvi65
-rw-r--r--tex/context/base/mkiv/task-ini.lua2
-rw-r--r--tex/context/base/mkiv/toks-ini.lua1
-rw-r--r--tex/context/base/mkiv/trac-ctx.lua2
-rw-r--r--tex/context/base/mkiv/trac-fil.lua2
-rw-r--r--tex/context/base/mkiv/trac-lmx.lua2
-rw-r--r--tex/context/base/mkiv/trac-pro.lua2
-rw-r--r--tex/context/base/mkiv/trac-vis.lua206
-rw-r--r--tex/context/base/mkiv/typo-dir.mkiv2
-rw-r--r--tex/context/base/mkiv/typo-krn.lua28
-rw-r--r--tex/context/base/mkiv/typo-pnc.lua169
-rw-r--r--tex/context/base/mkiv/typo-pnc.mkiv55
-rw-r--r--tex/context/base/mkiv/typo-sus.lua2
-rw-r--r--tex/context/base/mkiv/typo-tal.lua128
-rw-r--r--tex/context/base/mkiv/typo-tal.mkiv111
-rw-r--r--tex/context/base/mkiv/util-evo-imp-server.lua127
-rw-r--r--tex/context/base/mkiv/util-evo.lua847
-rw-r--r--tex/context/base/mkiv/util-jsn.lua2
-rw-r--r--tex/context/base/mkiv/util-prs.lua12
-rw-r--r--tex/context/base/mkiv/util-str.lua129
-rw-r--r--tex/context/base/mkiv/util-tpl.lua2
-rw-r--r--tex/context/base/mkiv/util-you.lua327
-rw-r--r--tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv4
-rw-r--r--tex/context/interface/mkii/keys-cs.xml7
-rw-r--r--tex/context/interface/mkii/keys-de.xml10
-rw-r--r--tex/context/interface/mkii/keys-en.xml12
-rw-r--r--tex/context/interface/mkii/keys-fr.xml7
-rw-r--r--tex/context/interface/mkii/keys-it.xml12
-rw-r--r--tex/context/interface/mkii/keys-pe.xml9
-rw-r--r--tex/context/interface/mkii/keys-ro.xml12
-rw-r--r--tex/context/interface/mkiv/context-en.xml13
-rw-r--r--tex/context/interface/mkiv/i-backend.xml2
-rw-r--r--tex/context/interface/mkiv/i-context.pdfbin845323 -> 846320 bytes
-rw-r--r--tex/context/interface/mkiv/i-floats.xml10
-rw-r--r--tex/context/interface/mkiv/i-initial.xml4
-rw-r--r--tex/context/interface/mkiv/i-itemgroup.xml3
-rw-r--r--tex/context/interface/mkiv/i-readme.pdfbin60775 -> 60774 bytes
-rw-r--r--tex/context/interface/mkiv/i-section.xml1
-rw-r--r--tex/context/interface/mkiv/i-strut.xml4
-rw-r--r--tex/context/interface/mkiv/i-todo.xml21
-rw-r--r--tex/context/modules/mkiv/m-timing.mkiv2
-rw-r--r--tex/context/modules/mkiv/m-typesetting.mkiv92
-rw-r--r--tex/context/modules/mkiv/s-evohome.mkiv24
-rw-r--r--tex/context/modules/mkiv/s-fonts-ligatures.mkiv4
-rw-r--r--tex/context/modules/mkiv/s-fonts-variable.mkiv12
-rw-r--r--tex/context/modules/mkiv/s-youless.mkiv228
-rw-r--r--tex/context/modules/mkiv/x-asciimath.lua2
-rw-r--r--tex/context/modules/mkiv/x-calcmath.lua1
-rw-r--r--tex/context/modules/mkiv/x-cals.lua2
-rw-r--r--tex/context/modules/mkiv/x-setups-basics.mkiv143
-rw-r--r--tex/context/modules/mkiv/x-setups-overview.mkiv67
-rw-r--r--tex/generic/context/luatex/luatex-core.lua46
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua186
-rw-r--r--tex/generic/context/luatex/luatex-mplib.lua211
-rw-r--r--tex/generic/context/luatex/luatex-swiglib.lua8
161 files changed, 4159 insertions, 1735 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 6a789e77d..83849d219 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.22 13:35}
+\newcontextversion{2018.01.08 23:03}
%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 6c74abf3a..bf662cb56 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.11.22 13:35}
+\edef\contextversion{2018.01.08 23:03}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-cs.mkii b/tex/context/base/mkii/mult-cs.mkii
index 61ddaa391..fdce40a3a 100644
--- a/tex/context/base/mkii/mult-cs.mkii
+++ b/tex/context/base/mkii/mult-cs.mkii
@@ -621,6 +621,10 @@
\setinterfaceconstant{align}{zarovnani}
\setinterfaceconstant{aligncharacter}{aligncharacter}
\setinterfaceconstant{alignmentcharacter}{alignmentcharacter}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{zarovnejtitul}
\setinterfaceconstant{alternative}{alternativa}
@@ -907,6 +911,7 @@
\setinterfaceconstant{leftoffset}{levyoffset}
\setinterfaceconstant{leftquotation}{citacevlevo}
\setinterfaceconstant{leftquote}{citovatvlevo}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{vetavlevo}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{stylvlevo}
@@ -979,6 +984,7 @@
\setinterfaceconstant{nlines}{nradky}
\setinterfaceconstant{norm}{norm}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{nvpravo}
\setinterfaceconstant{ntop}{nvrsek}
@@ -1109,6 +1115,7 @@
\setinterfaceconstant{rightoffset}{pravyoffset}
\setinterfaceconstant{rightquotation}{citacevpravo}
\setinterfaceconstant{rightquote}{citovatvpravo}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{vetavpravo}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{stylvpravo}
diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii
index 5f8545a90..e26ceb851 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -376,6 +376,7 @@
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normal}
\setinterfacevariable{nospacing}{nospacing}
+\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{nicht}
\setinterfacevariable{notation}{notation}
\setinterfacevariable{note}{note}
@@ -621,6 +622,10 @@
\setinterfaceconstant{align}{ausrichtung}
\setinterfaceconstant{aligncharacter}{aligncharacter}
\setinterfaceconstant{alignmentcharacter}{alignmentcharacter}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{titelausrichten}
\setinterfaceconstant{alternative}{alternative}
@@ -907,6 +912,7 @@
\setinterfaceconstant{leftoffset}{linkeroffset}
\setinterfaceconstant{leftquotation}{linkerzitat}
\setinterfaceconstant{leftquote}{linkerzitieren}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{linkersatz}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{linkerstil}
@@ -979,6 +985,7 @@
\setinterfaceconstant{nlines}{zzeile}
\setinterfaceconstant{norm}{norm}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{nrechts}
\setinterfaceconstant{ntop}{noben}
@@ -1109,6 +1116,7 @@
\setinterfaceconstant{rightoffset}{rechterabstand}
\setinterfaceconstant{rightquotation}{rechterzitat}
\setinterfaceconstant{rightquote}{rechterzitieren}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{rechtersatz}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{rechterstil}
@@ -1165,7 +1173,9 @@
\setinterfaceconstant{source}{quelle}
\setinterfaceconstant{space}{spatium}
\setinterfaceconstant{spaceafter}{nachspatium}
+\setinterfaceconstant{spaceafterside}{spaceafterside}
\setinterfaceconstant{spacebefore}{vorspatium}
+\setinterfaceconstant{spacebeforeside}{spacebeforeside}
\setinterfaceconstant{spaceinbetween}{spaceinbetween}
\setinterfaceconstant{spacing}{spatiumausgleich}
\setinterfaceconstant{specification}{specification}
diff --git a/tex/context/base/mkii/mult-en.mkii b/tex/context/base/mkii/mult-en.mkii
index ca4675c08..cc9cc5feb 100644
--- a/tex/context/base/mkii/mult-en.mkii
+++ b/tex/context/base/mkii/mult-en.mkii
@@ -376,6 +376,7 @@
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normal}
\setinterfacevariable{nospacing}{nospacing}
+\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{not}
\setinterfacevariable{notation}{notation}
\setinterfacevariable{note}{note}
@@ -621,6 +622,10 @@
\setinterfaceconstant{align}{align}
\setinterfaceconstant{aligncharacter}{aligncharacter}
\setinterfaceconstant{alignmentcharacter}{alignmentcharacter}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{aligntitle}
\setinterfaceconstant{alternative}{alternative}
@@ -907,6 +912,7 @@
\setinterfaceconstant{leftoffset}{leftoffset}
\setinterfaceconstant{leftquotation}{leftquotation}
\setinterfaceconstant{leftquote}{leftquote}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{leftsentence}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{leftstyle}
@@ -979,6 +985,7 @@
\setinterfaceconstant{nlines}{nlines}
\setinterfaceconstant{norm}{norm}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{nright}
\setinterfaceconstant{ntop}{ntop}
@@ -998,6 +1005,7 @@
\setinterfaceconstant{numberset}{numberset}
\setinterfaceconstant{numberstarter}{numberstarter}
\setinterfaceconstant{numberstopper}{numberstopper}
+\setinterfaceconstant{numberstrut}{numberstrut}
\setinterfaceconstant{numberstyle}{numberstyle}
\setinterfaceconstant{numberwidth}{numberwidth}
\setinterfaceconstant{nx}{nx}
@@ -1109,6 +1117,7 @@
\setinterfaceconstant{rightoffset}{rightoffset}
\setinterfaceconstant{rightquotation}{rightquotation}
\setinterfaceconstant{rightquote}{rightquote}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{rightsentence}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{rightstyle}
@@ -1165,7 +1174,9 @@
\setinterfaceconstant{source}{source}
\setinterfaceconstant{space}{space}
\setinterfaceconstant{spaceafter}{spaceafter}
+\setinterfaceconstant{spaceafterside}{spaceafterside}
\setinterfaceconstant{spacebefore}{spacebefore}
+\setinterfaceconstant{spacebeforeside}{spacebeforeside}
\setinterfaceconstant{spaceinbetween}{spaceinbetween}
\setinterfaceconstant{spacing}{spacing}
\setinterfaceconstant{specification}{specification}
@@ -1230,6 +1241,7 @@
\setinterfaceconstant{titledistance}{titledistance}
\setinterfaceconstant{titleleft}{titleleft}
\setinterfaceconstant{titleright}{titleright}
+\setinterfaceconstant{titlestrut}{titlestrut}
\setinterfaceconstant{titlestyle}{titlestyle}
\setinterfaceconstant{to}{to}
\setinterfaceconstant{toffset}{toffset}
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 42335c3ac..926b52f7b 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -621,6 +621,10 @@
\setinterfaceconstant{align}{alignement}
\setinterfaceconstant{aligncharacter}{caracterealigne}
\setinterfaceconstant{alignmentcharacter}{alignementcaractere}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{alignementtitre}
\setinterfaceconstant{alternative}{alternative}
@@ -907,6 +911,7 @@
\setinterfaceconstant{leftoffset}{decalagegauche}
\setinterfaceconstant{leftquotation}{citationgauche}
\setinterfaceconstant{leftquote}{citergauche}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{phrasegauche}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{leftstyle}
@@ -979,6 +984,7 @@
\setinterfaceconstant{nlines}{nlignes}
\setinterfaceconstant{norm}{norme}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{ndroite}
\setinterfaceconstant{ntop}{nsup}
@@ -1109,6 +1115,7 @@
\setinterfaceconstant{rightoffset}{rightoffset}
\setinterfaceconstant{rightquotation}{citationdroite}
\setinterfaceconstant{rightquote}{citerdroite}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{phrasedroite}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{styledroit}
diff --git a/tex/context/base/mkii/mult-it.mkii b/tex/context/base/mkii/mult-it.mkii
index 7cc5b6524..79cb6de4e 100644
--- a/tex/context/base/mkii/mult-it.mkii
+++ b/tex/context/base/mkii/mult-it.mkii
@@ -376,6 +376,7 @@
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normale}
\setinterfacevariable{nospacing}{nospacing}
+\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{non}
\setinterfacevariable{notation}{notation}
\setinterfacevariable{note}{note}
@@ -621,6 +622,10 @@
\setinterfaceconstant{align}{allinea}
\setinterfaceconstant{aligncharacter}{allineacarattere}
\setinterfaceconstant{alignmentcharacter}{carattereallineamento}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{allineatitolo}
\setinterfaceconstant{alternative}{alternativa}
@@ -907,6 +912,7 @@
\setinterfaceconstant{leftoffset}{offsetsinistro}
\setinterfaceconstant{leftquotation}{citazionesinistra}
\setinterfaceconstant{leftquote}{menzionesinistra}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{frasesinistra}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{stilesinistra}
@@ -979,6 +985,7 @@
\setinterfaceconstant{nlines}{nrighe}
\setinterfaceconstant{norm}{norma}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{ndestra}
\setinterfaceconstant{ntop}{ncima}
@@ -998,6 +1005,7 @@
\setinterfaceconstant{numberset}{numberset}
\setinterfaceconstant{numberstarter}{numberstarter}
\setinterfaceconstant{numberstopper}{numberstopper}
+\setinterfaceconstant{numberstrut}{numberstrut}
\setinterfaceconstant{numberstyle}{stilenumero}
\setinterfaceconstant{numberwidth}{numberwidth}
\setinterfaceconstant{nx}{nx}
@@ -1109,6 +1117,7 @@
\setinterfaceconstant{rightoffset}{offsetdestro}
\setinterfaceconstant{rightquotation}{citazionedestra}
\setinterfaceconstant{rightquote}{menzionedestra}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{frasedestra}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{stiledestra}
@@ -1165,7 +1174,9 @@
\setinterfaceconstant{source}{origine}
\setinterfaceconstant{space}{spazio}
\setinterfaceconstant{spaceafter}{spaziodopo}
+\setinterfaceconstant{spaceafterside}{spaceafterside}
\setinterfaceconstant{spacebefore}{spazioprima}
+\setinterfaceconstant{spacebeforeside}{spacebeforeside}
\setinterfaceconstant{spaceinbetween}{spaceinbetween}
\setinterfaceconstant{spacing}{spaziatura}
\setinterfaceconstant{specification}{specification}
@@ -1230,6 +1241,7 @@
\setinterfaceconstant{titledistance}{distanzatitolo}
\setinterfaceconstant{titleleft}{titleleft}
\setinterfaceconstant{titleright}{titleright}
+\setinterfaceconstant{titlestrut}{titlestrut}
\setinterfaceconstant{titlestyle}{stiletitolo}
\setinterfaceconstant{to}{verso}
\setinterfaceconstant{toffset}{toffset}
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index 8ac3113cf..02007f158 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -621,6 +621,10 @@
\setinterfaceconstant{align}{تنظیم}
\setinterfaceconstant{aligncharacter}{حرف‌تنظیم}
\setinterfaceconstant{alignmentcharacter}{حرف‌تنظیم‌کردن}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{عنوان‌تنظیم}
\setinterfaceconstant{alternative}{جایگزین}
@@ -907,6 +911,7 @@
\setinterfaceconstant{leftoffset}{آفست‌چپ}
\setinterfaceconstant{leftquotation}{نقل‌قول‌چپ}
\setinterfaceconstant{leftquote}{نقل‌چپ}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{جمله‌چپ}
\setinterfaceconstant{leftspeech}{سخنرانی‌چپ}
\setinterfaceconstant{leftstyle}{سبک‌چپ}
@@ -979,6 +984,7 @@
\setinterfaceconstant{nlines}{nlines}
\setinterfaceconstant{norm}{norm}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{nright}
\setinterfaceconstant{ntop}{ntop}
@@ -1109,6 +1115,7 @@
\setinterfaceconstant{rightoffset}{آفست‌راست}
\setinterfaceconstant{rightquotation}{نقل‌قول‌راست}
\setinterfaceconstant{rightquote}{نقل‌راست}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{جمله‌راست}
\setinterfaceconstant{rightspeech}{سخنرانی‌راست}
\setinterfaceconstant{rightstyle}{سبک‌راست}
@@ -1165,7 +1172,9 @@
\setinterfaceconstant{source}{منبع}
\setinterfaceconstant{space}{فضا}
\setinterfaceconstant{spaceafter}{فضا‌بعداز}
+\setinterfaceconstant{spaceafterside}{spaceafterside}
\setinterfaceconstant{spacebefore}{فضا‌قبل‌از}
+\setinterfaceconstant{spacebeforeside}{spacebeforeside}
\setinterfaceconstant{spaceinbetween}{فضا‌دربین}
\setinterfaceconstant{spacing}{فضاگذاری}
\setinterfaceconstant{specification}{specification}
diff --git a/tex/context/base/mkii/mult-ro.mkii b/tex/context/base/mkii/mult-ro.mkii
index cb9781e80..7862b2d30 100644
--- a/tex/context/base/mkii/mult-ro.mkii
+++ b/tex/context/base/mkii/mult-ro.mkii
@@ -376,6 +376,7 @@
\setinterfacevariable{norepeat}{norepeat}
\setinterfacevariable{normal}{normal}
\setinterfacevariable{nospacing}{nospacing}
+\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{nu}
\setinterfacevariable{notation}{notation}
\setinterfacevariable{note}{note}
@@ -621,6 +622,10 @@
\setinterfaceconstant{align}{aliniere}
\setinterfaceconstant{aligncharacter}{aliniazacaracter}
\setinterfaceconstant{alignmentcharacter}{alierecaracter}
+\setinterfaceconstant{alignmentleftsample}{alignmentleftsample}
+\setinterfaceconstant{alignmentleftwidth}{alignmentleftwidth}
+\setinterfaceconstant{alignmentrightsample}{alignmentrightsample}
+\setinterfaceconstant{alignmentrightwidth}{alignmentrightwidth}
\setinterfaceconstant{alignsymbol}{alignsymbol}
\setinterfaceconstant{aligntitle}{alinieretitlu}
\setinterfaceconstant{alternative}{alternativ}
@@ -907,6 +912,7 @@
\setinterfaceconstant{leftoffset}{offsetstanga}
\setinterfaceconstant{leftquotation}{citatstanga}
\setinterfaceconstant{leftquote}{minicitatstanga}
+\setinterfaceconstant{leftsample}{leftsample}
\setinterfaceconstant{leftsentence}{propozitiestanga}
\setinterfaceconstant{leftspeech}{leftspeech}
\setinterfaceconstant{leftstyle}{stilstanga}
@@ -979,6 +985,7 @@
\setinterfaceconstant{nlines}{nlinii}
\setinterfaceconstant{norm}{norm}
\setinterfaceconstant{note}{note}
+\setinterfaceconstant{notes}{notes}
\setinterfaceconstant{nr}{nr}
\setinterfaceconstant{nright}{ndreapta}
\setinterfaceconstant{ntop}{nsus}
@@ -998,6 +1005,7 @@
\setinterfaceconstant{numberset}{numberset}
\setinterfaceconstant{numberstarter}{numberstarter}
\setinterfaceconstant{numberstopper}{numberstopper}
+\setinterfaceconstant{numberstrut}{numberstrut}
\setinterfaceconstant{numberstyle}{stilnumar}
\setinterfaceconstant{numberwidth}{numberwidth}
\setinterfaceconstant{nx}{nx}
@@ -1109,6 +1117,7 @@
\setinterfaceconstant{rightoffset}{offsetdreapta}
\setinterfaceconstant{rightquotation}{citatdreapta}
\setinterfaceconstant{rightquote}{minicitatdreapta}
+\setinterfaceconstant{rightsample}{rightsample}
\setinterfaceconstant{rightsentence}{propozitiedreapta}
\setinterfaceconstant{rightspeech}{rightspeech}
\setinterfaceconstant{rightstyle}{stildreapta}
@@ -1165,7 +1174,9 @@
\setinterfaceconstant{source}{sursa}
\setinterfaceconstant{space}{spatiu}
\setinterfaceconstant{spaceafter}{spatiudupa}
+\setinterfaceconstant{spaceafterside}{spaceafterside}
\setinterfaceconstant{spacebefore}{spatiuinainte}
+\setinterfaceconstant{spacebeforeside}{spacebeforeside}
\setinterfaceconstant{spaceinbetween}{spaceinbetween}
\setinterfaceconstant{spacing}{spatiere}
\setinterfaceconstant{specification}{specification}
@@ -1230,6 +1241,7 @@
\setinterfaceconstant{titledistance}{distantatitlu}
\setinterfaceconstant{titleleft}{titleleft}
\setinterfaceconstant{titleright}{titleright}
+\setinterfaceconstant{titlestrut}{titlestrut}
\setinterfaceconstant{titlestyle}{stiltitlu}
\setinterfaceconstant{to}{catre}
\setinterfaceconstant{toffset}{toffset}
diff --git a/tex/context/base/mkiv/buff-imp-parsed-xml.lua b/tex/context/base/mkiv/buff-imp-parsed-xml.lua
index b18fb65aa..b098a4989 100644
--- a/tex/context/base/mkiv/buff-imp-parsed-xml.lua
+++ b/tex/context/base/mkiv/buff-imp-parsed-xml.lua
@@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['buff-imp-parsed-xml'] = {
license = "see context related readme files"
}
+local next = next
local format = string.format
local context = context
diff --git a/tex/context/base/mkiv/char-def.lua b/tex/context/base/mkiv/char-def.lua
index 58e1f2c44..d501d73b6 100644
--- a/tex/context/base/mkiv/char-def.lua
+++ b/tex/context/base/mkiv/char-def.lua
@@ -475,12 +475,7 @@ characters.data={
direction="cs",
linebreak="is",
mathclass="punctuation",
- mathspec={
- {
- class="punctuation",
- name="ldotp",
- },
- },
+ mathname="ldotp",
synonyms={ "decimal point", "dot", "period" },
unicodeslot=0x2E,
},
@@ -492,14 +487,7 @@ characters.data={
description="SOLIDUS",
direction="cs",
linebreak="sy",
- mathspec={
- {
- class="middle",
- },
- {
- class="ordinary",
- },
- },
+ mathclass="middle",
synonyms={ "slash", "virgule" },
unicodeslot=0x2F,
},
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 8bf35a8dd..a2bb9694c 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -512,7 +512,7 @@ local blocks = allocate {
["uppercaseboldfraktur"] = { first = 0x1D56C, last = 0x1D585, math = true },
["uppercasebolditalic"] = { first = 0x1D468, last = 0x1D481, math = true },
["uppercaseboldscript"] = { first = 0x1D4D0, last = 0x1D4E9, math = true },
- ["uppercasedoublestruck"] = { first = 0x1D538, last = 0x1D551, math = true },
+ ["uppercasedoublestruck"] = { first = 0x1D538, last = 0x1D551, math = true }, -- gaps are filled in elsewhere
["uppercasefraktur"] = { first = 0x1D504, last = 0x1D51D, math = true },
["uppercasegreekbold"] = { first = 0x1D6A8, last = 0x1D6C1, math = true },
["uppercasegreekbolditalic"] = { first = 0x1D71C, last = 0x1D735, math = true },
@@ -540,6 +540,52 @@ local blocks = allocate {
["zanabazarsquare"] = { first = 0x11A00, last = 0x11A4F, description = "Zanabazar Square" },
}
+-- moved from math-act.lua to here:
+
+-- operators : 0x02200
+-- symbolsa : 0x02701
+-- symbolsb : 0x02901
+-- supplemental : 0x02A00
+
+blocks.lowercaseitalic.gaps = {
+ [0x1D455] = 0x0210E, -- ℎ h
+}
+
+blocks.uppercasescript.gaps = {
+ [0x1D49D] = 0x0212C, -- ℬ script B
+ [0x1D4A0] = 0x02130, -- ℰ script E
+ [0x1D4A1] = 0x02131, -- ℱ script F
+ [0x1D4A3] = 0x0210B, -- ℋ script H
+ [0x1D4A4] = 0x02110, -- ℐ script I
+ [0x1D4A7] = 0x02112, -- ℒ script L
+ [0x1D4A8] = 0x02133, -- ℳ script M
+ [0x1D4AD] = 0x0211B, -- ℛ script R
+}
+
+blocks.lowercasescript.gaps = {
+ [0x1D4BA] = 0x0212F, -- ℯ script e
+ [0x1D4BC] = 0x0210A, -- ℊ script g
+ [0x1D4C4] = 0x02134, -- ℴ script o
+}
+
+blocks.uppercasefraktur.gaps = {
+ [0x1D506] = 0x0212D, -- ℭ fraktur C
+ [0x1D50B] = 0x0210C, -- ℌ fraktur H
+ [0x1D50C] = 0x02111, -- ℑ fraktur I
+ [0x1D515] = 0x0211C, -- ℜ fraktur R
+ [0x1D51D] = 0x02128, -- ℨ fraktur Z
+}
+
+blocks.uppercasedoublestruck.gaps = {
+ [0x1D53A] = 0x02102, -- ℂ bb C
+ [0x1D53F] = 0x0210D, -- ℍ bb H
+ [0x1D545] = 0x02115, -- ℕ bb N
+ [0x1D547] = 0x02119, -- ℙ bb P
+ [0x1D548] = 0x0211A, -- ℚ bb Q
+ [0x1D549] = 0x0211D, -- ℝ bb R
+ [0x1D551] = 0x02124, -- ℤ bb Z
+}
+
characters.blocks = blocks
function characters.blockrange(name)
diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua
index 4ab906bd5..658a01b0b 100644
--- a/tex/context/base/mkiv/char-tex.lua
+++ b/tex/context/base/mkiv/char-tex.lua
@@ -622,11 +622,25 @@ if not csletters then
-- this slows down format generation by over 10 percent
for k, v in next, blocks do
if v.catcode == "letter" then
- for u=v.first,v.last do
- csletters[utfchar(u)] = u
- --
- -- texsetlccode(u,u,u) -- self self
- --
+ local first = v.first
+ local last = v.last
+ local gaps = v.gaps
+ if first and last then
+ for u=first,last do
+ csletters[utfchar(u)] = u
+ --
+ -- texsetlccode(u,u,u) -- self self
+ --
+ end
+ end
+ if gaps then
+ for i=1,#gaps do
+ local u = gaps[i]
+ csletters[utfchar(u)] = u
+ --
+ -- texsetlccode(u,u,u) -- self self
+ --
+ end
end
end
end
diff --git a/tex/context/base/mkiv/char-utf.lua b/tex/context/base/mkiv/char-utf.lua
index 0aeadcc85..8f46ae98f 100644
--- a/tex/context/base/mkiv/char-utf.lua
+++ b/tex/context/base/mkiv/char-utf.lua
@@ -22,6 +22,7 @@ over a string.</p>
educational purposes.</p>
--ldx]]--
+local next, type = next, type
local gsub, find = string.gsub, string.find
local concat, sortedhash, keys, sort = table.concat, table.sortedhash, table.keys, table.sort
local utfchar, utfbyte, utfcharacters, utfvalues = utf.char, utf.byte, utf.characters, utf.values
diff --git a/tex/context/base/mkiv/colo-icc.lua b/tex/context/base/mkiv/colo-icc.lua
index 54072fefa..06a913e17 100644
--- a/tex/context/base/mkiv/colo-icc.lua
+++ b/tex/context/base/mkiv/colo-icc.lua
@@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['colo-icc'] = {
local char, byte, gsub, match, format, strip = string.char, string.byte, string.gsub, string.match, string.format, string.strip
local readstring, readnumber = io.readstring, io.readnumber
local band = bit32.band
+local next = next
local colors = attributes and attributes.colors or { } -- when used in mtxrun
diff --git a/tex/context/base/mkiv/colo-ini.mkiv b/tex/context/base/mkiv/colo-ini.mkiv
index a726a91d6..daee8ada6 100644
--- a/tex/context/base/mkiv/colo-ini.mkiv
+++ b/tex/context/base/mkiv/colo-ini.mkiv
@@ -1432,9 +1432,12 @@
\definecolor[trace:r][r=.75,t=.5,a=1]
\definecolor[trace:g][g=.75,t=.5,a=1]
\definecolor[trace:b][b=.75,t=.5,a=1]
-\definecolor[trace:c][c=.75,t=.5,a=1]
-\definecolor[trace:m][m=.75,t=.5,a=1]
-\definecolor[trace:y][y=.75,t=.5,a=1]
+%definecolor[trace:c][c=.75,t=.5,a=1]
+\definecolor[trace:c][g=.75,b=.75,t=.5,a=1]
+%definecolor[trace:m][m=.75,t=.5,a=1]
+\definecolor[trace:m][r=.75,b=.75,t=.5,a=1]
+%definecolor[trace:y][y=.75,t=.5,a=1]
+\definecolor[trace:y][r=.75,g=.75,t=.5,a=1]
\definecolor[trace:s][s=.75,t=.5,a=1]
\definecolor[trace:d][s=.25,t=.5,a=1]
\definecolor[trace:o][r=1,g=.6,b=.1,t=.5,a=1]
@@ -1443,9 +1446,12 @@
\definecolor[trace:dr][r=.75,t=.75,a=1]
\definecolor[trace:dg][g=.75,t=.75,a=1]
\definecolor[trace:db][b=.75,t=.75,a=1]
-\definecolor[trace:dc][c=.75,t=.75,a=1]
-\definecolor[trace:dm][m=.75,t=.75,a=1]
-\definecolor[trace:dy][y=.75,t=.75,a=1]
+%definecolor[trace:dc][c=.75,t=.75,a=1]
+\definecolor[trace:dc][g=.75,b=.75,t=.75,a=1]
+%definecolor[trace:dm][m=.75,t=.75,a=1]
+\definecolor[trace:dm][r=.75,b=.75,t=.75,a=1]
+%definecolor[trace:dy][y=.75,t=.75,a=1]
+\definecolor[trace:y][r=.75,g=.75,t=.75,a=1]
\definecolor[trace:ds][s=.75,t=.75,a=1]
\definecolor[trace:dd][s=.25,t=.75,a=1]
\definecolor[trace:do][r=1,g=.6,b=.1,t=.75,a=1]
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 37ce0c00b..48067eba5 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.11.22 13:35}
+\newcontextversion{2018.01.08 23:03}
%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 0b1f3b097..41eab7de7 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{2017.11.22 13:35}
+\edef\contextversion{2018.01.08 23:03}
\edef\contextkind {beta}
%D For those who want to use this:
@@ -76,8 +76,8 @@
%D We just quit if new functionality is expected.
-\ifnum\luatexversion<70 % also change message
- \writestatus{!!!!}{Your luatex binary is too old, you need at least version 0.70!}
+\ifnum\luatexversion<105 % also change message
+ \writestatus{!!!!}{Your luatex binary is too old, you need at least version 1.05!}
\expandafter\end
\fi
@@ -434,6 +434,7 @@
\loadmarkfile{typo-chr}
\loadmarkfile{typo-rub}
\loadmkivfile{typo-fkr}
+\loadmkivfile{typo-pnc}
\loadmkvifile{type-ini}
\loadmarkfile{type-set}
@@ -521,6 +522,8 @@
\loadmarkfile{page-app}
\loadmarkfile{meta-fig}
+\loadmarkfile{page-ffl}
+
\loadmarkfile{lang-spa} % will become obsolete
\loadmarkfile{typo-ovl} % fuzzy project (tracing) code
diff --git a/tex/context/base/mkiv/core-two.lua b/tex/context/base/mkiv/core-two.lua
index bb1afa7db..5192677b2 100644
--- a/tex/context/base/mkiv/core-two.lua
+++ b/tex/context/base/mkiv/core-two.lua
@@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['core-two'] = {
license = "see context related readme files"
}
+local next = next
local remove, concat = table.remove, table.concat
local allocate = utilities.storage.allocate
diff --git a/tex/context/base/mkiv/data-env.lua b/tex/context/base/mkiv/data-env.lua
index 8bb25036d..1b31caab6 100644
--- a/tex/context/base/mkiv/data-env.lua
+++ b/tex/context/base/mkiv/data-env.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['data-env'] = {
}
local lower, gsub = string.lower, string.gsub
+local next = next
local resolvers = resolvers
diff --git a/tex/context/base/mkiv/data-tmp.lua b/tex/context/base/mkiv/data-tmp.lua
index e1903fd82..948827161 100644
--- a/tex/context/base/mkiv/data-tmp.lua
+++ b/tex/context/base/mkiv/data-tmp.lua
@@ -28,6 +28,7 @@ local concat = table.concat
local mkdirs, isdir, isfile = dir.mkdirs, lfs.isdir, lfs.isfile
local addsuffix, is_writable, is_readable = file.addsuffix, file.is_writable, file.is_readable
local formatters = string.formatters
+local next, type = next, type
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local trace_cache = false trackers.register("resolvers.cache", function(v) trace_cache = v end)
diff --git a/tex/context/base/mkiv/font-agl.lua b/tex/context/base/mkiv/font-agl.lua
index aec6415f7..49b85421f 100644
--- a/tex/context/base/mkiv/font-agl.lua
+++ b/tex/context/base/mkiv/font-agl.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['font-agl'] = {
original = "Adobe Glyph List, version 2.0, September 20, 2002",
}
+local next = next
+
local allocate = utilities.storage.allocate
local mark = utilities.storage.mark
diff --git a/tex/context/base/mkiv/font-aux.lua b/tex/context/base/mkiv/font-aux.lua
index fc6c90bc1..fcbcd6d32 100644
--- a/tex/context/base/mkiv/font-aux.lua
+++ b/tex/context/base/mkiv/font-aux.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-aux'] = {
license = "see context related readme files"
}
-local tonumber, type = tonumber, type
+local tonumber, type, next = tonumber, type, next
----- wrap, yield = coroutine.wrap, coroutine.yield
local fonts, font = fonts, font
diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua
index 2dce9b6e4..f4fe474c3 100644
--- a/tex/context/base/mkiv/font-con.lua
+++ b/tex/context/base/mkiv/font-con.lua
@@ -15,6 +15,7 @@ local sortedkeys, sortedhash, serialize, fastcopy = table.sortedkeys, table.sort
local derivetable = table.derive
local ioflush = io.flush
local round = math.round
+local setmetatable, getmetatable, rawget, rawset = setmetatable, getmetatable, rawget, rawset
local trace_defining = false trackers.register("fonts.defining", function(v) trace_defining = v end)
local trace_scaling = false trackers.register("fonts.scaling", function(v) trace_scaling = v end)
@@ -230,27 +231,87 @@ function constructors.trytosharefont(target,tfmdata)
end
end
+-- function constructors.enhanceparameters(parameters)
+-- local xheight = parameters.x_height
+-- local quad = parameters.quad
+-- local space = parameters.space
+-- local stretch = parameters.space_stretch
+-- local shrink = parameters.space_shrink
+-- local extra = parameters.extra_space
+-- local slant = parameters.slant
+-- -- synonyms
+-- parameters.xheight = xheight
+-- parameters.spacestretch = stretch
+-- parameters.spaceshrink = shrink
+-- parameters.extraspace = extra
+-- parameters.em = quad
+-- parameters.ex = xheight
+-- parameters.slantperpoint = slant
+-- parameters.spacing = {
+-- width = space,
+-- stretch = stretch,
+-- shrink = shrink,
+-- extra = extra,
+-- }
+-- end
+
+local synonyms = {
+ exheight = "x_height",
+ xheight = "x_height",
+ ex = "x_height",
+ emwidth = "quad",
+ em = "quad",
+ spacestretch = "space_stretch",
+ stretch = "space_stretch",
+ spaceshrink = "space_shrink",
+ shrink = "space_shrink",
+ extraspace = "extra_space",
+ xspace = "extra_space",
+ slantperpoint = "slant",
+}
+
function constructors.enhanceparameters(parameters)
- local xheight = parameters.x_height
- local quad = parameters.quad
- local space = parameters.space
- local stretch = parameters.space_stretch
- local shrink = parameters.space_shrink
- local extra = parameters.extra_space
- local slant = parameters.slant
- parameters.xheight = xheight
- parameters.spacestretch = stretch
- parameters.spaceshrink = shrink
- parameters.extraspace = extra
- parameters.em = quad
- parameters.ex = xheight
- parameters.slantperpoint = slant
- parameters.spacing = {
- width = space,
- stretch = stretch,
- shrink = shrink,
- extra = extra,
- }
+ local mt = getmetatable(parameters)
+ local getter = function(t,k)
+ if not k then
+ return nil
+ end
+ local s = synonyms[k]
+ if s then
+ return rawget(t,s) or (mt and mt[s]) or nil
+ end
+ if k == "spacing" then
+ return {
+ width = t.space,
+ stretch = t.space_stretch,
+ shrink = t.space_shrink,
+ extra = t.extra_space,
+ }
+ end
+ return mt and mt[k] or nil
+ end
+ local setter = function(t,k,v)
+ if not k then
+ return 0
+ end
+ local s = synonyms[k]
+ if s then
+ rawset(t,s,v)
+ elseif k == "spacing" then
+ if type(v) == "table" then
+ rawset(t,"space",v.width or 0)
+ rawset(t,"space_stretch",v.stretch or 0)
+ rawset(t,"space_shrink",v.shrink or 0)
+ rawset(t,"extra_space",v.extra or 0)
+ end
+ else
+ rawset(t,k,v)
+ end
+ end
+ setmetatable(parameters, {
+ __index = getter,
+ __newindex = setter,
+ })
end
local function mathkerns(v,vdelta)
@@ -493,7 +554,7 @@ function constructors.scale(tfmdata,specification)
targetparameters.descender = delta * descender
end
--
- constructors.enhanceparameters(targetparameters) -- official copies for us
+ constructors.enhanceparameters(targetparameters) -- official copies for us, now virtual
--
local protrusionfactor = (targetquad ~= 0 and 1000/targetquad) or 0
local scaledwidth = defaultwidth * hdelta
diff --git a/tex/context/base/mkiv/font-ext.lua b/tex/context/base/mkiv/font-ext.lua
index 0fa3f7279..833c9cdea 100644
--- a/tex/context/base/mkiv/font-ext.lua
+++ b/tex/context/base/mkiv/font-ext.lua
@@ -977,6 +977,58 @@ registerotffeature {
--
-- end
+do
+
+ local P, lpegpatterns, lpegmatch = lpeg.P, lpeg.patterns, lpeg.match
+
+ local amount, stretch, shrink, extra
+
+ local factor = lpegpatterns.unsigned
+ local space = lpegpatterns.space
+ local pattern = (
+ (factor / function(n) amount = tonumber(n) or amount end)
+ + (P("+") + P("plus" )) * space^0 * (factor / function(n) stretch = tonumber(n) or stretch end)
+ + (P("-") + P("minus")) * space^0 * (factor / function(n) shrink = tonumber(n) or shrink end)
+ + ( P("extra")) * space^0 * (factor / function(n) extra = tonumber(n) or extra end)
+ + space^1
+ )^1
+
+ local function initialize(tfmdata,key,value)
+ local characters = tfmdata.characters
+ local parameters = tfmdata.parameters
+ if type(value) == "string" then
+ local emwidth = parameters.quad
+ amount, stretch, shrink, extra = 0, 0, 0, false
+ lpegmatch(pattern,value)
+ if not extra then
+ if shrink ~= 0 then
+ extra = shrink
+ elseif stretch ~= 0 then
+ extra = stretch
+ else
+ extra = amount
+ end
+ end
+ parameters.space = amount * emwidth
+ parameters.space_stretch = stretch * emwidth
+ parameters.space_shrink = shrink * emwidth
+ parameters.extra_space = extra * emwidth
+ end
+ end
+
+ -- 1.1 + 1.2 - 1.3 minus 1.4 plus 1.1 extra 1.4 -- last one wins
+
+ registerotffeature {
+ name = "spacing",
+ description = "space settings",
+ manipulators = {
+ base = initialize,
+ node = initialize,
+ }
+ }
+
+end
+
-- -- historic stuff, move from font-ota (handled differently, typo-rep)
--
-- local delete_node = nodes.delete
diff --git a/tex/context/base/mkiv/font-fbk.lua b/tex/context/base/mkiv/font-fbk.lua
index 8c706e9f6..79ebc3f25 100644
--- a/tex/context/base/mkiv/font-fbk.lua
+++ b/tex/context/base/mkiv/font-fbk.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['font-fbk'] = {
local cos, tan, rad, format = math.cos, math.tan, math.rad, string.format
local utfbyte, utfchar = utf.byte, utf.char
+local next = next
--[[ldx--
<p>This is very experimental code!</p>
diff --git a/tex/context/base/mkiv/font-gbn.lua b/tex/context/base/mkiv/font-gbn.lua
index 6742f90fb..3256a1649 100644
--- a/tex/context/base/mkiv/font-gbn.lua
+++ b/tex/context/base/mkiv/font-gbn.lua
@@ -13,6 +13,8 @@ if context then
os.exit()
end
+local next = next
+
local fonts = fonts
local nodes = nodes
diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi
index c4445b7b9..91459d18e 100644
--- a/tex/context/base/mkiv/font-ini.mkvi
+++ b/tex/context/base/mkiv/font-ini.mkvi
@@ -919,6 +919,8 @@
\newif\ifskipfontcharacteristics \skipfontcharacteristicstrue
+\tracingfonts\plussix % <id: name @ size>
+
%D When fontclasses are used, we define the font global, since namespaces are
%D used. Otherwise we parse the specs each time.
diff --git a/tex/context/base/mkiv/font-lig.lua b/tex/context/base/mkiv/font-lig.lua
index bb9ee0096..1aed9fc5b 100644
--- a/tex/context/base/mkiv/font-lig.lua
+++ b/tex/context/base/mkiv/font-lig.lua
@@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['font-lig'] = {
-- This module is not loaded but generated a file for plain TeX as a substitute
-- for collapsing the input: "luatex-fonts-lig.lua" with "collapse=yes".
+local next = next
+
local standalone = not characters
if standalone then
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index 872247d43..b17cf991d 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -101,12 +101,11 @@ else -- for generic
end
--- We need to force page first because otherwise the q's get outside
--- the font switch and as a consequence the next character has no font
--- set (well, it has: the preceding one). As a consequence these fonts
--- are somewhat inefficient as each glyph gets the font set. It's a
--- side effect of the fact that a font is handled when a character gets
--- flushed.
+-- We need to force page first because otherwise the q's get outside the font switch and
+-- as a consequence the next character has no font set (well, it has: the preceding one). As
+-- a consequence these fonts are somewhat inefficient as each glyph gets the font set. It's
+-- a side effect of the fact that a font is handled when a character gets flushed. Okay, from
+-- now on we can use text as literal mode.
local function convert(t,k)
local v = { }
@@ -123,8 +122,104 @@ local function convert(t,k)
return v
end
-local start = { "pdf", "page", "q" }
-local stop = { "pdf", "raw", "Q" }
+local start = { "pdf", "mode", "font" } -- force text mode (so get q Q right)
+----- stop = { "pdf", "mode", "page" } -- force page mode (else overlap)
+local push = { "pdf", "page", "q" }
+local pop = { "pdf", "page", "Q" }
+
+if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY < 6472 then
+ start = { "nop" }
+ ----- = stop
+end
+
+-- -- This one results in color directives inside BT ET but has less q Q pairs. It
+-- -- only shows the first glyph in acrobat and nothing more. No problem with other
+-- -- renderers.
+--
+-- local function initializecolr(tfmdata,kind,value) -- hm, always value
+-- if value then
+-- local resources = tfmdata.resources
+-- local palettes = resources.colorpalettes
+-- if palettes then
+-- --
+-- local converted = resources.converted
+-- if not converted then
+-- converted = setmetatableindex(convert)
+-- resources.converted = converted
+-- end
+-- local colorvalues = sharedpalettes[value] or converted[palettes[tonumber(value) or 1] or palettes[1]] or { }
+-- local classes = #colorvalues
+-- if classes == 0 then
+-- return
+-- end
+-- --
+-- local characters = tfmdata.characters
+-- local descriptions = tfmdata.descriptions
+-- local properties = tfmdata.properties
+-- --
+-- properties.virtualized = true
+-- tfmdata.fonts = {
+-- { id = 0 }
+-- }
+-- local widths = setmetatableindex(function(t,k)
+-- local v = { "right", -k }
+-- t[k] = v
+-- return v
+-- end)
+-- --
+-- local getactualtext = otf.getactualtext
+-- local default = colorvalues[#colorvalues]
+-- local b, e = getactualtext(tounicode(0xFFFD))
+-- local actualb = { "pdf", "page", b } -- saves tables
+-- local actuale = { "pdf", "page", e } -- saves tables
+-- --
+-- local cache = setmetatableindex(function(t,k)
+-- local v = { "char", k } -- could he a weak shared hash
+-- t[k] = v
+-- return v
+-- end)
+-- --
+-- for unicode, character in next, characters do
+-- local description = descriptions[unicode]
+-- if description then
+-- local colorlist = description.colors
+-- if colorlist then
+-- local u = description.unicode or characters[unicode].unicode
+-- local w = character.width or 0
+-- local s = #colorlist
+-- local goback = w ~= 0 and widths[w] or nil -- needs checking: are widths the same
+-- local t = {
+-- start,
+-- not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) }
+-- }
+-- local n = 2
+-- local l = nil
+-- n = n + 1 t[n] = push
+-- for i=1,s do
+-- local entry = colorlist[i]
+-- local v = colorvalues[entry.class] or default
+-- if v and l ~= v then
+-- n = n + 1 t[n] = v
+-- l = v
+-- end
+-- n = n + 1 t[n] = cache[entry.slot]
+-- if s > 1 and i < s and goback then
+-- n = n + 1 t[n] = goback
+-- end
+-- end
+-- n = n + 1 t[n] = pop
+-- n = n + 1 t[n] = actuale
+-- n = n + 1 t[n] = stop
+-- character.commands = t
+-- end
+-- end
+-- end
+-- end
+-- end
+-- end
+--
+-- -- Here we have no color change in BT .. ET and more q Q pairs but even then acrobat
+-- -- fails displaying the overlays correctly. Other renderers do it right.
local function initializecolr(tfmdata,kind,value) -- hm, always value
if value then
@@ -179,15 +274,21 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
local s = #colorlist
local goback = w ~= 0 and widths[w] or nil -- needs checking: are widths the same
local t = {
- start,
- not u and actualb or { "pdf", "raw", getactualtext(tounicode(u)) }
+ start, -- really needed
+ not u and actualb or { "pdf", "page", (getactualtext(tounicode(u))) }
}
local n = 2
local l = nil
+ local f = false
for i=1,s do
local entry = colorlist[i]
local v = colorvalues[entry.class] or default
if v and l ~= v then
+ if f then
+ n = n + 1 t[n] = pop
+ end
+ n = n + 1 t[n] = push
+ f = true
n = n + 1 t[n] = v
l = v
end
@@ -196,8 +297,11 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
n = n + 1 t[n] = goback
end
end
+ if f then
+ n = n + 1 t[n] = pop
+ end
n = n + 1 t[n] = actuale
- n = n + 1 t[n] = stop
+ -- n = n + 1 t[n] = stop -- not needed
character.commands = t
end
end
@@ -302,7 +406,9 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) -- kind = sbix|svg
local getactualtext = otf.getactualtext
local storepdfdata = otf.storepdfdata
--
- -- local nop = { "nop" }
+ local b, e = getactualtext(tounicode(0xFFFD))
+ local actualb = { "pdf", "page", b } -- saves tables
+ local actuale = { "pdf", "page", e } -- saves tables
--
for unicode, character in sortedhash(characters) do -- sort is nicer for svg
local index = character.index
@@ -324,18 +430,18 @@ local function pdftovirtual(tfmdata,pdfshapes,kind) -- kind = sbix|svg
if data then
local setcode, name, nilcode = storepdfdata(data)
if name then
- local bt, et = getactualtext(unicode)
+ local bt = unicode and getactualtext(unicode)
local wd = character.width or 0
local ht = character.height or 0
local dp = character.depth or 0
character.commands = {
- { "pdf", "direct", bt },
+ not unicode and actualb or { "pdf", "page", (getactualtext(unicode)) },
{ "down", dp + dy * hfactor },
{ "right", dx * hfactor },
-- setcode and { "lua", setcode } or nop,
{ "image", { filename = name, width = wd, height = ht, depth = dp } },
-- nilcode and { "lua", nilcode } or nop,
- { "pdf", "direct", et },
+ actuale,
}
character[kind] = true
end
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index 246681d17..75b99e999 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -146,7 +146,7 @@ local trace_plugins = false registertracker("otf.plugins", function
local trace_chains = false registertracker("otf.chains", function(v) trace_chains = v end)
local trace_kernruns = false registertracker("otf.kernruns", function(v) trace_kernruns = v end)
-local trace_discruns = false registertracker("otf.discruns", function(v) trace_discruns = v end)
+----- trace_discruns = false registertracker("otf.discruns", function(v) trace_discruns = v end)
local trace_compruns = false registertracker("otf.compruns", function(v) trace_compruns = v end)
local trace_testruns = false registertracker("otf.testruns", function(v) trace_testruns = v end)
@@ -2748,8 +2748,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
else
notmatchreplace[current] = true
- -- different than others, needs checking if "not" is okay so for Kai to check
- if not notmatchpre[current] then
+ if notmatchpre[current] then
goto next
else
break
@@ -3623,9 +3622,14 @@ local function txtdirstate(start,stack,top,rlparmode)
top = top + 1
stack[top] = dir
elseif dir == "-TRT" or dir == "-TLT" then
- top = top - 1
- if stack[top] == "+TRT" then
- new = -1
+ if top == 1 then
+ top = 0
+ new = rlparmode
+ else
+ top = top - 1
+ if stack[top] == "+TRT" then
+ new = -1
+ end
end
else
new = rlparmode
diff --git a/tex/context/base/mkiv/font-pre.mkiv b/tex/context/base/mkiv/font-pre.mkiv
index c8550d815..d09d871f0 100644
--- a/tex/context/base/mkiv/font-pre.mkiv
+++ b/tex/context/base/mkiv/font-pre.mkiv
@@ -153,7 +153,7 @@
[mode=node,analyze=yes,language=dflt,ccmp=yes,
autoscript=position,autolanguage=position,
init=yes,medi=yes,fina=yes,isol=yes,
-% fin2=yes,fin3=yes,med2=yes,
+ % fin2=yes,fin3=yes,med2=yes,
mark=yes,mkmk=yes,kern=yes,curs=yes,
liga=yes,dlig=yes,rlig=yes,clig=yes,calt=yes]
@@ -162,7 +162,7 @@
[mode=node,analyze=yes,language=dflt,ccmp=yes,
autoscript=position,autolanguage=position,
init=yes,medi=yes,fina=yes,isol=yes,
-% fin2=yes,fin3=yes,med2=yes,
+ % fin2=yes,fin3=yes,med2=yes,
mark=yes,mkmk=yes,kern=yes,curs=yes,
rlig=yes,calt=yes]
diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua
index b4dd9a555..0cf51cad3 100644
--- a/tex/context/base/mkiv/font-sel.lua
+++ b/tex/context/base/mkiv/font-sel.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['font-sel'] = {
license = "GNU General Public License"
}
+local next, type = next, type
+
local context = context
local cleanname = fonts.names.cleanname
local gsub, splitup, find, lower = string.gsub, string.splitup, string.find, string.lower
diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua
index 918304a0b..75a12ac82 100644
--- a/tex/context/base/mkiv/font-shp.lua
+++ b/tex/context/base/mkiv/font-shp.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-shp'] = {
license = "see context related readme files"
}
-local tonumber = tonumber
+local tonumber, next = tonumber, next
local concat = table.concat
local formatters = string.formatters
diff --git a/tex/context/base/mkiv/font-tra.mkiv b/tex/context/base/mkiv/font-tra.mkiv
index 6ff2b1bfb..1f50c4a45 100644
--- a/tex/context/base/mkiv/font-tra.mkiv
+++ b/tex/context/base/mkiv/font-tra.mkiv
@@ -346,8 +346,12 @@
\unexpanded\def\startotfcompositionlist#1#2#3\stopotfcompositionlist
{\begingroup
\unexpanded\def\showotfcompositionsample##1%
- {\NC\type{##1}\NC\showotfcompositionlist{#1}{#2}{##1}\NC\definedfont[#1]##1\NC\NR}%
- \starttabulate[||||]
+ {\NC\type{##1}%
+ \NC\showotfcompositionlist{Mono}{#2}{##1}%
+ \NC\showotfcompositionlist{#1}{#2}{##1}%
+ \NC\definedfont[#1]##1%
+ \NC\NR}%
+ \starttabulate[|||||]%
#3%
\stoptabulate
\endgroup}
diff --git a/tex/context/base/mkiv/grph-fig.mkiv b/tex/context/base/mkiv/grph-fig.mkiv
index 1fdc0caa0..3bf3248a6 100644
--- a/tex/context/base/mkiv/grph-fig.mkiv
+++ b/tex/context/base/mkiv/grph-fig.mkiv
@@ -67,7 +67,6 @@
\def\grph_buffers_run_indeed[#1][#2]%
{\xdef\lasttypesetbuffer{\clf_runbuffer{#1}{#2}}}
-
% For manuals and such:
%
% \definetypesetting [name] [options] [settings-a]
@@ -99,11 +98,13 @@
\grph_typesetting_process_indeed{}{#2}{#1}{}%
\fi\fi\fi}
+\defineexternalfigure[typesetting] % so one can set a frame and such
+
\def\grph_typesetting_process_indeed#1#2#3#4% options settings-a filename settings-b
{\begingroup
\edef\m_typesetting_name{\clf_runcontextjob{#3}{#1}}%
\ifx\m_typesetting_name\empty \else
- \expanded{\externalfigure[\m_typesetting_name]}[#2,#4]%
+ \expanded{\externalfigure[\m_typesetting_name][typesetting]}[#2,#4]%
\fi
\endgroup}
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua
index 8df33f73c..5f403ebc7 100644
--- a/tex/context/base/mkiv/grph-inc.lua
+++ b/tex/context/base/mkiv/grph-inc.lua
@@ -40,7 +40,7 @@ run TeX code from within Lua. Some more functionality will move to Lua.
-- todo: store loaded pages per pdf file someplace
-local tonumber, tostring = tonumber, tostring
+local tonumber, tostring, next = tonumber, tostring, next
local format, lower, find, match, gsub = string.format, string.lower, string.find, string.match, string.gsub
local longtostring = string.longtostring
local contains = table.contains
@@ -558,10 +558,12 @@ function figures.initialize(request)
-- can be determined; at some point the handlers might set them to numbers instead
local w = tonumber(request.width) or 0
local h = tonumber(request.height) or 0
+ local p = tonumber(request.page) or 0
request.width = w > 0 and w or nil
request.height = h > 0 and h or nil
--
- request.page = max(tonumber(request.page) or 1,1)
+ request.page = p > 0 and p or 1
+ request.keepopen = p > 0
request.size = checkimagesize(request.size)
request.object = request.object == v_yes
request["repeat"] = request["repeat"] == v_yes
@@ -1278,7 +1280,7 @@ function figures.done(data)
ds.yscale = 1
end
-- sort of redundant but can be limited
- ds.page = ds.page or du.page or dr.page
+ ds.page = ds.page or du.page or dr.page
return data
end
@@ -1395,19 +1397,22 @@ function checkers.generic(data)
filename = name,
page = page,
pagebox = dr.size,
+ keepopen = dr.keepopen or false,
-- visiblefilename = "", -- this prohibits the full filename ending up in the file
}
codeinjections.setfigurecolorspace(data,figure)
codeinjections.setfiguremask(data,figure)
if figure then
-if page and page > 1 then
- local f = scanimage{ filename = name }
- if f.page and f.pages < page then
- report_inclusion("no page %i in %a, using page 1",page,name)
- page = 1
- figure.page = page
- end
-end
+ -- new, bonus check
+ if page and page > 1 then
+ local f = scanimage{ filename = name }
+ if f.page and f.pages < page then
+ report_inclusion("no page %i in %a, using page 1",page,name)
+ page = 1
+ figure.page = page
+ end
+ end
+ -- till here
local f, comment = checkimage(scanimage(figure))
if not f then
ds.comment = comment
diff --git a/tex/context/base/mkiv/grph-rul.lua b/tex/context/base/mkiv/grph-rul.lua
index 1a1bf091f..03f678973 100644
--- a/tex/context/base/mkiv/grph-rul.lua
+++ b/tex/context/base/mkiv/grph-rul.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['grph-rul'] = {
license = "see context related readme files"
}
-local tonumber = tonumber
+local tonumber, next, type = tonumber, next, type
local attributes = attributes
local nodes = nodes
diff --git a/tex/context/base/mkiv/l-lua.lua b/tex/context/base/mkiv/l-lua.lua
index 02e139eb1..0bbe958a4 100644
--- a/tex/context/base/mkiv/l-lua.lua
+++ b/tex/context/base/mkiv/l-lua.lua
@@ -17,6 +17,8 @@ if not modules then modules = { } end modules ['l-lua'] = {
-- utf.*
-- bit32
+local next, type, tonumber = next, type, tonumber
+
-- compatibility hacks and helpers
LUAMAJORVERSION, LUAMINORVERSION = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
diff --git a/tex/context/base/mkiv/l-unicode.lua b/tex/context/base/mkiv/l-unicode.lua
index a470fe1ff..60a8cc006 100644
--- a/tex/context/base/mkiv/l-unicode.lua
+++ b/tex/context/base/mkiv/l-unicode.lua
@@ -18,6 +18,9 @@ if not modules then modules = { } end modules ['l-unicode'] = {
-- todo: utf.sub replacement (used in syst-aux)
-- we put these in the utf namespace:
+-- used : byte char gmatch len lower sub upper
+-- not used : dump find format gfind gsub match rep reverse
+
utf = utf or (unicode and unicode.utf8) or { }
utf.characters = utf.characters or string.utfcharacters
@@ -1310,3 +1313,26 @@ function unicode.toutf32string(n)
char(extract(n,24,8))
end
end
+
+-- goodie:
+
+local len = utf.len
+local rep = rep
+
+function string.utfpadd(s,n)
+ if n and n ~= 0 then
+ local l = len(s)
+ if n > 0 then
+ local d = n - l
+ if d > 0 then
+ return rep(c or " ",d) .. s
+ end
+ else
+ local d = - n - l
+ if d > 0 then
+ return s .. rep(c or " ",d)
+ end
+ end
+ end
+ return s
+end
diff --git a/tex/context/base/mkiv/l-url.lua b/tex/context/base/mkiv/l-url.lua
index b189ec5bb..bc407a84d 100644
--- a/tex/context/base/mkiv/l-url.lua
+++ b/tex/context/base/mkiv/l-url.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['l-url'] = {
local char, format, byte = string.char, string.format, string.byte
local concat = table.concat
-local tonumber, type = tonumber, type
+local tonumber, type, next = tonumber, type, next
local P, C, R, S, Cs, Cc, Ct, Cf, Cg, V = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc, lpeg.Ct, lpeg.Cf, lpeg.Cg, lpeg.V
local lpegmatch, lpegpatterns, replacer = lpeg.match, lpeg.patterns, lpeg.replacer
diff --git a/tex/context/base/mkiv/lang-dis.lua b/tex/context/base/mkiv/lang-dis.lua
index ec470234f..df59359d2 100644
--- a/tex/context/base/mkiv/lang-dis.lua
+++ b/tex/context/base/mkiv/lang-dis.lua
@@ -61,158 +61,6 @@ local getlanguagedata = languages.getdata
local check_regular = true
-local expanders -- this will go away
-
--- the penalty has been determined by the mode (currently we force 1):
---
--- 0 : exhyphenpenalty
--- 1 : hyphenpenalty
--- 2 : automatichyphenpenalty
---
--- following a - : the pre and post chars are already appended and set
--- so we have pre=preex and post=postex .. however, the previous
--- hyphen is already injected ... downside: the font handler sees this
--- so this is another argument for doing a hyphenation pass in context
-
-if LUATEXVERSION < 1.005 then
-
- expanders = {
- [discretionary_code] = function(d,template)
- -- \discretionary
- return template
- end,
- [explicit_code] = function(d,template)
- -- \-
- local pre, post, replace = getdisc(d)
- local done = false
- if pre then
- local char = isglyph(pre)
- if char and char <= 0 then
- done = true
- flush_list(pre)
- pre = nil
- end
- end
- if post then
- local char = isglyph(post)
- if char and char <= 0 then
- done = true
- flush_list(post)
- post = nil
- end
- end
- if done then
- -- todo: take existing penalty
- setdisc(d,pre,post,replace,explicit_code,tex.exhyphenpenalty)
- else
- setsubtype(d,explicit_code)
- end
- return template
- end,
- [automatic_code] = function(d,template)
- local pre, post, replace = getdisc(d)
- if pre then
- -- we have a preex characters and want that one to replace the
- -- character in front which is the trigger
- if not template then
- -- can there be font kerns already?
- template = getprev(d)
- if template and getid(template) ~= glyph_code then
- template = getnext(d)
- if template and getid(template) ~= glyph_code then
- template = nil
- end
- end
- end
- if template then
- local pseudohead = getprev(template)
- if pseudohead then
- while template ~= d do
- pseudohead, template, removed = remove_node(pseudohead,template)
- -- free old replace ?
- replace = removed
- -- break ?
- end
- else
- -- can't happen
- end
- setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
- else
- -- print("lone regular discretionary ignored")
- end
- else
- setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
- end
- return template
- end,
- [regular_code] = function(d,template)
- if check_regular then
- -- simple
- if not template then
- -- can there be font kerns already?
- template = getprev(d)
- if template and getid(template) ~= glyph_code then
- template = getnext(d)
- if template and getid(template) ~= glyph_code then
- template = nil
- end
- end
- end
- if template then
- local language = template and getlang(template)
- local data = getlanguagedata(language)
- local prechar = data.prehyphenchar
- local postchar = data.posthyphenchar
- local pre, post, replace = getdisc(d) -- pre can be set
- local done = false
- if prechar and prechar > 0 then
- done = true
- pre = copy_node(template)
- setchar(pre,prechar)
- end
- if postchar and postchar > 0 then
- done = true
- post = copy_node(template)
- setchar(post,postchar)
- end
- if done then
- setdisc(d,pre,post,replace,regular_code,tex.hyphenpenalty)
- end
- else
- -- print("lone regular discretionary ignored")
- end
- return template
- end
- end,
- [disccodes.first] = function()
- -- forget about them
- end,
- [disccodes.second] = function()
- -- forget about them
- end,
- }
-
- function languages.expand(d,template,subtype)
- if not subtype then
- subtype = getsubtype(d)
- end
- if subtype ~= discretionary_code then
- return expanders[subtype](d,template)
- end
- end
-
-else
-
- function languages.expand()
- -- nothing to be fixed
- end
-
-end
-
-languages.expanders = expanders
-
--- -- -- -- --
-
local setlistcolor = nodes.tracers.colors.setlist
function languages.visualizediscretionaries(head)
diff --git a/tex/context/base/mkiv/lang-exp.lua b/tex/context/base/mkiv/lang-exp.lua
new file mode 100644
index 000000000..70fad48b0
--- /dev/null
+++ b/tex/context/base/mkiv/lang-exp.lua
@@ -0,0 +1,219 @@
+if not modules then modules = { } end modules ['lang-exp'] = {
+ version = 1.001,
+ comment = "companion to lang-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- This module contains snippets that were used before we expanded
+-- discretionaries in the engine which makes way more sense. This
+-- code is nod used any more.
+
+if true then
+ return
+end
+
+-- lang-dis.lua:
+
+local expanders -- this will go away
+
+-- the penalty has been determined by the mode (currently we force 1):
+--
+-- 0 : exhyphenpenalty
+-- 1 : hyphenpenalty
+-- 2 : automatichyphenpenalty
+--
+-- following a - : the pre and post chars are already appended and set
+-- so we have pre=preex and post=postex .. however, the previous
+-- hyphen is already injected ... downside: the font handler sees this
+-- so this is another argument for doing a hyphenation pass in context
+
+if LUATEXVERSION < 1.005 then -- not loaded any more
+
+ expanders = {
+ [discretionary_code] = function(d,template)
+ -- \discretionary
+ return template
+ end,
+ [explicit_code] = function(d,template)
+ -- \-
+ local pre, post, replace = getdisc(d)
+ local done = false
+ if pre then
+ local char = isglyph(pre)
+ if char and char <= 0 then
+ done = true
+ flush_list(pre)
+ pre = nil
+ end
+ end
+ if post then
+ local char = isglyph(post)
+ if char and char <= 0 then
+ done = true
+ flush_list(post)
+ post = nil
+ end
+ end
+ if done then
+ -- todo: take existing penalty
+ setdisc(d,pre,post,replace,explicit_code,tex.exhyphenpenalty)
+ else
+ setsubtype(d,explicit_code)
+ end
+ return template
+ end,
+ [automatic_code] = function(d,template)
+ local pre, post, replace = getdisc(d)
+ if pre then
+ -- we have a preex characters and want that one to replace the
+ -- character in front which is the trigger
+ if not template then
+ -- can there be font kerns already?
+ template = getprev(d)
+ if template and getid(template) ~= glyph_code then
+ template = getnext(d)
+ if template and getid(template) ~= glyph_code then
+ template = nil
+ end
+ end
+ end
+ if template then
+ local pseudohead = getprev(template)
+ if pseudohead then
+ while template ~= d do
+ pseudohead, template, removed = remove_node(pseudohead,template)
+ -- free old replace ?
+ replace = removed
+ -- break ?
+ end
+ else
+ -- can't happen
+ end
+ setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
+ else
+ -- print("lone regular discretionary ignored")
+ end
+ else
+ setdisc(d,pre,post,replace,automatic_code,tex.hyphenpenalty)
+ end
+ return template
+ end,
+ [regular_code] = function(d,template)
+ if check_regular then
+ -- simple
+ if not template then
+ -- can there be font kerns already?
+ template = getprev(d)
+ if template and getid(template) ~= glyph_code then
+ template = getnext(d)
+ if template and getid(template) ~= glyph_code then
+ template = nil
+ end
+ end
+ end
+ if template then
+ local language = template and getlang(template)
+ local data = getlanguagedata(language)
+ local prechar = data.prehyphenchar
+ local postchar = data.posthyphenchar
+ local pre, post, replace = getdisc(d) -- pre can be set
+ local done = false
+ if prechar and prechar > 0 then
+ done = true
+ pre = copy_node(template)
+ setchar(pre,prechar)
+ end
+ if postchar and postchar > 0 then
+ done = true
+ post = copy_node(template)
+ setchar(post,postchar)
+ end
+ if done then
+ setdisc(d,pre,post,replace,regular_code,tex.hyphenpenalty)
+ end
+ else
+ -- print("lone regular discretionary ignored")
+ end
+ return template
+ end
+ end,
+ [disccodes.first] = function()
+ -- forget about them
+ end,
+ [disccodes.second] = function()
+ -- forget about them
+ end,
+ }
+
+ function languages.expand(d,template,subtype)
+ if not subtype then
+ subtype = getsubtype(d)
+ end
+ if subtype ~= discretionary_code then
+ return expanders[subtype](d,template)
+ end
+ end
+
+else
+
+ function languages.expand()
+ -- nothing to be fixed
+ end
+
+end
+
+languages.expanders = expanders
+
+-- lang-hyp.lua:
+
+----- expanders = languages.expanders -- gone in 1.005
+----- expand_explicit = expanders and expanders[explicit_code]
+----- expand_automatic = expanders and expanders[automatic_code]
+
+if LUATEXVERSION < 1.005 then -- not loaded any more
+
+ expanded = function(head)
+ local done = hyphenate(head)
+ if done then
+ for d in traverse_id(disc_code,tonut(head)) do
+ local s = getsubtype(d)
+ if s ~= discretionary_code then
+ expanders[s](d,template)
+ done = true
+ end
+ end
+ end
+ return head, done
+ end
+
+end
+
+-- if id == disc_code then
+-- if expanded then
+-- -- pre 1.005
+-- local subtype = getsubtype(current)
+-- if subtype == discretionary_code then -- \discretionary
+-- size = 0
+-- elseif subtype == explicit_code then -- \- => only here
+-- -- automatic (-) : the old parser makes negative char entries
+-- size = 0
+-- expand_explicit(current)
+-- elseif subtype == automatic_code then -- - => only here
+-- -- automatic (-) : the old hyphenator turns an exhyphen into glyph+disc
+-- size = 0
+-- expand_automatic(current)
+-- else
+-- -- first : done by the hyphenator
+-- -- second : done by the hyphenator
+-- -- regular : done by the hyphenator
+-- size = 0
+-- end
+-- else
+-- size = 0
+-- end
+-- current = getnext(current)
+-- if hyphenonly then
+-- skipping = true
+-- end
diff --git a/tex/context/base/mkiv/lang-hyp.lua b/tex/context/base/mkiv/lang-hyp.lua
index 27bd8130e..53a368b07 100644
--- a/tex/context/base/mkiv/lang-hyp.lua
+++ b/tex/context/base/mkiv/lang-hyp.lua
@@ -688,10 +688,6 @@ if context then
local a_hyphenation = attributes.private("hyphenation")
- local expanders = languages.expanders -- gone in 1.005
- local expand_explicit = expanders and expanders[explicit_code]
- local expand_automatic = expanders and expanders[automatic_code]
-
local interwordpenalty = 5000
function traditional.loadpatterns(language)
@@ -1543,28 +1539,7 @@ featureset.hyphenonly = hyphenonly == v_yes
skipping = false
end
if id == disc_code then
- if expanded then
- -- pre 1.005
- local subtype = getsubtype(current)
- if subtype == discretionary_code then -- \discretionary
- size = 0
- elseif subtype == explicit_code then -- \- => only here
- -- automatic (-) : the old parser makes negative char entries
- size = 0
- expand_explicit(current)
- elseif subtype == automatic_code then -- - => only here
- -- automatic (-) : the old hyphenator turns an exhyphen into glyph+disc
- size = 0
- expand_automatic(current)
- else
- -- first : done by the hyphenator
- -- second : done by the hyphenator
- -- regular : done by the hyphenator
- size = 0
- end
- else
- size = 0
- end
+ size = 0
current = getnext(current)
if hyphenonly then
skipping = true
@@ -1634,7 +1609,6 @@ featureset.hyphenonly = hyphenonly == v_yes
-- local replaceaction = nodes.tasks.replaceaction -- no longer overload this way (too many local switches)
local hyphenate = lang.hyphenate
- local expanders = languages.expanders
local methods = { }
local usedmethod = false
local stack = { }
@@ -1644,29 +1618,6 @@ featureset.hyphenonly = hyphenonly == v_yes
return head, done
end
- local expanded = function (head)
- local done = hyphenate(head)
- return head, done
- end
-
- if LUATEXVERSION < 1.005 then
-
- expanded = function(head)
- local done = hyphenate(head)
- if done then
- for d in traverse_id(disc_code,tonut(head)) do
- local s = getsubtype(d)
- if s ~= discretionary_code then
- expanders[s](d,template)
- done = true
- end
- end
- end
- return head, done
- end
-
- end
-
local getcount = tex.getcount
hyphenators.methods = methods
@@ -1693,7 +1644,7 @@ featureset.hyphenonly = hyphenonly == v_yes
methods.tex = original
methods.original = original
- methods.expanded = expanded -- obsolete starting with 1.005
+ methods.expanded = original -- was expanded before 1.005
methods.traditional = languages.hyphenators.traditional.hyphenate
methods.none = false -- function(head) return head, false end
diff --git a/tex/context/base/mkiv/lang-ini.lua b/tex/context/base/mkiv/lang-ini.lua
index e68938e35..6d202ff5a 100644
--- a/tex/context/base/mkiv/lang-ini.lua
+++ b/tex/context/base/mkiv/lang-ini.lua
@@ -18,7 +18,7 @@ if not modules then modules = { } end modules ['lang-ini'] = {
-- todo: no foo:bar but foo(bar,...)
-local type, tonumber = type, tonumber
+local type, tonumber, next = type, tonumber, next
local utfbyte = utf.byte
local format, gsub, gmatch, find = string.format, string.gsub, string.gmatch, string.find
local concat, sortedkeys, sortedpairs, keys, insert = table.concat, table.sortedkeys, table.sortedpairs, table.keys, table.insert
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index d4d16f6a3..172454fc2 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -15,7 +15,7 @@ if not modules then modules = { } end modules ['lang-rep'] = {
-- although (given experiences so far) we don't really need that. After all, each problem
-- is somewhat unique.
-local type, tonumber = type, tonumber
+local type, tonumber, next = type, tonumber, next
local gmatch, gsub = string.gmatch, string.gsub
local utfbyte, utfsplit = utf.byte, utf.split
local P, C, U, Cc, Ct, Cs, lpegmatch = lpeg.P, lpeg.C, lpeg.patterns.utf8character, lpeg.Cc, lpeg.Ct, lpeg.Cs, lpeg.match
diff --git a/tex/context/base/mkiv/lang-wrd.lua b/tex/context/base/mkiv/lang-wrd.lua
index 236fe89a3..b00375cc0 100644
--- a/tex/context/base/mkiv/lang-wrd.lua
+++ b/tex/context/base/mkiv/lang-wrd.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['lang-wrd'] = {
license = "see context related readme files"
}
-local tonumber = tonumber
+local next, tonumber = next, tonumber
local lower = string.lower
local utfchar = utf.char
local concat, setmetatableindex = table.concat, table.setmetatableindex
diff --git a/tex/context/base/mkiv/lpdf-epa.lua b/tex/context/base/mkiv/lpdf-epa.lua
index ac0ca3c92..d17ae5065 100644
--- a/tex/context/base/mkiv/lpdf-epa.lua
+++ b/tex/context/base/mkiv/lpdf-epa.lua
@@ -347,15 +347,22 @@ function codeinjections.getbookmarks(filename)
local subtype = action.S
if subtype == "GoTo" then
destination = action.D
- if type(destination) == "string" then
+ local kind = type(destination)
+ if kind == "string" then
entry.destination = destination
destination = destinations[destination]
local pagedata = destination and destination[1]
if pagedata then
entry.realpage = pagedata.number
end
- else
- -- maybe
+ elseif kind == "table" then
+ local pageref = destination.n
+ if pageref then
+ local pagedata = pages[pageref]
+ if pagedata then
+ entry.realpage = pagedata.number
+ end
+ end
end
else
-- maybe
diff --git a/tex/context/base/mkiv/lpdf-epd.lua b/tex/context/base/mkiv/lpdf-epd.lua
index 59a1aa364..185efd92b 100644
--- a/tex/context/base/mkiv/lpdf-epd.lua
+++ b/tex/context/base/mkiv/lpdf-epd.lua
@@ -31,7 +31,7 @@ if not modules then modules = { } end modules ['lpdf-epd'] = {
-- a safer bet is foo("Title") which will return a decoded string (or the original if it
-- already was unicode).
-local setmetatable, rawset, rawget, type = setmetatable, rawset, rawget, type
+local setmetatable, rawset, rawget, type, next = setmetatable, rawset, rawget, type, next
local tostring, tonumber = tostring, tonumber
local lower, match, char, byte, find = string.lower, string.match, string.char, string.byte, string.find
local abs = math.abs
diff --git a/tex/context/base/mkiv/lpdf-fld.lua b/tex/context/base/mkiv/lpdf-fld.lua
index 29a520790..f220838de 100644
--- a/tex/context/base/mkiv/lpdf-fld.lua
+++ b/tex/context/base/mkiv/lpdf-fld.lua
@@ -1291,78 +1291,18 @@ function methods.push(name,specification)
end
local function makeradioparent(field,specification)
--- specification = enhance(specification,"Radio,RadiosInUnison")
specification = enhance(specification,"Radio,RadiosInUnison,Print,NoToggleToOff")
--- specification = enhance(specification,"Radio,Print,NoToggleToOff")
local d = pdfdictionary {
T = field.name,
FT = pdf_btn,
--- F = fieldplus(specification),
+ -- F = fieldplus(specification),
Ff = fieldflag(specification),
--- H = pdf_n,
+ -- H = pdf_n,
V = fielddefault(field),
}
save_parent(field,specification,d,true)
end
--- local function makeradiochild(name,specification)
--- local field, parent = clones[name], nil
--- if field then
--- field = radios[field.parent]
--- parent = fields[field.parent]
--- if not parent.pobj then
--- if trace_fields then
--- report_fields("forcing parent radio %a",parent.name)
--- end
--- makeradioparent(parent,parent)
--- end
--- else
--- field = radios[name]
--- if not field then
--- report_fields("there is some problem with field %a",name)
--- return nil
--- end
--- parent = fields[field.parent]
--- if not parent.pobj then
--- if trace_fields then
--- report_fields("using parent radio %a",name)
--- end
--- makeradioparent(parent,parent)
--- end
--- end
--- if trace_fields then
--- report_fields("using child radio %a with values %a and default %a",name,field.values,field.default)
--- end
--- local fontsymbol = specification.fontsymbol
--- fontsymbol="star"
--- local d = pdfdictionary {
--- Subtype = pdf_widget,
--- Parent = pdfreference(parent.pobj),
--- F = fieldplus(specification),
--- OC = fieldlayer(specification),
--- AA = fieldactions(specification),
--- H = pdf_n,
--- }
--- if fontsymbol and fontsymbol ~= "" then
--- local appearance, default, value = fieldstates_radio(field,true,false,false,name) -- false is also ok
--- specification.fontsymbol = todingbat(fontsymbol)
--- specification.fontstyle = "symbol"
--- specification.fontalternative = "dingbats"
--- d.DA = fieldsurrounding(specification)
--- d.MK = fieldrendering(specification)
--- d.AS = pdfconstant(value) -- default -- mandate when AP but confuses viewers
--- d.AP = appearance
--- return save_kid(parent,specification,d,value)
--- -- return save_kid(parent,specification,d,name)
--- else
--- -- local appearance, default, value = fieldstates_radio(field,true) -- false is also ok
--- local appearance, default, value = fieldstates_radio(field,true,false,false,name) -- false is also ok
--- d.AS = default -- mandate when AP but confuses viewers
--- d.AP = appearance
--- return save_kid(parent,specification,d,value)
--- end
--- end
-
local function makeradiochild(name,specification)
local field, parent = clones[name], nil
if field then
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index c2cd3bae1..d04af20f2 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -24,7 +24,7 @@ if not modules then modules = { } end modules ['lpdf-wid'] = {
-- video anyway. Also, it won't play on all platforms and devices so let's wait for
-- html5 media in pdf then.
-local tonumber = tonumber
+local tonumber, next = tonumber, next
local gmatch, gsub, find, lower, format = string.gmatch, string.gsub, string.find, string.lower, string.format
local stripstring = string.strip
local settings_to_array = utilities.parsers.settings_to_array
diff --git a/tex/context/base/mkiv/luat-cod.lua b/tex/context/base/mkiv/luat-cod.lua
index 445e365ff..ad7f34270 100644
--- a/tex/context/base/mkiv/luat-cod.lua
+++ b/tex/context/base/mkiv/luat-cod.lua
@@ -38,7 +38,7 @@ function lua.registeredcodes()
return lua.lastbytecode - lua.firstbytecode + 1
end
--- no file.* functions yet
+-- no file.* and utilities.parsers.* functions yet
function lua.registercode(filename,options)
local barename = gsub(filename,"%.[%a%d]+$","")
@@ -46,7 +46,7 @@ function lua.registercode(filename,options)
local basename = match(barename,"^.+[/\\](.-)$") or barename
if not bytedone[basename] then
local opts = { }
- if options ~= "" then
+ if type(options) == "string" and options ~= "" then
for s in gmatch(options,"([a-z]+)") do
opts[s] = true
end
diff --git a/tex/context/base/mkiv/luat-run.lua b/tex/context/base/mkiv/luat-run.lua
index 2e226dd18..f653e258f 100644
--- a/tex/context/base/mkiv/luat-run.lua
+++ b/tex/context/base/mkiv/luat-run.lua
@@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['luat-run'] = {
license = "see context related readme files"
}
+local next = next
local format, find = string.format, string.find
local insert, remove = table.insert, table.remove
diff --git a/tex/context/base/mkiv/lxml-sor.lua b/tex/context/base/mkiv/lxml-sor.lua
index aba1c3b8d..a30392b95 100644
--- a/tex/context/base/mkiv/lxml-sor.lua
+++ b/tex/context/base/mkiv/lxml-sor.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['lxml-sor'] = {
local format, concat, rep = string.format, table.concat, string.rep
local lpegmatch = lpeg.match
+local next = next
local xml = xml
local lxml = lxml
diff --git a/tex/context/base/mkiv/lxml-xml.lua b/tex/context/base/mkiv/lxml-xml.lua
index 62564337c..d1520800f 100644
--- a/tex/context/base/mkiv/lxml-xml.lua
+++ b/tex/context/base/mkiv/lxml-xml.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['lxml-xml'] = {
license = "see context related readme files"
}
-local tonumber = tonumber
+local tonumber, next = tonumber, next
local concat = table.concat
local find, lower, upper = string.find, string.lower, string.upper
diff --git a/tex/context/base/mkiv/math-act.lua b/tex/context/base/mkiv/math-act.lua
index 404ebbbcd..77a355b22 100644
--- a/tex/context/base/mkiv/math-act.lua
+++ b/tex/context/base/mkiv/math-act.lua
@@ -570,54 +570,6 @@ interfaces.implement {
-- check: when true, only set when present in font
-- force: when false, then not set when already set
-local blocks = characters.blocks -- this will move to char-ini
-
--- operators : 0x02200
--- symbolsa : 0x02701
--- symbolsb : 0x02901
--- supplemental : 0x02A00
-
--- from mathematics.gaps:
-
-blocks["lowercaseitalic"].gaps = {
- [0x1D455] = 0x0210E, -- ℎ h
-}
-
-blocks["uppercasescript"].gaps = {
- [0x1D49D] = 0x0212C, -- ℬ script B
- [0x1D4A0] = 0x02130, -- ℰ script E
- [0x1D4A1] = 0x02131, -- ℱ script F
- [0x1D4A3] = 0x0210B, -- ℋ script H
- [0x1D4A4] = 0x02110, -- ℐ script I
- [0x1D4A7] = 0x02112, -- ℒ script L
- [0x1D4A8] = 0x02133, -- ℳ script M
- [0x1D4AD] = 0x0211B, -- ℛ script R
-}
-
-blocks["lowercasescript"].gaps = {
- [0x1D4BA] = 0x0212F, -- ℯ script e
- [0x1D4BC] = 0x0210A, -- ℊ script g
- [0x1D4C4] = 0x02134, -- ℴ script o
-}
-
-blocks["uppercasefraktur"].gaps = {
- [0x1D506] = 0x0212D, -- ℭ fraktur C
- [0x1D50B] = 0x0210C, -- ℌ fraktur H
- [0x1D50C] = 0x02111, -- ℑ fraktur I
- [0x1D515] = 0x0211C, -- ℜ fraktur R
- [0x1D51D] = 0x02128, -- ℨ fraktur Z
-}
-
-blocks["uppercasedoublestruck"].gaps = {
- [0x1D53A] = 0x02102, -- ℂ bb C
- [0x1D53F] = 0x0210D, -- ℍ bb H
- [0x1D545] = 0x02115, -- ℕ bb N
- [0x1D547] = 0x02119, -- ℙ bb P
- [0x1D548] = 0x0211A, -- ℚ bb Q
- [0x1D549] = 0x0211D, -- ℝ bb R
- [0x1D551] = 0x02124, -- ℤ bb Z
-}
-
-- todo: tounicode
-- function mathematics.injectfallbacks(target,original)
@@ -787,6 +739,7 @@ function mathematics.finishfallbacks(target,specification,fallbacks)
if gaps then
for unic, unicode in next, gaps do
remap(unic,unicode,true)
+ remap(unicode,unicode,true)
end
end
end
diff --git a/tex/context/base/mkiv/math-fbk.lua b/tex/context/base/mkiv/math-fbk.lua
index 0af975125..dd3b84bd6 100644
--- a/tex/context/base/mkiv/math-fbk.lua
+++ b/tex/context/base/mkiv/math-fbk.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['math-fbk'] = {
license = "see context related readme files"
}
+local next, type = next, type
+
local trace_fallbacks = false trackers.register("math.fallbacks", function(v) trace_fallbacks = v end)
local report_fallbacks = logs.reporter("math","fallbacks")
diff --git a/tex/context/base/mkiv/math-ini.lua b/tex/context/base/mkiv/math-ini.lua
index 5c495dbd7..b79ef8c8c 100644
--- a/tex/context/base/mkiv/math-ini.lua
+++ b/tex/context/base/mkiv/math-ini.lua
@@ -15,6 +15,7 @@ if not modules then modules = { } end modules ['math-ini'] = {
-- to the fam when set ... we use other means .. ok, we could use it for spacing but
-- then we also have to set the other characters (only a subset done now)
+local next, type = next, type
local formatters, find = string.formatters, string.find
local utfchar, utfbyte, utflength = utf.char, utf.byte, utf.length
----- floor = math.floor
@@ -314,15 +315,29 @@ function mathematics.define(family)
local mathclass = character.mathclass
local mathspec = character.mathspec
if mathspec then
+ if mathclass then
+ local name = character.mathname
+ if name then
+ report_math("fatal error, conlicting mathclass and mathspec for %C",unicode)
+ os.exit()
+ else
+ local class = classes[mathclass] or mathclass -- no real checks needed
+ if not class then
+ if trace_defining then
+ report("unknown",family,unicode)
+ end
+ else
+ if trace_defining then
+ report(class,family,unicode)
+ end
+ mset, dset = setmathcharacter(class,family,unicode,unicode,mset,dset)
+ end
+ end
+ end
for i=1,#mathspec do
local m = mathspec[i]
local name = m.name
local class = m.class
- if not class then
- class = mathclass
- elseif not mathclass then
- mathclass = class
- end
if class then
class = classes[class] or class -- no real checks needed
if name then
@@ -331,7 +346,7 @@ function mathematics.define(family)
end
setmathsymbol(name,class,family,unicode)
else
- name = class == classes.variable or class == classes.number and character.adobename
+ name = (class == classes.variable or class == classes.number) and character.adobename -- bad
if name and trace_defining then
report(class,family,unicode,name)
end
@@ -339,17 +354,22 @@ function mathematics.define(family)
mset, dset = setmathcharacter(class,family,unicode,m.unicode or unicode,mset,dset) -- see solidus
end
end
- end
- if mathclass then
+ elseif mathclass then
local name = character.mathname
local class = classes[mathclass] or mathclass -- no real checks needed
- if name == false then
+ if not class then
+ if trace_defining then
+ report("unknown",family,unicode,name)
+ end
+ elseif name == false then
if trace_defining then
report(class,family,unicode,name)
end
- mset, dset = setmathcharacter(class,family,unicode,mset,dset)
+ mset, dset = setmathcharacter(class,family,unicode,unicode,mset,dset)
else
- name = name or character.contextname
+ -- if not name then
+ -- name = character.contextname -- too dangerous, we loose textslash and a few more
+ -- end
if name then
if trace_defining then
report(class,family,unicode,name)
diff --git a/tex/context/base/mkiv/math-ini.mkiv b/tex/context/base/mkiv/math-ini.mkiv
index f951d7571..e4c02b6c2 100644
--- a/tex/context/base/mkiv/math-ini.mkiv
+++ b/tex/context/base/mkiv/math-ini.mkiv
@@ -659,7 +659,7 @@
\letcsnamecsname\csname#1\endcsname\csname\??mathcommand#1\endcsname}
\unexpanded\def\mathcommand#1%
- {\csname\??mathcommand#1\endcsname}
+ {\begincsname\??mathcommand#1\endcsname}
%D Let's define a few comands here:
diff --git a/tex/context/base/mkiv/meta-fnt.lua b/tex/context/base/mkiv/meta-fnt.lua
index 1f5670c66..d061c926a 100644
--- a/tex/context/base/mkiv/meta-fnt.lua
+++ b/tex/context/base/mkiv/meta-fnt.lua
@@ -6,6 +6,7 @@ if not modules then modules = { } end modules ['meta-fnt'] = {
license = "see context related readme files"
}
+local next = next
local concat = table.concat
local format = string.format
local formatters = string.formatters
diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua
index b2d97226a..7efed1e5d 100644
--- a/tex/context/base/mkiv/mlib-lua.lua
+++ b/tex/context/base/mkiv/mlib-lua.lua
@@ -673,7 +673,10 @@ do
end
do
-local stores = { }
+
+ local mpvprint = mp.vprint
+
+ local stores = { }
function mp.newstore(name)
stores[name] = { }
@@ -688,7 +691,7 @@ local stores = { }
end
function mp.fromstore(name,key)
- mp.vprint(stores[name][key]) -- type specific
+ mpvprint(stores[name][key]) -- type specific
end
interfaces.implement {
@@ -700,3 +703,14 @@ local stores = { }
}
end
+
+do
+
+ local mpprint = mp.print
+ local texmodes = tex.modes
+
+ function mp.processingmode(s)
+ mpprint(tostring(texmodes[s]))
+ end
+
+end
diff --git a/tex/context/base/mkiv/mlib-pdf.lua b/tex/context/base/mkiv/mlib-pdf.lua
index 7fd6cb62c..75f810fb3 100644
--- a/tex/context/base/mkiv/mlib-pdf.lua
+++ b/tex/context/base/mkiv/mlib-pdf.lua
@@ -578,7 +578,7 @@ function metapost.flush(result,flusher,askedfig)
result[#result+1] = open and "S" or "h S"
end
elseif objecttype == "both" then
- result[#result+1] = evenodd and "h B*" or "h B"-- B* = eo -- b includes closepath
+ result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
end
end
if transformed then
@@ -613,7 +613,7 @@ function metapost.flush(result,flusher,askedfig)
elseif objecttype == "outline" then
result[#result+1] = open and "S" or "h S"
elseif objecttype == "both" then
- result[#result+1] = evenodd and "h B*" or "h B"-- B* = eo -- b includes closepath
+ result[#result+1] = evenodd and "h B*" or "h B" -- B* = eo -- b includes closepath
end
if transformed then
result[#result+1] = "Q"
diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua
index 9fc8fec35..bb5ce31e5 100644
--- a/tex/context/base/mkiv/mlib-pps.lua
+++ b/tex/context/base/mkiv/mlib-pps.lua
@@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['mlib-pps'] = {
}
local format, gmatch, match, split = string.format, string.gmatch, string.match, string.split
-local tonumber, type, unpack = tonumber, type, unpack
+local tonumber, type, unpack, next = tonumber, type, unpack, next
local round, sqrt, min, max = math.round, math.sqrt, math.min, math.max
local insert, remove, concat = table.insert, table.remove, table.concat
local Cs, Cf, C, Cg, Ct, P, S, V, Carg = lpeg.Cs, lpeg.Cf, lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.S, lpeg.V, lpeg.Carg
diff --git a/tex/context/base/mkiv/mlib-run.lua b/tex/context/base/mkiv/mlib-run.lua
index 93ce1fec2..18bc7e4da 100644
--- a/tex/context/base/mkiv/mlib-run.lua
+++ b/tex/context/base/mkiv/mlib-run.lua
@@ -29,7 +29,7 @@ approach is way faster than an external <l n='metapost'/> and processing time
nears zero.</p>
--ldx]]--
-local type, tostring, tonumber = type, tostring, tonumber
+local type, tostring, tonumber, next = type, tostring, tonumber, next
local gsub, match, find = string.gsub, string.match, string.find
local striplines = utilities.strings.striplines
local concat, insert, remove = table.concat, table.insert, table.remove
diff --git a/tex/context/base/mkiv/mult-aux.lua b/tex/context/base/mkiv/mult-aux.lua
index 353b5e69c..bcd5ae5be 100644
--- a/tex/context/base/mkiv/mult-aux.lua
+++ b/tex/context/base/mkiv/mult-aux.lua
@@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['mult-aux'] = {
}
local find = string.find
+local next = next
interfaces.namespaces = interfaces.namespaces or { }
local namespaces = interfaces.namespaces
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index bbb079cc8..0cb60487d 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -6589,6 +6589,18 @@ return {
["pe"]="حرف‌تنظیم",
["ro"]="aliniazacaracter",
},
+ ["alignmentleftwidth"]={
+ ["en"]="alignmentleftwidth",
+ },
+ ["alignmentrightwidth"]={
+ ["en"]="alignmentrightwidth",
+ },
+ ["alignmentleftsample"]={
+ ["en"]="alignmentleftsample",
+ },
+ ["alignmentrightsample"]={
+ ["en"]="alignmentrightsample",
+ },
["alignmentcharacter"]={
["cs"]="alignmentcharacter",
["de"]="alignmentcharacter",
@@ -9271,6 +9283,11 @@ return {
},
["note"]={
["en"]="note",
+ ["nl"]="noot",
+ },
+ ["notes"]={
+ ["en"]="notes",
+ ["nl"]="noten",
},
["nr"]={
["cs"]="nr",
@@ -10278,6 +10295,12 @@ return {
["pe"]="همان‌صفحه",
["ro"]="aceeasipagina",
},
+ ["leftsample"]={
+ ["en"]="leftsample",
+ },
+ ["rightsample"]={
+ ["en"]="rightsample",
+ },
["sample"]={
["cs"]="vzor",
["de"]="muster",
@@ -10457,6 +10480,14 @@ return {
["pe"]="فضای‌کناری‌قبل",
["ro"]="spatiulateralinainte",
},
+ ["spaceafterside"]={
+ ["en"]="spaceafterside",
+ ["nl"]="witnazij",
+ },
+ ["spacebeforeside"]={
+ ["en"]="spacebeforeside",
+ ["nl"]="witvoorzij",
+ },
["sign"]={
["cs"]="znak",
["de"]="zeichen",
@@ -10720,6 +10751,14 @@ return {
["pe"]="بست",
["ro"]="strut",
},
+ ["numberstrut"]={
+ ["en"]="numberstrut",
+ ["nl"]="nummerstrut",
+ },
+ ["titlestrut"]={
+ ["en"]="titlestrut",
+ ["nl"]="titelstrut",
+ },
["style"]={
["cs"]="pismeno",
["de"]="stil",
@@ -16367,6 +16406,10 @@ return {
["pe"]="ایست",
["ro"]="stopper",
},
+ ["nostopper"]={
+ ["en"]="nostopper",
+ ["nl"]="geenafsluiter",
+ },
["stretch"]={
["cs"]="natahnout",
["de"]="strecken",
diff --git a/tex/context/base/mkiv/mult-ini.lua b/tex/context/base/mkiv/mult-ini.lua
index f600c6111..b899d25f2 100644
--- a/tex/context/base/mkiv/mult-ini.lua
+++ b/tex/context/base/mkiv/mult-ini.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['mult-ini'] = {
local format, gmatch, match, find, sub = string.format, string.gmatch, string.match, string.find, string.sub
local lpegmatch = lpeg.match
local serialize, concat = table.serialize, table.concat
-local rawget, type, tonumber = rawget, type, tonumber
+local rawget, type, tonumber, next = rawget, type, tonumber, next
local context = context
local commands = commands
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index 848bd8804..f54052bb0 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -244,6 +244,7 @@ return {
"doifelsenextoptional", "doifnextoptionalelse",
"doifelsenextoptionalcs", "doifnextoptionalcselse",
"doifelsefastoptionalcheck", "doiffastoptionalcheckelse",
+ "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse",
"doifelsenextbgroup", "doifnextbgroupelse",
"doifelsenextbgroupcs", "doifnextbgroupcselse",
"doifelsenextparenthesis", "doifnextparenthesiselse",
@@ -341,7 +342,7 @@ return {
--
"offinterlineskip", "oninterlineskip", "nointerlineskip",
--
- "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "begstrut", "endstrut", "lineheight",
+ "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight",
"leftboundary", "rightboundary", "signalcharacter",
--
"ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing",
diff --git a/tex/context/base/mkiv/node-fnt.lua b/tex/context/base/mkiv/node-fnt.lua
index 888e61cdb..f846f996d 100644
--- a/tex/context/base/mkiv/node-fnt.lua
+++ b/tex/context/base/mkiv/node-fnt.lua
@@ -143,28 +143,28 @@ local ligaturing = nuts.ligaturing
local kerning = nuts.kerning
-- -- -- this will go away
-
-local disccodes = nodes.disccodes
-local explicit_code = disccodes.explicit
-local automatic_code = disccodes.automatic
-local expanders = nil
-
-function fonts.setdiscexpansion(v)
- if v == nil or v == true then
- expanders = languages and languages.expanders
- elseif type(v) == "table" then
- expanders = v
- else
- expanders = false
- end
-end
-
-function fonts.getdiscexpansion()
- return expanders and true or false
-end
-
-fonts.setdiscexpansion(true)
-
+--
+-- local disccodes = nodes.disccodes
+-- local explicit_code = disccodes.explicit
+-- local automatic_code = disccodes.automatic
+-- local expanders = nil
+--
+-- function fonts.setdiscexpansion(v)
+-- if v == nil or v == true then
+-- expanders = languages and languages.expanders
+-- elseif type(v) == "table" then
+-- expanders = v
+-- else
+-- expanders = false
+-- end
+-- end
+--
+-- function fonts.getdiscexpansion()
+-- return expanders and true or false
+-- end
+--
+-- fonts.setdiscexpansion(true)
+--
-- -- -- till here
local function start_trace(head)
@@ -196,9 +196,9 @@ local function stop_trace(u,usedfonts,a,attrfonts,b,basefonts,r,redundant,e,expa
report_fonts("dynamics: %s",a > 0 and concat(keys(attrfonts)," ") or "none")
report_fonts("built-in: %s",b > 0 and b or "none")
report_fonts("removed : %s",r > 0 and r or "none")
-if expanders then
- report_fonts("expanded: %s",e > 0 and e or "none")
-end
+ -- if expanders then
+ -- report_fonts("expanded: %s",e > 0 and e or "none")
+ -- end
report_fonts()
end
@@ -445,12 +445,12 @@ function handlers.characters(head,groupcode,size,packtype,direction)
if firstnone then
protectnone()
end
- elseif expanders then
- local subtype = getsubtype(d)
- if subtype == automatic_code or subtype == explicit_code then
- expanders[subtype](d)
- e = e + 1
- end
+ -- elseif expanders then
+ -- local subtype = getsubtype(d)
+ -- if subtype == automatic_code or subtype == explicit_code then
+ -- expanders[subtype](d)
+ -- e = e + 1
+ -- end
end
end
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index b0730526b..a621b6481 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -115,85 +115,6 @@ nuts.tonut = tonut
nodes.tonode = tonode
nodes.tonut = tonut
--- getters
-
--- if not direct.getcomponents then
---
--- local getfield = direct.getfield
--- local setfield = direct.setfield
--- local setsubtype = direct.setsubtype
---
--- local attributelist_code = nodecodes.attributelist
---
--- function direct.getcomponents(n) return getfield(n,"components") end
--- function direct.setcomponents(n,c) setfield(n,"components",c) end
--- function direct.getkern(n) return getfield(n,"kern") end
--- function direct.getwidth(n) return getfield(n,"width") end
--- function direct.setwidth(n,w) return setfield(n,"width",w) end
--- function direct.getheight(n) return getfield(n,"height") end
--- function direct.setheight(n,h) return setfield(n,"height",h) end
--- function direct.getdepth(n) return getfield(n,"depth") end
--- function direct.setdepth(n,d) return setfield(n,"depth",d) end
--- function direct.getshift(n) return getfield(n,"shift") end
--- function direct.setshift(n,s) return setfield(n,"shift",s) end
--- function direct.getpenalty(n) return getfield(n,"penalty") end
--- function direct.setpenalty(n,p) setfield(n,"penalty",p) end
--- function direct.getdir(n) return getfield(n,"dir") end
--- function direct.setdir(n,p) setfield(n,"dir",p) end
--- function direct.getlanguage(n) return getfield(n,"lang") end
--- function direct.setlanguage(n,l) return setfield(n,"lang",l) end
--- function direct.getattributelist(n) getfield(n,"attr") end
---
--- function direct.getnucleus(n) return getfield(n,"nucleus") end
--- function direct.setnucleus(n,p) return setfield(n,"nucleus",p) end
--- function direct.getsup(n) return getfield(n,"sup") end
--- function direct.setsup(n,p) return setfield(n,"sup",p) end
--- function direct.getsub(n) return getfield(n,"sub") end
--- function direct.setsub(n,p) return setfield(n,"sub",p) end
---
--- function direct.setattributelist(n,a)
--- if a and type(a) ~= attributelist_code then
--- a = getfield(a,"attr")
--- end
--- setfield(n,"attr",a)
--- end
---
--- function direct.setkern(n,k,s)
--- setfield(n,"kern",k)
--- if s then
--- setsubtype(n,s)
--- end
--- end
---
--- function direct.setfont(n,f,c)
--- setfield(n,"font",f)
--- if c then
--- setfield(n,"char",f)
--- end
--- end
---
--- function direct.getoffsets(n)
--- return getfield(n,"xoffset"), getfield(n,"yoffset")
--- end
---
--- function direct.setoffsets(n,x,y)
--- if x then
--- setfield(n,"xoffset",x)
--- end
--- if y then
--- setfield(n,"yoffset",y)
--- end
--- end
---
--- end
---
--- if LUATEXVERSION < 1.005 then
--- local getfield = direct.getfield
--- function direct.getnucleus(n) return getfield(n,"nucleus") end
--- function direct.getsub (n) return getfield(n,"sub") end
--- function direct.getsup (n) return getfield(n,"sup") end
--- end
-
-- -- some tracing:
--
-- local hash = table.setmetatableindex("number")
@@ -217,19 +138,17 @@ nodes.tonut = tonut
-- return f(...)
-- end
-- end
-
+--
-- track("getfield")
--- setters
-
-- helpers
-if not direct.getfam then
+if not direct.getfam then -- LUATEXVERSION < 1.070
local getfield = direct.getfield
local setfield = direct.setfield
- direct.getfam = function(n,f) getfield(n,"small_fam",f) end
- direct.setfam = function(n,f) setfield(n,"small_fam",f) end
+ direct.getfam = function(n) return getfield(n,"small_fam") end
+ direct.setfam = function(n,f) setfield(n,"small_fam",f) end
end
nuts.tostring = direct.tostring
@@ -408,20 +327,6 @@ local d_setlink = direct.setlink
local d_setboth = direct.setboth
local d_getboth = direct.getboth
--- local function remove(head,current,free_too)
--- local t = current
--- head, current = d_remove_node(head,current)
--- if not t then
--- -- forget about it
--- elseif free_too then
--- d_flush_node(t)
--- t = nil
--- else
--- d_setboth(t) -- (t,nil,nil)
--- end
--- return head, current, t
--- end
-
local function remove(head,current,free_too)
if current then
local h, c = d_remove_node(head,current)
@@ -454,12 +359,6 @@ function nuts.replace(head,current,new) -- no head returned if false
head, current, new = false, head, current
end
local prev, next = d_getboth(current)
--- if next then
--- d_setlink(new,next)
--- end
--- if prev then
--- d_setlink(prev,new)
--- end
if prev or next then
d_setlink(prev,new,next)
end
@@ -957,7 +856,7 @@ if not nuts.unprotect_glyph then
end
-if LUATEXFUNCTIONALITY < 6384 then
+if LUATEXFUNCTIONALITY < 6384 then -- LUATEXVERSION < 1.070
local getfield = nuts.getfield
local setfield = nuts.setfield
diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua
index fab9d51ac..f12599866 100644
--- a/tex/context/base/mkiv/node-tra.lua
+++ b/tex/context/base/mkiv/node-tra.lua
@@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['node-tra'] = {
might become a runtime module instead. This module will be cleaned up!</p>
--ldx]]--
+local next = next
local utfchar = utf.char
local format, match, gmatch, concat, rep = string.format, string.match, string.gmatch, table.concat, string.rep
local lpegmatch = lpeg.match
diff --git a/tex/context/base/mkiv/page-brk.mkiv b/tex/context/base/mkiv/page-brk.mkiv
index 7ab74c0e4..e18c0d923 100644
--- a/tex/context/base/mkiv/page-brk.mkiv
+++ b/tex/context/base/mkiv/page-brk.mkiv
@@ -504,7 +504,7 @@
\ifdim\pagetotal<\pagegoal \relax
\getnoflines\pagegoal
\ifdim\dimexpr\page_check_amount-\noflines\lineheight\relax>-\lineheight
- \pagecheckparameter\c!before
+ \pagecheckerparameter\c!before
\penalty-\plustenthousand
\pagecheckerparameter\c!after
\else
diff --git a/tex/context/base/mkiv/page-ffl.mkiv b/tex/context/base/mkiv/page-ffl.mkiv
new file mode 100644
index 000000000..5536371a7
--- /dev/null
+++ b/tex/context/base/mkiv/page-ffl.mkiv
@@ -0,0 +1,211 @@
+%D \module
+%D [ file=page-ffl,
+%D version=2018.01.04,
+%D title=\CONTEXT\ Page Macros,
+%D subtitle=Facing floats,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Page Macros / Facing floats}
+
+%D The code below comes from a module made for Thomas Schmitz and is now part of the
+%D core. A simple example is given here:
+%D
+%D \starttyping
+%D \definefacingfloat
+%D [whatever]
+%D
+%D \setupfacingfloat
+%D [whatever]
+%D [style=bold,
+%D color=white]
+%D
+%D \setupfacingfloat
+%D [whatever:left]
+%D [background=color,
+%D backgroundcolor=red]
+%D
+%D \setupfacingfloat
+%D [whatever:right]
+%D [background=color,
+%D backgroundcolor=green]
+%D
+%D \startfacingfloat[whatever]
+%D {\dorecurse{10}{\samplefile{tufte} }}
+%D {\dorecurse{10}{\samplefile{ward} }}
+%D {\dorecurse{10}{\samplefile{tufte} }}
+%D {\dorecurse{10}{\samplefile{ward} }}
+%D \stopfacingfloat
+%D
+%D \startfacingfloat[whatever]
+%D \startcontent \dorecurse{10}{\samplefile{tufte} } \stopcontent
+%D \startcontent \dorecurse{10}{\samplefile{ward} } \stopcontent
+%D \startcontent \dorecurse{10}{\samplefile{tufte} } \stopcontent
+%D \startcontent \dorecurse{10}{\samplefile{ward} } \stopcontent
+%D \stopfacingfloat
+%D
+%D \dorecurse{10}{\samplefile{sapolsky} }
+%D \stoptyping
+%D
+%D The idea is to flush related floats more or less in parallel.
+
+\unprotect
+
+\installcorenamespace {facingfloat}
+
+\installframedcommandhandler \??facingfloat {facingfloat} \??facingfloat
+
+\setupfacingfloat
+ [\c!spaceinbetween=\v!big,
+ \c!inbetween={\blank[\v!big]},
+ %\c!style,
+ %\c!color,
+ \c!page=\v!yes]
+
+\appendtoks
+ \ifx\currentfacingfloatparent\empty
+ \normalexpanded{\definefacingfloat[\currentfacingfloat:\v!left ][\currentfacingfloat]}%
+ \normalexpanded{\definefacingfloat[\currentfacingfloat:\v!right][\currentfacingfloat]}%
+ \fi
+\to \everydefinefacingfloat
+
+\newcount\c_strc_floats_saved
+\newcount\c_strc_floats_flushed
+
+\newbox\b_strc_floats_facing_l
+\newbox\b_strc_floats_facing_r
+
+\let\m_strc_floats_state\relax
+
+\def\strc_floats_facing_flush
+ {\ifnum\c_strc_floats_flushed<\c_strc_floats_saved
+ \global\advance\c_strc_floats_flushed\plusone
+ \floatingpenalty\zerocount
+ \insert\namedinsertionnumber\s!topfloat\bgroup
+ \forgetall
+ \ifconditional\c_page_one_top_of_insert
+ \ifconditional\c_page_one_correct_top_insert
+ \topskipcorrection % [xx] new: see icare topbleed
+ \kern-\lineskip
+ \par
+ \prevdepth\maxdimen
+ \fi
+ \fi
+ \directboxfromcache{\currentfacingfloat}{\number\c_strc_floats_flushed}%
+ \vskip\s_page_one_between_top_insert
+ \egroup
+ \ifnum\c_strc_floats_saved=\c_strc_floats_flushed
+ \global\c_strc_floats_saved \zerocount
+ \global\c_strc_floats_flushed\zerocount
+ \resetboxesincache{\currentfacingfloat}%
+ \fi
+ \fi}
+
+\unexpanded\def\strc_floats_facing_setup
+ {\edef\currentfacingfloat{\currentfacingfloat:\m_strc_floats_state}%
+ \usefacingfloatstyleandcolor\c!style\v!color}
+
+\unexpanded\def\strc_floats_facing_collect
+ {\ifx\m_strc_floats_state\v!left
+ \ifvoid\nextbox\else\ifzeropt\wd\nextbox\else
+ \ifvoid\b_strc_floats_facing_l
+ \setbox\b_strc_floats_facing_l\box\nextbox
+ \else
+ \setbox\b_strc_floats_facing_l\vbox\bgroup
+ \unvbox\b_strc_floats_facing_l
+ \facingfloatparameter\c!inbetween
+ \unvbox\nextbox
+ \egroup
+ \fi
+ \fi\fi
+ \let\m_strc_floats_state\v!right
+ \else\ifx\m_strc_floats_state\v!right
+ \ifvoid\nextbox\else\ifzeropt\wd\nextbox\else
+ \ifvoid\b_strc_floats_facing_r
+ \setbox\b_strc_floats_facing_r\box\nextbox
+ \else
+ \setbox\b_strc_floats_facing_r\vbox\bgroup
+ \unvbox\b_strc_floats_facing_r
+ \facingfloatparameter\c!inbetween
+ \unvbox\nextbox
+ \egroup
+ \fi
+ \fi\fi
+ \let\m_strc_floats_state\v!left
+ \else
+ \let\m_strc_floats_state\v!left
+ \fi\fi}
+
+\unexpanded\def\strc_floats_facing_handle
+ {\strc_floats_facing_collect
+ \doifnextbgroupelse
+ \strc_floats_facing_handle_indeed
+ \strc_floats_wrap_up}
+
+\unexpanded\def\strc_floats_facing_handle_indeed
+ {\dowithnextboxcontent
+ \strc_floats_facing_setup
+ \strc_floats_facing_handle
+ \vbox}
+
+\unexpanded\def\startfacingfloat[#1]%
+ {\begingroup
+ % todo: \usepageparameter
+ \edef\p_page{\facingfloatparameter\c!page}%
+ \ifx\p_page\empty
+ \page[\p_page]%
+ \fi
+ %
+ \let\startcontent\bgroup
+ \let\stopcontent\egroup
+ \def\currentfacingfloat{#1}%
+ \strc_floats_facing_handle}
+
+\unexpanded\def\stopfacingfloat
+ {\endgroup}
+
+\unexpanded\def\strc_floats_wrap_up
+ {\edef\p_spaceinbetween{\facingfloatparameter\c!spaceinbetween}%
+ \ifx\p_spaceinbetween\empty
+ \scratchdimen\zeropoint
+ \else
+ \setbox\scratchbox\vbox{\directvspacing\p_spaceinbetween}%
+ \scratchdimen\htdp\scratchbox
+ \fi
+ \doloop{%
+ \strc_floats_facing_flush_wrap\b_strc_floats_facing_l\v!left
+ \strc_floats_facing_flush_wrap\b_strc_floats_facing_r\v!right
+ \ifvoid\b_strc_floats_facing_l\relax\ifvoid\b_strc_floats_facing_r\relax
+ \exitloop
+ \fi\fi}}
+
+\def\strc_floats_facing_flush_wrap#1#2%
+ {\ifvoid#1\relax
+ % todo
+ \else
+ \begingroup
+ \setbox\scratchbox\vsplit#1 upto \textheight
+ \setbox\scratchbox\hpack\bgroup
+ \edef\currentfacingfloat{\currentfacingfloat:#2}%
+ \inheritedfacingfloatframed{\box\scratchbox}%
+ \egroup
+ \ifdim\ht\scratchbox<\dimexpr\textheight-\scratchdimen\relax
+ \setbox\scratchbox\vbox{\box\scratchbox\directvspacing\p_spaceinbetween}%
+ \else
+ \setbox\scratchbox\vbox to \textheight{\box\scratchbox\vss}%
+ \fi
+ \global\advance\c_strc_floats_saved\plusone
+ \putboxincache{\currentfacingfloat}{\number\c_strc_floats_saved}\scratchbox
+ \endgroup
+ \fi}
+
+\appendtoks
+ \strc_floats_facing_flush
+\to \everyafteroutput
+
+\protect \endinput
diff --git a/tex/context/base/mkiv/page-flt.lua b/tex/context/base/mkiv/page-flt.lua
index a082cc71e..41a35d47b 100644
--- a/tex/context/base/mkiv/page-flt.lua
+++ b/tex/context/base/mkiv/page-flt.lua
@@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['page-flt'] = {
-- floats -> managers.floats
-- some functions are a tex/lua mix so we need a separation
+local next = next
local tostring = tostring
local insert, remove = table.insert, table.remove
local find = string.find
diff --git a/tex/context/base/mkiv/page-lay.mkiv b/tex/context/base/mkiv/page-lay.mkiv
index 8da2b5017..294718f9c 100644
--- a/tex/context/base/mkiv/page-lay.mkiv
+++ b/tex/context/base/mkiv/page-lay.mkiv
@@ -473,11 +473,23 @@
[\page_paper_the_paper_size{#1}]%
[\page_paper_the_print_size{#2}]}}
-\setvalue{\??layoutpaper\v!reset }{\global\setfalse\c_page_target_paper_landscape
- \global\setfalse\c_page_target_paper_mirror
- \global\setfalse\c_page_target_paper_negate
- \global\c_page_target_paper_orientation\uprotationangle
- \global\c_page_target_paper_reverse \uprotationangle}
+\unexpanded\def\page_paper_reset_paper
+ {\global\setfalse\c_page_target_paper_landscape
+ \global\setfalse\c_page_target_paper_mirror
+ \global\setfalse\c_page_target_paper_negate
+ \global\c_page_target_paper_orientation\uprotationangle
+ \global\c_page_target_paper_reverse \uprotationangle}
+
+\unexpanded\def\page_paper_reset_print
+ {\global\setfalse\c_page_target_print_landscape
+ \global\setfalse\c_page_target_print_mirror
+ \global\setfalse\c_page_target_print_negate
+ \global\c_page_target_print_orientation\uprotationangle
+ \global\c_page_target_print_reverse \uprotationangle}
+
+\letvalue{\??layoutpaper\v!reset}\page_paper_reset_paper
+\letvalue{\??layoutprint\v!reset}\page_paper_reset_print
+
\setvalue{\??layoutpaper\v!landscape }{\global\settrue\c_page_target_paper_landscape}
\setvalue{\??layoutpaper\v!mirrored }{\global\settrue\c_page_target_paper_mirror}
\setvalue{\??layoutpaper\v!negative }{\global\settrue\c_page_target_paper_negate}
@@ -490,11 +502,6 @@
\setvalue{\??layoutpaper\number\leftrotationangle }{\global\c_page_target_paper_orientation\leftrotationangle
\global\c_page_target_paper_reverse \rightrotationangle}
-\setvalue{\??layoutprint\v!reset }{\global\setfalse\c_page_target_print_landscape
- \global\setfalse\c_page_target_print_mirror
- \global\setfalse\c_page_target_print_negate
- \global\c_page_target_print_orientation\uprotationangle
- \global\c_page_target_print_reverse \uprotationangle}
\setvalue{\??layoutprint\v!landscape }{\global\settrue\c_page_target_print_landscape}
\setvalue{\??layoutprint\v!mirrored }{\global\settrue\c_page_target_print_mirror}
\setvalue{\??layoutprint\v!negative }{\global\settrue\c_page_target_print_negate}
@@ -519,18 +526,20 @@
\fi}
\unexpanded\def\page_paper_set_current_indeed[#1][#2]%
- {\edef\m_page_asked_paper{\v!reset,#1}% can be the restores
- \edef\m_page_asked_print{\v!reset,#2}%
+ {\edef\m_page_asked_paper{#1}% can be the restores
+ \edef\m_page_asked_print{#2}%
%
\page_paper_set_restore\m_page_asked_paper\m_page_asked_print
%
% locate page target
\let\currentlayouttarget\empty
+ \page_paper_reset_paper
\processcommacommand[\m_page_asked_paper]\page_paper_identify_target
\ifx\currentlayouttarget\empty
\let\currentlayouttarget\currentpage
\fi
\global\let\papersize\currentlayouttarget
+ \page_paper_reset_paper
\processcommacommand[\m_page_asked_paper]\page_paper_handle_page_option
\global\paperwidth \layouttargetparameter\c!width \relax
\global\paperheight\layouttargetparameter\c!height\relax
@@ -550,8 +559,10 @@
%
\page_paper_set_offsets
% locate paper target
+ \page_paper_reset_print
\processcommacommand[\m_page_asked_print]\page_paper_identify_target
\global\let\printpapersize\currentlayouttarget
+ \page_paper_reset_print
\processcommacommand[\m_page_asked_print]\page_paper_handle_print_option
\global\printpaperwidth \layouttargetparameter\c!width \relax
\global\printpaperheight\layouttargetparameter\c!height\relax
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua
index 0d8e64cea..b0e1783e4 100644
--- a/tex/context/base/mkiv/page-mix.lua
+++ b/tex/context/base/mkiv/page-mix.lua
@@ -121,7 +121,7 @@ local function collectinserts(result,nxt,nxtid)
if nxtid == insert_code then
i = i + 1
result.i = i
- inserttotal = inserttotal + getheight(nxt) -- height includes depth
+ inserttotal = inserttotal + getheight(nxt) -- height includes depth (hm, still? needs checking)
local s = getsubtype(nxt)
local c = inserts[s]
if trace_detail then
@@ -265,6 +265,7 @@ local function preparesplit(specification) -- a rather large function
local height = 0
local depth = 0
local skip = 0
+ local handlenotes = specification.notes or false
local splitmethod = specification.splitmethod or false
if splitmethod == v_none then
splitmethod = false
@@ -628,7 +629,7 @@ local function preparesplit(specification) -- a rather large function
if trace_state then
report_state("%-8s > column %s, content: %s","line (1)",column,listtoutf(getlist(current),true,true))
end
- if more then
+ if more and handlenotes then
nxt, inserts, insertskips, nextskips, inserttotal = collectinserts(result,nxt,nxtid)
end
local state, skipped = checked(advance+inserttotal+insertskips,more and "line (2)" or "line only",lastlocked)
@@ -751,7 +752,7 @@ local function preparesplit(specification) -- a rather large function
specification.overflow = overflow
specification.discarded = discarded
- setlist(getbox(specification.box),nil)
+ setlist(getbox(specification.box))
return specification
end
@@ -774,9 +775,9 @@ local function finalize(result)
end
local t = r.tail
if t then
- setnext(t,nil)
+ setnext(t)
else
- setnext(h,nil)
+ setnext(h)
r.tail = h
end
for c, list in next, r.inserts do
@@ -784,11 +785,13 @@ local function finalize(result)
for i=1,#list do
local l = list[i]
local h = new_hlist()
+ local g = getlist(l)
t[i] = h
- setlist(h,getlist(l))
- local wd, ht, dp = getwhd(l)
- -- here ht is still ht + dp !
- setwhd(h,getwidth(h),ht,dp)
+ setlist(h,g)
+ local ht = getheight(l)
+ local dp = getdepth(l)
+ local wd = getwidth(g)
+ setwhd(h,wd,ht,dp)
setlist(l)
end
setprev(t[1]) -- needs checking
@@ -908,7 +911,6 @@ local function getsplit(result,n)
return s
end
end
-
if grid then
-- print(n,result.maxtotal,r.total,r.extra)
if isglobal then
@@ -960,13 +962,11 @@ local function getsplit(result,n)
end
for c, list in next, r.inserts do
-
local l = concatnodes(list)
for i=1,#list-1 do
setdepth(list[i],0)
end
local b = vpack(l) -- multiple arguments, todo: fastvpack
-
-- setbox("global",c,b)
setbox(c,b)
r.inserts[c] = nil
@@ -1035,6 +1035,7 @@ implement {
{ "alternative" },
{ "internalgrid" },
{ "grid", "boolean" },
+ { "notes", "boolean" },
}
}
}
diff --git a/tex/context/base/mkiv/page-mix.mkiv b/tex/context/base/mkiv/page-mix.mkiv
index 326d01994..9fa80275a 100644
--- a/tex/context/base/mkiv/page-mix.mkiv
+++ b/tex/context/base/mkiv/page-mix.mkiv
@@ -84,6 +84,7 @@
\c!step=.25\lineheight, % needs some experimenting
%\c!splitmethod=\v!fixed, % will be default
\c!direction=\v!normal, % new (also todo in the new columnsets)
+ \c!notes=\v!yes,
\c!method=\ifinner\s!box\else\s!otr\fi] % automatic as suggested by WS
\let\startmixedcolumns\relax % defined later
@@ -123,6 +124,8 @@
\setnewconstant\c_page_mix_routine_balance \plusthree
\setnewconstant\c_page_mix_routine_error \plusfour
+\newconditional\c_page_mix_process_notes
+
%D The main environment is called as follows:
%D
%D \starttyping
@@ -183,7 +186,8 @@
\c!splitmethod=\v!none,
\c!grid=\v!tolerant,
\c!internalgrid=\v!halfline, % new, we may still revert to \v!line
- \c!balance=\v!yes]
+ \c!balance=\v!yes,
+ \c!notes=\v!no] % kind of hidden
% better
@@ -193,6 +197,17 @@
\c!grid=\v!yes,
\c!internalgrid=\v!line]
+% even better:
+
+\setupitemgroup
+ [\c!grid=\v!tolerant:10] % 10 pct tolerance in columns snapping
+
+\setupmixedcolumns
+ [\s!itemgroupcolumns]
+ [\c!grid=\itemgroupparameter\c!grid]
+
+% the fast hooks:
+
\unexpanded\def\strc_itemgroups_start_columns
{\startmixedcolumns[\s!itemgroupcolumns]} % we could have a fast one
@@ -464,18 +479,29 @@
\let\page_mix_fast_columns_stop\relax
+\newtoks\t_page_mix_at_the_end
+
+\def\page_mix_finalize_columns
+ {\ifconditional\c_page_mix_process_notes \else
+ \global\t_page_mix_at_the_end{\stoppostponingnotes}%
+ \fi}
+
\unexpanded\def\page_mix_columns_stop_yes
- {\begincsname\??mixedcolumnsstop \currentmixedcolumnsmethod\endcsname % no \relax
+ {\begincsname\??mixedcolumnsstop\currentmixedcolumnsmethod\endcsname % no \relax
+ \page_mix_finalize_columns
\endgroup
\begincsname\??mixedcolumnsafter\currentmixedcolumnsmethod\endcsname\relax
\mixedcolumnsparameter\c!after\relax
\popmacro\currentmixedcolumnsmethod
- \popmacro\currentmixedcolumns}
+ \popmacro\currentmixedcolumns
+ \the\t_page_mix_at_the_end\global\t_page_mix_at_the_end\emptytoks}
\unexpanded\def\page_mix_columns_stop_nop
- {\endgroup
+ {\page_mix_finalize_columns
+ \endgroup
\popmacro\currentmixedcolumnsmethod
- \popmacro\currentmixedcolumns}
+ \popmacro\currentmixedcolumns
+ \the\t_page_mix_at_the_end\global\t_page_mix_at_the_end\emptytoks}
% \unexpanded\def\page_mix_columns_stop_yes
% {\begincsname\??mixedcolumnsstop \currentmixedcolumnsmethod\endcsname % no \relax
@@ -528,6 +554,11 @@
\leftskip \zeropoint
\rightskip\zeropoint
%
+ \doifelse{\mixedcolumnsparameter\c!notes}\v!yes\settrue\setfalse\c_page_mix_process_notes
+ \ifconditional\c_page_mix_process_notes \else
+ \startpostponingnotes
+ \fi
+ %
\d_page_mix_threshold\zeropoint
%
\d_page_mix_column_width\dimexpr(\d_page_mix_max_width-\d_page_mix_distance*\numexpr(\c_page_mix_n_of_columns-\plusone)\relax)/\c_page_mix_n_of_columns\relax
@@ -649,7 +680,8 @@
balance {#1}%
alternative {\mixedcolumnsparameter\c!alternative}%
internalgrid {\mixedcolumnsparameter\c!internalgrid}%
- grid \ifgridsnapping true\else false\fi
+ grid \ifgridsnapping tru\else fals\fi e %
+ notes \ifconditional\c_page_mix_process_notes tru\else fals\fi e %
\relax
\deadcycles\zerocount}
@@ -725,7 +757,9 @@
\hskip-\d_page_mix_column_width
\vbox \bgroup
\hsize\d_page_mix_column_width
- \placenoteinserts
+ \ifconditional\c_page_mix_process_notes
+ \placenoteinserts
+ \fi
\egroup
\hss
\egroup}
diff --git a/tex/context/base/mkiv/page-mrk.mkiv b/tex/context/base/mkiv/page-mrk.mkiv
index 43116e84d..69746ea89 100644
--- a/tex/context/base/mkiv/page-mrk.mkiv
+++ b/tex/context/base/mkiv/page-mrk.mkiv
@@ -13,13 +13,19 @@
\writestatus{loading}{ConTeXt Page Macros / Cutmarks and Colorbars}
-%D This module depends on \METAPOST.
-
\unprotect
-% \def\pagecutmarksymbol {\the\realpageno}
-% \let\pagecutmarktoptext \empty
-% \let\pagecutmarkbottomtext \empty
+%D This module implements curmarks and depends on \METAPOST.
+%D
+%D \starttyping
+%D \setuplayout[marking=on,location=middle]
+%D \setuplayout[marking=page,location=middle]
+%D \setuplayout[marking=empty,location=middle]
+%D \setuplayout[marking={color,page},location=middle]
+%D \setuplayout[marking={one,page},location=middle]
+%D \setuplayout[marking={two,page},location=middle]
+%D \setuplayout[marking={four,page},location=middle]
+%D \stoptyping
\def\pagecutmarklength {5mm}
\def\pagecutmarkoffset {3mm} % slightly larger than before, and now a fixed size
@@ -49,7 +55,8 @@
\startuniqueMPgraphic{print:lines}{w,h,l,o,x,y}
loadmodule "crop" ;
- page_marks_add_lines(\MPvar w,\MPvar h,\MPvar l,\MPvar o,\MPvar x,\MPvar y) ;
+ page_marks_add_lines(\MPvar w,\MPvar h,\MPvar l,\MPvar o,\MPvar x,\MPvar y,
+ \ifconditional\c_page_marks_add_page_lines tru\else fals\fi e) ;
\stopuniqueMPgraphic
\startuseMPgraphic{print:number}{w,h,l,o,n}
@@ -112,9 +119,7 @@
\scratchheight\ht#1%
\scratchdepth \dp#1%
\box#1\relax
- \ifconditional\c_page_marks_add_page_lines
- \page_marks_add_lines
- \fi
+ \page_marks_add_lines
\egroup}
\def\page_marks_add_more_indeed#1%
@@ -163,28 +168,29 @@
% \let\pagecutmarkbottomtext\extrapagecutmarkbottomtext}
\installpagecutmark\v!on
- {\settrue\c_page_marks_add_page_lines
+ {%settrue\c_page_marks_add_page_lines
\settrue\c_page_marks_add_more_lines
\settrue\c_page_marks_add_more_number}
-\installpagecutmark\v!page % todo
- {\settrue\c_page_marks_add_more_lines
+\installpagecutmark\v!page
+ {\settrue\c_page_marks_add_page_lines
+ \settrue\c_page_marks_add_more_lines
\settrue\c_page_marks_add_more_number}
\installpagecutmark\v!empty
- {\settrue\c_page_marks_add_page_lines
+ {%settrue\c_page_marks_add_page_lines
\settrue\c_page_marks_add_more_lines}
\installpagecutmark\v!color
- {\settrue\c_page_marks_add_page_lines
+ {%settrue\c_page_marks_add_page_lines
\settrue\c_page_marks_add_more_lines
\settrue\c_page_marks_add_more_color
\settrue\c_page_marks_add_more_marking
\settrue\c_page_marks_add_more_number}
-\installpagecutmark\v!one {\global\c_page_marks_max\plusone}
-\installpagecutmark\v!two {\global\c_page_marks_max\plustwo}
-\installpagecutmark\v!four{\global\c_page_marks_max\plusfour}
+\installpagecutmark\v!one {\global\c_page_marks_max\plusone} % first page
+\installpagecutmark\v!two {\global\c_page_marks_max\plustwo} % first two pages
+\installpagecutmark\v!four{\global\c_page_marks_max\plusfour} % first four pages
\unexpanded\def\page_marks_set#1%
{\begincsname\??layoutmarking#1\endcsname}
diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi
index 1fe928c36..45dc86482 100644
--- a/tex/context/base/mkiv/page-otr.mkvi
+++ b/tex/context/base/mkiv/page-otr.mkvi
@@ -192,7 +192,7 @@
\installoutputroutine\synchronizeoutput % use \triggerpagebuilder instead
{\ifvoid\normalpagebox\else
\unvbox\normalpagebox
- \pagediscards % does more harm than good .. needs thinking
+ % not \pagediscards as it does more harm than good
\fi}
\installoutputroutine\discardpage
diff --git a/tex/context/base/mkiv/page-sid.mkiv b/tex/context/base/mkiv/page-sid.mkiv
index 75f7725c3..e8f2b03a4 100644
--- a/tex/context/base/mkiv/page-sid.mkiv
+++ b/tex/context/base/mkiv/page-sid.mkiv
@@ -63,6 +63,8 @@
\newdimen \d_page_sides_bottomskip
\newdimen \d_page_sides_downshift
\newdimen \d_page_sides_pagetotal
+\newdimen \d_page_sides_topoffset
+\newdimen \d_page_sides_bottomoffset
\setnewconstant \c_page_sides_method \plusone % 0=raw 1=safe (.99) 2=tight (-1pt)
\setnewconstant \c_page_sides_align \zerocount
@@ -212,7 +214,8 @@
{\global\d_page_sides_vsize\d_page_sides_vsize_reset
% also here if used at all \global\holdinginserts\zerocount
\global\setfalse\c_page_sides_short
- \global\setfalse\c_page_sides_flag}
+ \global\setfalse\c_page_sides_flag
+ \global\c_page_sides_checks_done\zerocount}
\unexpanded\def\doifelsesidefloat
{\par
@@ -282,37 +285,50 @@
\fi}%
\endgroup}
-\def\page_sides_flush_floats_after_none
- {\ifdim\parskip>\zeropoint % why this test ?
- \ifdim\d_page_sides_bottomskip>\parskip
- \blank[\v!nowhite,\rootfloatparameter\c!sidespaceafter]%
- \fi
- \else
- \blank[\rootfloatparameter\c!sidespaceafter]%
- \fi}
-
-\def\page_sides_flush_floats_blank#1% we need to deal with the distance
- {\ifdim\d_page_sides_bottomskip>\d_page_sides_topskip
- \blank[%
- \ifnum#1>\zerocount\v!nowhite,\fi
- \ifdim\d_page_sides_topskip >\zeropoint-\rootfloatparameter\c!sidespacebefore,\fi % the next one
- \ifdim\d_page_sides_bottomskip>\zeropoint \rootfloatparameter\c!sidespaceafter \fi
- ]%
- \else\ifdim\d_page_sides_bottomskip<\d_page_sides_topskip
- \blank[%
- \ifnum#1>\zerocount\v!nowhite,\fi
- \ifdim\d_page_sides_bottomskip>\zeropoint -\rootfloatparameter\c!sidespaceafter ,\fi
- \ifdim\d_page_sides_topskip >\zeropoint \rootfloatparameter\c!sidespacebefore \fi
- ]%
- \fi\fi}
+\def\page_sides_flush_floats_after_none % we force a flush
+ {\edef\tempstring{%
+ \ifdim\d_page_sides_bottomskip>\zeropoint
+ \ifdim\parskip>\zeropoint % why this test ?
+ \ifdim\d_page_sides_bottomskip>\parskip
+ \v!nowhite,\rootfloatparameter\c!sidespaceafter
+ \fi
+ \else
+ \rootfloatparameter\c!sidespaceafter
+ \fi
+ \fi}%
+ \ifx\tempstring\empty\else\ifx\tempstring\v!none\else
+ \blank[\tempstring]%
+ \fi\fi
+ \page_sides_inject_after}
+
+\def\page_sides_flush_floats_blank#1% we have two successive ones
+ {\edef\tempstring{%
+ \ifx#1\empty\else#1,\fi
+ \ifdim\d_page_sides_bottomskip>\d_page_sides_topskip
+ \ifdim\d_page_sides_topskip >\zeropoint-\rootfloatparameter\c!sidespacebefore,\fi % the next one
+ \ifdim\d_page_sides_bottomskip>\zeropoint \rootfloatparameter\c!sidespaceafter ,\fi
+ \else\ifdim\d_page_sides_bottomskip<\d_page_sides_topskip
+ \ifdim\d_page_sides_bottomskip>\zeropoint -\rootfloatparameter\c!sidespaceafter ,\fi
+ \ifdim\d_page_sides_topskip >\zeropoint \rootfloatparameter\c!sidespacebefore,\fi
+ \else % equal
+ \rootfloatparameter\c!sidespacebefore % inbetween
+ \fi\fi}%
+ \ifx\tempstring\empty\else\ifx\tempstring\v!none\else
+ \blank[\tempstring]%
+ \fi\fi
+ \page_sides_inject_after}
-\def\page_sides_flush_floats_after_next
+\def\page_sides_flush_floats_after_next % we have two successive ones
{\ifdim\parskip>\zeropoint % why this test ?
\ifdim\d_page_sides_bottomskip>\parskip
- \page_sides_flush_floats_blank\plusone
- \fi
+ \page_sides_flush_floats_blank\v!nowhite
+ \else\ifdim\d_page_sides_topskip>\parskip
+ \page_sides_flush_floats_blank\v!nowhite
+ \else
+ % use parskip
+ \fi\fi
\else
- \page_sides_flush_floats_blank\zerocount
+ \page_sides_flush_floats_blank\empty
\fi}
\def\page_sides_check_floats_after_par
@@ -647,12 +663,25 @@
% % but it seems to work
% \endgroup}
+\def\page_sides_inject_before
+ {\edef\tempstring{\rootfloatparameter\c!spacebeforeside}%
+ \ifx\tempstring\empty\else\ifx\tempstring\v!none\else
+ \blank[\tempstring]%
+ \fi\fi}
+
+\def\page_sides_inject_after
+ {\edef\tempstring{\rootfloatparameter\c!spaceafterside}%
+ \ifx\tempstring\empty\else\ifx\tempstring\v!none\else
+ \blank[\tempstring]%
+ \fi\fi}
+
\def\page_sides_prepare_space
{%\fakenextstrutline % does more bad than good at page crossing
\inhibitblank} % hm, why here .. gets obscured anyway
\def\page_sides_handle_float#1% grid (4) is rather experimental
- {\page_sides_prepare_space
+ {\page_sides_inject_before
+ \page_sides_prepare_space
\page_sides_apply_horizontal_shift
\page_sides_check_previous_float
\page_sides_inject_dummy_lines
@@ -820,7 +849,7 @@
\fi
\kern-\privatescratchcounter\baselineskip
\penalty\zerocount
- \triggerpagebuilder
+ \triggerpagebuilder % the penalty already does that
\endgroup}
\def\adjustsidefloatdisplaylines % public, will change
diff --git a/tex/context/base/mkiv/publ-ini.lua b/tex/context/base/mkiv/publ-ini.lua
index 99a37e8b9..038a15d5a 100644
--- a/tex/context/base/mkiv/publ-ini.lua
+++ b/tex/context/base/mkiv/publ-ini.lua
@@ -362,7 +362,7 @@ local listtolist = nil
do
- local initialize = nil
+ local initialize = nil -- we delay
initialize = function(t)
usedentries = allocate { }
@@ -370,77 +370,75 @@ do
listtocite = allocate { }
listtolist = allocate { }
local names = { }
- local internals = structures.references.internals
local p_collect = (C(R("09")^1) * Carg(1) / function(s,entry) listtocite[tonumber(s)] = entry end + P(1))^0
local nofunique = 0
local nofreused = 0
- for i=1,#internals do
- local entry = internals[i]
- if entry then
- local metadata = entry.metadata
- if metadata then
- local kind = metadata.kind
- if kind == "full" then
- -- reference (in list)
- local userdata = entry.userdata
- if userdata then
- local tag = userdata.btxref
- if tag then
- local set = userdata.btxset or v_default
- local s = usedentries[set]
- if s then
- local u = s[tag]
- if u then
- u[#u+1] = entry
- else
- s[tag] = { entry }
- end
- nofreused = nofreused + 1
+ -- local internals = references.sortedinternals -- todo: when we need it more than once
+ -- for i=1,#internals do -- but currently we don't do this when not
+ -- local entry = internals[i] -- needed anyway so ...
+ local internals = structures.references.internals
+ for i, entry in sortedhash(internals) do
+ local metadata = entry.metadata
+ if metadata then
+ local kind = metadata.kind
+ if kind == "full" then
+ -- reference (in list)
+ local userdata = entry.userdata
+ if userdata then
+ local tag = userdata.btxref
+ if tag then
+ local set = userdata.btxset or v_default
+ local s = usedentries[set]
+ if s then
+ local u = s[tag]
+ if u then
+ u[#u+1] = entry
else
- usedentries[set] = { [tag] = { entry } }
- nofunique = nofunique + 1
+ s[tag] = { entry }
end
- -- alternative: collect prev in group
- local int = tonumber(userdata.btxint)
- if int then
- listtocite[int] = entry
- end
- local detail = datasets[set].details[tag]
--- todo: these have to be pluggable
- if detail then
- local author = detail.author
- if author then
- for i=1,#author do
- local a = author[i]
- local s = a.surnames
- if s then
- local c = concat(s,"+")
- local n = names[c]
- if n then
- n[#n+1] = a
- break
- else
- names[c] = { a }
- end
+ nofreused = nofreused + 1
+ else
+ usedentries[set] = { [tag] = { entry } }
+ nofunique = nofunique + 1
+ end
+ -- alternative: collect prev in group
+ local int = tonumber(userdata.btxint)
+ if int then
+ listtocite[int] = entry
+ end
+ local detail = datasets[set].details[tag]
+ -- todo: these have to be pluggable
+ if detail then
+ local author = detail.author
+ if author then
+ for i=1,#author do
+ local a = author[i]
+ local s = a.surnames
+ if s then
+ local c = concat(s,"+")
+ local n = names[c]
+ if n then
+ n[#n+1] = a
+ break
+ else
+ names[c] = { a }
end
end
end
end
end
end
- elseif kind == "btx" or kind == "userdata" then -- will go: kind == "userdata"
- -- list entry (each cite)
- local userdata = entry.userdata
- if userdata then
- local int = tonumber(userdata.btxint)
- if int then
- citetolist[int] = entry
- end
+ end
+ elseif kind == "btx" then
+ -- list entry (each cite)
+ local userdata = entry.userdata
+ if userdata then
+ local int = tonumber(userdata.btxint)
+ if int then
+ citetolist[int] = entry
end
end
end
- else
- -- weird
end
end
for k, v in sortedhash(names) do
@@ -459,7 +457,7 @@ do
end
end
if trace_detail then
- report("%s unique bibentries: %s reused entries",nofunique,nofreused)
+ report("%s unique references, %s reused entries",nofunique,nofreused)
end
initialize = nil
end
@@ -500,6 +498,7 @@ local findallused do
local todo = { }
local okay = { } -- only if mark
local allused = usedentries[dataset] or { }
+ -- local allused = usedentries[dataset] -- only test
local luadata = current.luadata
local details = current.details
local ordered = current.ordered
@@ -604,39 +603,40 @@ local findallused do
end
end
end
- else
- if find then
- tags = { }
- for i=1,#ordered do
- local entry = ordered[i]
- if find(entry) then
- local tag = entry.tag
- local parent = details[tag].parent
- if parent then
- tag = parent
- end
- tags[#tags+1] = tag
- todo[tag] = true
- end
- end
- if #tags == 0 and not reported[reference] then
- tags[1] = reference
- reported[reference] = true
- end
- else
- for i=1,#tags do
- local tag = tags[i]
+ elseif find then
+ tags = { }
+ for i=1,#ordered do
+ local entry = ordered[i]
+ if find(entry) then
+ local tag = entry.tag
local parent = details[tag].parent
if parent then
tag = parent
- tags[i] = tag
- end
- if luadata[tag] then
- todo[tag] = true
- elseif not reported[tag] then
- reported[tag] = true
- report_cite("non-existent entry %a in %a",tag,dataset)
end
+ tags[#tags+1] = tag
+ todo[tag] = true
+ -- okay[#okay+1] = entry -- only test
+ end
+ end
+ if #tags == 0 and not reported[reference] then
+ tags[1] = reference
+ reported[reference] = true
+ end
+ else
+ for i=1,#tags do
+ local tag = tags[i]
+ local parent = details[tag].parent
+ if parent then
+ tag = parent
+ tags[i] = tag
+ end
+ local entry = luadata[tag]
+ if entry then
+ todo[tag] = true
+ -- okay[#okay+1] = entry -- only test
+ elseif not reported[tag] then
+ reported[tag] = true
+ report_cite("non-existent entry %a in %a",tag,dataset)
end
end
end
@@ -2645,6 +2645,7 @@ do
local found, todo, list = findallused(dataset,reference,internal,method == v_text or method == v_always) -- also when not in list
--
if not found or #found == 0 then
+-- if not list or #list == 0 then
report("no entry %a found in dataset %a",reference,dataset)
elseif not setup then
report("invalid reference for %a",reference)
diff --git a/tex/context/base/mkiv/scrn-wid.lua b/tex/context/base/mkiv/scrn-wid.lua
index 2ed5b52eb..636d547da 100644
--- a/tex/context/base/mkiv/scrn-wid.lua
+++ b/tex/context/base/mkiv/scrn-wid.lua
@@ -21,6 +21,8 @@ if not modules then modules = { } end modules ['scrn-wid'] = {
-- sane person will create media rich pdf's as long as it's that unpredictable. Just
-- look at the specification and viewer preferences and decide.
+local next = next
+
interactions = interactions or { }
local interactions = interactions
diff --git a/tex/context/base/mkiv/scrp-ini.lua b/tex/context/base/mkiv/scrp-ini.lua
index a91a93970..d5cad643f 100644
--- a/tex/context/base/mkiv/scrp-ini.lua
+++ b/tex/context/base/mkiv/scrp-ini.lua
@@ -9,7 +9,7 @@ if not modules then modules = { } end modules ['scrp-ini'] = {
-- We need to rewrite this a bit ... rather old code ... will be done when japanese
-- is finished.
-local tonumber = tonumber
+local tonumber, next = tonumber, next
local trace_analyzing = false trackers.register("scripts.analyzing", function(v) trace_analyzing = v end)
local trace_injections = false trackers.register("scripts.injections", function(v) trace_injections = v end)
diff --git a/tex/context/base/mkiv/spac-hor.mkiv b/tex/context/base/mkiv/spac-hor.mkiv
index ba1b833ce..6c60be868 100644
--- a/tex/context/base/mkiv/spac-hor.mkiv
+++ b/tex/context/base/mkiv/spac-hor.mkiv
@@ -381,9 +381,9 @@
%D \macros
%D {frenchspacing,nonfrenchspacing}
%D
-%D Somehow \type{\frenchspacing} can lead to hyphenation between
-%D dashes so we now have \type {\newfrenchspacing} (moved from
-%D \type {syst-chr}).
+%D Somehow \type{\frenchspacing} can lead to hyphenation between dashes so we now
+%D have \type {\newfrenchspacing} (moved from \type {syst-chr}). Maybe it's not
+%D needed any more.
%D Hm ... todo:
diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv
index f3c12bed4..c529322e1 100644
--- a/tex/context/base/mkiv/spac-ver.mkiv
+++ b/tex/context/base/mkiv/spac-ver.mkiv
@@ -1548,6 +1548,17 @@
{%\gridsnappingtrue
\begincsname\??gridsnappers#1\endcsname}
+% maybe:
+%
+% \def\spac_grids_snap_value_set#1%
+% {%\gridsnappingtrue
+% \ifcsname\??gridsnappers#1\endcsname
+% \lastnamedcs
+% \else
+% \definegridsnapping[#1][#1]%
+% \begincsname\??gridsnappers#1\endcsname
+% \fi}
+
\def\spac_grids_snap_value_auto#1%
{\ifcsname\??gridsnappers#1\endcsname
\lastnamedcs
@@ -1578,35 +1589,41 @@
% min centers a box rounded downwards
% max centers a box rounded upwards
-%D We're not downward compatible with \MKII !
-
-\definegridsnapping[\v!normal] [\v!maxheight,\v!maxdepth,\v!strut]
-\definegridsnapping[\v!standard] [\v!maxheight,\v!maxdepth,\v!strut]
-\definegridsnapping[\v!yes] [\v!maxheight,\v!maxdepth,\v!strut]
-
-\definegridsnapping[\v!strict] [\v!maxdepth:0.8,\v!maxheight:0.8,\v!strut]
-\definegridsnapping[\v!tolerant] [\v!maxdepth:1.2,\v!maxheight:1.2,\v!strut]
-
-\definegridsnapping[\v!top] [\v!minheight,\v!maxdepth,\v!strut]
-\definegridsnapping[\v!bottom] [\v!maxheight,\v!mindepth,\v!strut]
-\definegridsnapping[\v!both] [\v!minheight,\v!mindepth,\v!strut]
-
-\definegridsnapping[\v!broad] [\v!maxheight,\v!maxdepth,\v!strut,0.8] % maybe 0.85
-\definegridsnapping[\v!fit] [\v!maxheight,\v!maxdepth,\v!strut,1.2] % tight 0.15
-
-\definegridsnapping[\v!first] [\v!first]
-\definegridsnapping[\v!last] [\v!last]
-\definegridsnapping[\v!high] [\v!minheight,\v!maxdepth,\v!none]
-\definegridsnapping[\v!one] [\v!minheight,\v!mindepth]
-\definegridsnapping[\v!low] [\v!maxheight,\v!mindepth,\v!none]
-\definegridsnapping[\v!none] [\v!none]
-\definegridsnapping[\v!line] [\v!line]
-\definegridsnapping[\v!strut] [\v!strut]
-\definegridsnapping[\v!box] [\v!box]
-\definegridsnapping[\v!min] [\v!min]
-\definegridsnapping[\v!max] [\v!max]
-
-\definegridsnapping[\v!middle] [\v!maxheight,\v!maxdepth] % used in placement
+%D We're not downward compatible with \MKII ! Not yet in interface file:
+
+\definegridsnapping[\v!normal] [\v!maxheight,\v!maxdepth,\v!strut]
+\definegridsnapping[\v!standard] [\v!maxheight,\v!maxdepth,\v!strut]
+\definegridsnapping[\v!yes] [\v!maxheight,\v!maxdepth,\v!strut]
+
+\definegridsnapping[\v!strict] [\v!maxdepth:0.8,\v!maxheight:0.8,\v!strut]
+\definegridsnapping[\v!tolerant] [\v!maxdepth:1.2,\v!maxheight:1.2,\v!strut]
+\definegridsnapping[\v!verytolerant] [\v!maxdepth:1.4,\v!maxheight:1.4,\v!strut]
+
+\definegridsnapping[\v!tolerant:10] [\v!maxdepth:1.1,\v!maxheight:1.1,\v!strut] % 10 pct tolerance
+\definegridsnapping[\v!tolerant:20] [\v!maxdepth:1.2,\v!maxheight:1.2,\v!strut] % 20 pct tolerance
+\definegridsnapping[\v!tolerant:30] [\v!maxdepth:1.3,\v!maxheight:1.3,\v!strut] % 30 pct tolerance
+\definegridsnapping[\v!tolerant:40] [\v!maxdepth:1.4,\v!maxheight:1.4,\v!strut] % 40 pct tolerance
+
+\definegridsnapping[\v!top] [\v!minheight,\v!maxdepth,\v!strut]
+\definegridsnapping[\v!bottom] [\v!maxheight,\v!mindepth,\v!strut]
+\definegridsnapping[\v!both] [\v!minheight,\v!mindepth,\v!strut]
+
+\definegridsnapping[\v!broad] [\v!maxheight,\v!maxdepth,\v!strut,0.8] % maybe 0.85
+\definegridsnapping[\v!fit] [\v!maxheight,\v!maxdepth,\v!strut,1.2] % tight 0.15
+
+\definegridsnapping[\v!first] [\v!first]
+\definegridsnapping[\v!last] [\v!last]
+\definegridsnapping[\v!high] [\v!minheight,\v!maxdepth,\v!none]
+\definegridsnapping[\v!one] [\v!minheight,\v!mindepth]
+\definegridsnapping[\v!low] [\v!maxheight,\v!mindepth,\v!none]
+\definegridsnapping[\v!none] [\v!none]
+\definegridsnapping[\v!line] [\v!line]
+\definegridsnapping[\v!strut] [\v!strut]
+\definegridsnapping[\v!box] [\v!box]
+\definegridsnapping[\v!min] [\v!min]
+\definegridsnapping[\v!max] [\v!max]
+
+\definegridsnapping[\v!middle] [\v!maxheight,\v!maxdepth] % used in placement
\definegridsnapping[\v!math] [\v!maxdepth:1.05,\v!maxheight:1.05,\v!strut] % experimental, maybe 1.1
\definegridsnapping[\v!math:\v!line] [\v!math,\v!line,\v!split]
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index de25dd503..7818625cd 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 8b8060c3f..afcb37ae4 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-blk.lua b/tex/context/base/mkiv/strc-blk.lua
index 0ababcfc0..492abc768 100644
--- a/tex/context/base/mkiv/strc-blk.lua
+++ b/tex/context/base/mkiv/strc-blk.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['strc-blk'] = {
-- this one runs on top of buffers and structure
-local type = type
+local type, next = type, next
local find, format, validstring = string.find, string.format, string.valid
local settings_to_set, settings_to_array = utilities.parsers.settings_to_set, utilities.parsers.settings_to_array
local allocate = utilities.storage.allocate
diff --git a/tex/context/base/mkiv/strc-enu.mkvi b/tex/context/base/mkiv/strc-enu.mkvi
index 8eff706bb..4680a3981 100644
--- a/tex/context/base/mkiv/strc-enu.mkvi
+++ b/tex/context/base/mkiv/strc-enu.mkvi
@@ -88,7 +88,7 @@
%\c!headcolor=,
%\c!titlecolor=,
\c!width=8\emwidth,
- \c!distance=\zeropoint,
+ %\c!distance=\zeropoint,
\c!distance=\emwidth,
\c!titledistance=.5\emwidth,
%\c!hang=,
@@ -111,7 +111,6 @@
\c!expansion=\v!no,
%\c!xmlsetup=,
%\s!catcodes=,
- %
\c!way=\v!by\v!text,
\c!prefix=\v!no,
\c!prefixconnector=.,
diff --git a/tex/context/base/mkiv/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 45d395f21..4f7d93645 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -141,6 +141,8 @@
\c!spaceafter=\v!big,
\c!sidespacebefore=\rootfloatparameter\c!spacebefore,
\c!sidespaceafter=\rootfloatparameter\c!spaceafter,
+ \c!spacebeforeside=, % extra, not part of, can be used to add whitespace before text
+ \c!spaceafterside=, % idem
\c!sidealign=\v!normal,
\c!textmethod=\ifgridsnapping2\else0\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
\c!sidemethod=\ifgridsnapping2\else1\fi, % 0=raw 1=safe (.99pg) 2=tight (-1pt) % THIS WILL CHANGE
@@ -737,6 +739,25 @@
% nicer is a bunch of states and one loop that sets those states
+\newdimen\d_strc_floats_margin
+\newdimen\d_strc_floats_top
+\newdimen\d_strc_floats_bottom
+%newdimen\d_strc_floats_top_side
+%newdimen\d_strc_floats_bottom_side
+
+\def\strc_floats_calculate_skip#target#skip%
+ {\begingroup
+ \edef\askedfloatskip{\rootfloatparameter#skip}%
+ \ifx\askedfloatskip\empty
+ \global#target\zeropoint
+ \else\ifx\askedfloatskip\v!none
+ \global#target\zeropoint
+ \else
+ \setbox\scratchbox\vbox{\whitespace\blank[\askedfloatskip]}% todo: move whitespace inside blank
+ \global#target\ht\scratchbox
+ \fi\fi
+ \endgroup}
+
\def\strc_floats_analyze_variables_two
{\ifinsidecolumns
\global\setfalse\c_strc_floats_par_float
@@ -745,13 +766,36 @@
{\global\settrue \c_strc_floats_par_float}%
{\global\setfalse\c_strc_floats_par_float}%
\fi
- \global\d_page_sides_shift \zeropoint
- \global\d_page_sides_maximum \zeropoint
- \global\c_page_sides_method \floatparameter\c!sidemethod
- \global\c_page_one_float_method \floatparameter\c!textmethod
- \global\c_page_sides_align \zerocount
- \global\c_strc_floats_rotation \zerocount
- \strc_floats_calculate_skips
+ % variable initializations
+ \global\d_page_sides_shift \zeropoint
+ \global\d_page_sides_maximum \zeropoint
+ \global\c_page_sides_align \zerocount
+ \global\c_strc_floats_rotation \zerocount
+ \global\d_strc_floats_margin \rootfloatparameter\c!margin
+ \global\d_page_sides_leftshift \floatparameter \c!leftmargindistance
+ \global\d_page_sides_rightshift \floatparameter \c!rightmargindistance
+ \global\d_page_sides_topoffset \floatparameter \c!topoffset
+ \global\d_page_sides_bottomoffset\floatparameter \c!bottomoffset
+ \global\c_page_sides_method \floatparameter \c!sidemethod
+ \global\c_page_one_float_method \floatparameter \c!textmethod
+ \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop
+ \global\c_page_floats_n_of_bottom\rootfloatparameter\c!nbottom
+ \ifconditional\c_strc_floats_par_float
+ \global\d_strc_floats_top \zeropoint
+ \global\d_strc_floats_bottom \zeropoint
+ %\strc_floats_calculate_skip\d_strc_floats_top_side \c!spacebeforeside
+ %\strc_floats_calculate_skip\d_strc_floats_bottom_side\c!spaceafterside
+ \strc_floats_calculate_skip\d_page_sides_topskip \c!sidespacebefore
+ \strc_floats_calculate_skip\d_page_sides_bottomskip \c!sidespaceafter
+ \else
+ \global\d_page_sides_topskip \zeropoint
+ \global\d_page_sides_bottomskip \zeropoint
+ %\global\d_strc_floats_top_side \zeropoint
+ %\global\d_strc_floats_bottom_side\zeropoint
+ \strc_floats_calculate_skip\d_strc_floats_top \c!spacebefore
+ \strc_floats_calculate_skip\d_strc_floats_bottom\c!spaceafter
+ \fi
+ % keyword handling
\ifconditional\c_strc_floats_par_float
\processaction
[\floatparameter\c!sidealign]
@@ -769,12 +813,9 @@
\fi
\doifinset\v!high\floatlocation{\global\d_page_sides_topskip \zeropoint}%
\doifinset\v!low \floatlocation{\global\d_page_sides_bottomskip\zeropoint}%
- \doifinset\v!fit \floatlocation
- {\global\d_page_sides_topskip \zeropoint
- \global\d_page_sides_bottomskip\zeropoint
- \global\d_strc_floats_margin \zeropoint}%
- \global\advance\d_page_sides_topskip \floatparameter\c!topoffset
- \global\advance\d_page_sides_bottomskip\floatparameter\c!bottomoffset
+ \doifinset\v!fit \floatlocation{\global\d_page_sides_topskip \zeropoint
+ \global\d_page_sides_bottomskip\zeropoint
+ \global\d_strc_floats_margin \zeropoint}%
\else
\processallactionsinset
[\floatlocation]%
@@ -799,7 +840,12 @@
\letfloatcaptionparameter\c!rightmargin\effectiverightskip}%
\ifemptyfloatcaption \ifnofloatnumber
\global\nofloatcaptiontrue
- \fi \fi}
+ \fi \fi
+ % more variable initializations
+ \ifconditional\c_strc_floats_par_float
+ \global\advance\d_page_sides_topskip \d_page_sides_topoffset
+ \global\advance\d_page_sides_bottomskip\d_page_sides_bottomoffset
+ \fi}
% documenteren in details
@@ -1164,34 +1210,6 @@
\unexpanded\def\placefloats
{\page_otr_command_flush_floats}
-\newdimen\d_strc_floats_margin
-\newdimen\d_strc_floats_top
-\newdimen\d_strc_floats_bottom
-
-\def\strc_floats_calculate_skip#target#skip%
- {\edef\askedfloatskip{#skip}%
- \ifx\askedfloatskip\empty
- \global#target\zeropoint
- \else\ifx\askedfloatskip\v!none
- \global#target\zeropoint
- \else
- \setbox\scratchbox\vbox{\whitespace\blank[\askedfloatskip]}% todo: move whitespace inside blank
- \global#target\ht\scratchbox
- \fi\fi}
-
-\def\strc_floats_calculate_skips
- {\begingroup
- \strc_floats_calculate_skip\d_strc_floats_top {\rootfloatparameter\c!spacebefore }%
- \strc_floats_calculate_skip\d_strc_floats_bottom {\rootfloatparameter\c!spaceafter }%
- \strc_floats_calculate_skip\d_page_sides_topskip {\rootfloatparameter\c!sidespacebefore}%
- \strc_floats_calculate_skip\d_page_sides_bottomskip{\rootfloatparameter\c!sidespaceafter }%
- \global\d_strc_floats_margin \rootfloatparameter\c!margin
- \global\d_page_sides_leftshift \floatparameter \c!leftmargindistance
- \global\d_page_sides_rightshift \floatparameter \c!rightmargindistance
- \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop
- \global\c_page_floats_n_of_bottom\rootfloatparameter\c!nbottom
- \endgroup}
-
\unexpanded\def\betweenfloatblanko % assumes that spaceafter is present
{\blank[\rootfloatparameter\c!spacebefore]} % or v!back,....
diff --git a/tex/context/base/mkiv/strc-itm.mkvi b/tex/context/base/mkiv/strc-itm.mkvi
index 6d9ab7b46..0bea62de8 100644
--- a/tex/context/base/mkiv/strc-itm.mkvi
+++ b/tex/context/base/mkiv/strc-itm.mkvi
@@ -448,6 +448,7 @@
\setvalue{\??itemgroupkeyword\v!serried }{\edef\itemgroupfirst{-\ifx\itemgroupfirst\empty1\else\itemgroupfirst\fi}%
\letitemgroupparameter\c!factor\itemgroupfirst}
\setvalue{\??itemgroupkeyword\v!stopper }{\letitemgroupparameter\c!placestopper\v!yes} % keep {}
+\setvalue{\??itemgroupkeyword\v!nostopper }{\letitemgroupparameter\c!placestopper\v!no} % keep {}
\setvalue{\??itemgroupkeyword\v!repeat }{\settrue\c_strc_itemgroups_repeat}
\setvalue{\??itemgroupkeyword\v!norepeat }{\setfalse\c_strc_itemgroups_repeat}
\setvalue{\??itemgroupkeyword\v!reverse }{\settrue\c_strc_itemgroups_reverse}
@@ -1131,19 +1132,21 @@
\strc_itemgroups_margin_symbol
\let\strc_itemgroups_margin_symbol\relax
\dostarttagged\t!itemcontent\empty
- \strut
+ \begstrut % \strut
\nobreak % else problems with intext items
\seteffectivehsize % NEW !
\hskip\d_strc_itemgroups_signal % concat
\itemgroupparameter\c!command}
\unexpanded\def\stopitemgroupitem
- {\ifconditional\c_strc_itemgroups_text
+ {\ifhmode
+ \endstrut % new per 2017-12-15
+ \fi
+ \ifconditional\c_strc_itemgroups_text
% nothing
\else
\endgraf
\fi}
-
\unexpanded\def\startitemgrouphead
{\dosingleempty\strc_itemgroups_start_head}
@@ -1218,7 +1221,9 @@
\dotagsetitem\s!symbol}
\unexpanded\def\strc_itemgroups_start_dummy
- {\strc_itemgroups_start_symbol\strut\strut} % two ?
+ {\strc_itemgroups_start_symbol
+ %\strut\strut} % two ?
+ \begstrut}
\unexpanded\def\strc_itemgroups_start_subitem
{\settrue\c_strc_itemgroups_sub
diff --git a/tex/context/base/mkiv/strc-lst.lua b/tex/context/base/mkiv/strc-lst.lua
index be8e07112..a235fac75 100644
--- a/tex/context/base/mkiv/strc-lst.lua
+++ b/tex/context/base/mkiv/strc-lst.lua
@@ -15,7 +15,7 @@ if not modules then modules = { } end modules ['strc-lst'] = {
--
-- move more to commands
-local tonumber, type = tonumber, type
+local tonumber, type, next = tonumber, type, next
local concat, insert, remove, sort = table.concat, table.insert, table.remove, table.sort
local lpegmatch = lpeg.match
diff --git a/tex/context/base/mkiv/strc-lst.mkvi b/tex/context/base/mkiv/strc-lst.mkvi
index b33ebc5d0..cefaa0e14 100644
--- a/tex/context/base/mkiv/strc-lst.mkvi
+++ b/tex/context/base/mkiv/strc-lst.mkvi
@@ -144,7 +144,8 @@
\def\strc_lists_inject_nop[#dummya][#dummyb]%
{\endgroup}
-\unexpanded\def\strc_lists_inject_enhance#listindex#internal%
+% \unexpanded
+\def\strc_lists_inject_enhance#listindex#internal%
{\normalexpanded{\ctxlatecommand{enhancelist(\number#listindex)}}}
\unexpanded\def\strc_lists_inject_yes[#settings][#userdata]% can be used directly
diff --git a/tex/context/base/mkiv/strc-mat.mkiv b/tex/context/base/mkiv/strc-mat.mkiv
index 20a639fa3..c6b277991 100644
--- a/tex/context/base/mkiv/strc-mat.mkiv
+++ b/tex/context/base/mkiv/strc-mat.mkiv
@@ -46,6 +46,7 @@
\c!indentnext=\v!no,
\c!alternative=\s!default,
\c!strut=\v!no,
+ \c!numberstrut=\v!yes, % \v!no \v!yes \v!always
\c!distance=2\emwidth]
\setupformulaframed
@@ -236,11 +237,14 @@
\global\setfalse\c_strc_formulas_inside_place_sub
\to \everyresetformulas
+\def\strc_formulas_place_number_noneed
+ {\doif{\formulaparameter\c!numberstrut}\v!always\strut}
+
\def\strc_formulas_place_numbering % place formula
{\settrue\c_strc_formulas_handle_number
\strc_formulas_check_reference\c_strc_formulas_place_number_mode\currentplaceformulareference
\ifnum\c_strc_formulas_place_number_mode=\plustwo
- \glet\strc_formulas_place_number\relax
+ \glet\strc_formulas_place_number\strc_formulas_place_number_noneed
\else
\glet\strc_formulas_place_number\strc_formulas_place_number_indeed
\fi
@@ -281,7 +285,12 @@
\begingroup
\useformulastyleandcolor\c!numberstyle\c!numbercolor
\formulaparameter\c!numbercommand
- {\strut
+ {\edef\p_strut{\formulaparameter\c!numberstrut}%
+ \ifx\p_strut\v!always
+ \strut
+ \else\ifx\p_strut\v!yes
+ \strut
+ \fi\fi
\formulaparameter\c!left
\namedtaggedlabeltexts
\t!formulalabel \v!formula
diff --git a/tex/context/base/mkiv/strc-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi
index 70a1d5ce8..a1c44bce8 100644
--- a/tex/context/base/mkiv/strc-not.mkvi
+++ b/tex/context/base/mkiv/strc-not.mkvi
@@ -1550,6 +1550,16 @@
\let\flushnotes\relax
+\unexpanded\def\startpostponingnotes % experimental, page-mix
+ {\ifconditional\postponingnotes\else
+ \global\settrue\postponingnotes
+ %\global\let\flushnotes\doflushnotes
+ \clf_postponenotes
+ \fi}
+
+\unexpanded\def\stoppostponingnotes % experimental, page-mix
+ {\doflushnotes}
+
\unexpanded\def\doflushnotes
{\ifconditional\postponingnotes
\begingroup
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 75b66fd7b..73f1ca886 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -16,7 +16,7 @@ if not modules then modules = { } end modules ['strc-ref'] = {
local format, find, gmatch, match, strip = string.format, string.find, string.gmatch, string.match, string.strip
local floor = math.floor
-local rawget, tonumber, type = rawget, tonumber, type
+local rawget, tonumber, type, next = rawget, tonumber, type, next
local lpegmatch = lpeg.match
local insert, remove, copytable = table.insert, table.remove, table.copy
local formatters = string.formatters
diff --git a/tex/context/base/mkiv/strc-reg.lua b/tex/context/base/mkiv/strc-reg.lua
index e4bf0852c..51771e3b8 100644
--- a/tex/context/base/mkiv/strc-reg.lua
+++ b/tex/context/base/mkiv/strc-reg.lua
@@ -387,6 +387,7 @@ local function initializer()
end
end
end
+ -- references.sortedinternals = sortedkeys(internalreferences) -- todo: when we need it more than once
end
local function finalizer()
diff --git a/tex/context/base/mkiv/strc-sec.mkiv b/tex/context/base/mkiv/strc-sec.mkiv
index ef7e9108a..b4b9568fc 100644
--- a/tex/context/base/mkiv/strc-sec.mkiv
+++ b/tex/context/base/mkiv/strc-sec.mkiv
@@ -671,6 +671,7 @@
\newconditional\c_strc_sectioning_place
\newconditional\c_strc_sectioning_empty
\newconditional\c_strc_sectioning_hidden
+\newconditional\c_strc_sectioning_section
\newconditional\headshownumber % public
\newconditional\headisdisplay % public
@@ -701,22 +702,32 @@
\setvalue{\??headplace\v!yes}%
{\setfalse\c_strc_sectioning_empty
\settrue \c_strc_sectioning_place
- \setfalse\c_strc_sectioning_hidden}
+ \setfalse\c_strc_sectioning_hidden
+ \setfalse\c_strc_sectioning_section}
\setvalue{\??headplace\v!empty}%
{\settrue \c_strc_sectioning_empty
\settrue \c_strc_sectioning_place
- \setfalse\c_strc_sectioning_hidden}
+ \setfalse\c_strc_sectioning_hidden
+ \setfalse\c_strc_sectioning_section}
\setvalue{\??headplace\v!no}%
{\settrue \c_strc_sectioning_empty
\setfalse\c_strc_sectioning_place
- \setfalse\c_strc_sectioning_hidden}
+ \setfalse\c_strc_sectioning_hidden
+ \setfalse\c_strc_sectioning_section}
\setvalue{\??headplace\v!hidden}%
{\settrue \c_strc_sectioning_empty
\setfalse\c_strc_sectioning_place
- \settrue \c_strc_sectioning_hidden}
+ \settrue \c_strc_sectioning_hidden
+ \setfalse\c_strc_sectioning_section}
+
+\setvalue{\??headplace\v!section}%
+ {\settrue \c_strc_sectioning_empty
+ \setfalse\c_strc_sectioning_place
+ \settrue \c_strc_sectioning_hidden
+ \settrue \c_strc_sectioning_section}
\unexpanded\def\strc_sectioning_initialize_placement
{\expandnamespaceparameter\??headplace\headparameter\c!placehead\v!yes}
@@ -758,7 +769,8 @@
% so we need a 'keep track of raw set option' (or maybe a funny internal prefix)
\unexpanded\def\setheadmarking % li:: so that we can use \marking[section]{Taco needed this}
- {\normalexpanded{\setmarking[\currenthead]{li::\currentstructurelistnumber}}}
+ {\strc_sectioning_delayed_flush
+ \normalexpanded{\setmarking[\currenthead]{li::\currentstructurelistnumber}}}
\let\deepstructurenumbercommand\relax
\let\deepstructuretitlecommand \relax
@@ -879,7 +891,11 @@
\strc_sectioning_report
\dostarttagged\t!sectioncaption\empty
\let\getheadsyncs\theheadsynchonization
- \strc_rendering_place_head_hidden % only something when tracing
+ \ifconditional\c_strc_sectioning_section
+ \strc_rendering_place_head_section
+ \else
+ \strc_rendering_place_head_hidden % only something when tracing
+ \fi
\dostoptagged
\else
\strc_sectioning_before_nop % toegevoegd ivm subpaginanr / tug sheets
@@ -907,7 +923,11 @@
\strc_sectioning_report
\let\getheadsyncs\theheadsynchonization
\dostarttagged\t!sectioncaption\empty
- \strc_rendering_place_head_hidden % only something when tracing
+ \ifconditional\c_strc_sectioning_section
+ \strc_rendering_place_head_section
+ \else
+ \strc_rendering_place_head_hidden % only something when tracing
+ \fi
\dostoptagged
\else
% do nothing / should be vbox to 0pt
@@ -953,6 +973,20 @@
% todo: when in the page builder we need to resolve the marking immediately
% because otherwise we have an async
+\newbox\b_sectioning_delayed
+
+\def\strc_sectioning_delayed_flush
+ {\ifvoid\b_sectioning_delayed\else
+ \smashboxed\b_sectioning_delayed
+ \fi}
+
+\unexpanded\def\strc_rendering_place_head_section % see hidden below
+ {\global\setbox\b_sectioning_delayed\hpack\bgroup
+ \setmarking[\currentheadcoupling]{li::\currentstructurelistnumber}%
+ \hpack\headreferenceattributes{}%
+ \currentstructuresynchronize
+ \egroup}
+
\unexpanded\def\strc_rendering_place_head_hidden % maybe trialtypesetting check
{\setxvalue{\??hiddenheadattr\currenthead}%
{\headreferenceattributes}% can be used when making a box
diff --git a/tex/context/base/mkiv/strc-syn.mkiv b/tex/context/base/mkiv/strc-syn.mkiv
index 85398106d..8d609e425 100644
--- a/tex/context/base/mkiv/strc-syn.mkiv
+++ b/tex/context/base/mkiv/strc-syn.mkiv
@@ -162,9 +162,9 @@
%c!hang=,
%c!sample=,
\c!margin=\v!no,
- \c!before=\blank,
+ \c!before=\startpacked,
\c!inbetween=\blank,
- \c!after=\blank,
+ \c!after=\stoppacked,
%c!indentnext=,
%c!indenting=,
%
@@ -424,8 +424,9 @@
{\strc_constructions_initialize{#1}%
\setupcurrentsimplelist[#2]%
\let\synonymentry\strc_synonym_normal
- \startpacked
- \clf_processsynonyms
+ % so we can hook tabulate into before and after
+ \normalexpanded{\simplelistparameter\c!before
+ \noexpand\clf_processsynonyms
{#1}%
{%
criterium {\simplelistparameter\c!criterium}%
@@ -433,7 +434,8 @@
method {\simplelistparameter\c!method}%
}%
\relax
- \stoppacked}%
+ \simplelistparameter\c!after}%
+ \relax}%
{}% todo: message that invalid
\endgroup}
@@ -467,8 +469,8 @@
%\c!command=, % we test for defined !
%\c!criterium=,
%\c!style=,
- %\c!before=,
- \c!after=\endgraf,
+ \c!before=\startpacked,
+ \c!after=\stoppacked,
%\c!expansion=,
\c!method=]
@@ -596,6 +598,7 @@
\unexpanded\def\placelistofsorts
{\dodoubleempty\strc_sorting_place_list}
+
\def\strc_sorting_place_list[#1][#2]%
{\begingroup
\edef\currentsimplelist{#1}%
@@ -607,8 +610,9 @@
\else
\let\synonymentry\strc_sorting_command
\fi
- \startpacked
- \clf_processsynonyms
+ % so we can hook tabulate into before and after
+ \normalexpanded{\simplelistparameter\c!before
+ \noexpand\clf_processsynonyms
{#1}%
{%
criterium {\simplelistparameter\c!criterium}%
@@ -616,7 +620,7 @@
method {\simplelistparameter\c!method}%
}%
\relax
- \stoppacked
+ \simplelistparameter\c!after}%
\endgroup}
\unexpanded\def\completelistofsorts
diff --git a/tex/context/base/mkiv/supp-box.lua b/tex/context/base/mkiv/supp-box.lua
index fc8ad1ae4..1193c30b6 100644
--- a/tex/context/base/mkiv/supp-box.lua
+++ b/tex/context/base/mkiv/supp-box.lua
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['supp-box'] = {
local report_hyphenation = logs.reporter("languages","hyphenation")
-local tonumber = tonumber
+local tonumber, next, type = tonumber, next, type
local lpegmatch = lpeg.match
diff --git a/tex/context/base/mkiv/supp-box.mkiv b/tex/context/base/mkiv/supp-box.mkiv
index eb824ee31..b2a29b3be 100644
--- a/tex/context/base/mkiv/supp-box.mkiv
+++ b/tex/context/base/mkiv/supp-box.mkiv
@@ -79,6 +79,7 @@
\def\strutht {\ht\strutbox}
\def\strutwd {\wd\strutbox}
\def\struthtdp{\dimexpr\ht\strutbox+\dp\strutbox\relax}
+\def\strutgap {\dimexpr\ht\strutbox-\dp\strutbox\relax}
%D \macros
%D {voidbox,nextbox}
@@ -2668,7 +2669,7 @@
%D A funny (but rather stupid) one, plus a redefinition.
\unexpanded\def\removebottomthings
- {\dorecurse5{\unskip\unkern\unpenalty}}
+ {\dorecurse\plusfive{\unskip\unkern\unpenalty}}
\unexpanded\def\removelastskip % \ifvmode the plain tex one \fi
{\ifvmode\ifzeropt\lastskip\else\vskip-\lastskip\fi\fi}
diff --git a/tex/context/base/mkiv/syst-aux.lua b/tex/context/base/mkiv/syst-aux.lua
index b5ebe1681..f88938686 100644
--- a/tex/context/base/mkiv/syst-aux.lua
+++ b/tex/context/base/mkiv/syst-aux.lua
@@ -11,7 +11,7 @@ if not modules then modules = { } end modules ['syst-aux'] = {
-- utfmatch(str,"(.?)(.*)$")
-- utf.sub(str,1,1)
-local tonumber = tonumber
+local tonumber, next = tonumber, next
local utfsub = utf.sub
local P, S, R, C, Cc, Cs, Carg, lpegmatch = lpeg.P, lpeg.S, lpeg.R, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Carg, lpeg.match
local next = next
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index 2c8263962..3480b03d1 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -345,6 +345,11 @@
\newbox \scratchboxfour \newbox \scratchboxfive \newbox \scratchboxsix
%D \macros
+%D {tempstring}
+
+\let\tempstring\empty
+
+%D \macros
%D {scratchwidth, scratchheight, scratchdepth, scratchoffset, scratchdistance}
%D
%D A few more scratch dimensions:
diff --git a/tex/context/base/mkiv/tabl-mis.mkiv b/tex/context/base/mkiv/tabl-mis.mkiv
index 2d88f3495..b2af1993e 100644
--- a/tex/context/base/mkiv/tabl-mis.mkiv
+++ b/tex/context/base/mkiv/tabl-mis.mkiv
@@ -165,7 +165,7 @@
\unexpanded\def\startparagraphs[#1]% quite slow
{\bgroup % (1)
\edef\currentparagraphs{#1}%
- \paragraphsparameter\c!before
+ % \paragraphsparameter\c!before
\edef\p_width{\paragraphsparameter\c!width}%
\ifx\p_width\empty
\d_typo_paragraphs_width\availablehsize
@@ -194,10 +194,14 @@
\parindent\zeropoint
\c_typo_paragraphs_n\zerocount
\let\\=\typo_paragraphs_next % downward compatible
- \dontleavehmode\inheritedparagraphsframed
+ \edef\p_offset{\paragraphsparameter\c!offset}%
+ \doifelsedimension\p_offset
+ {\scratchoffset\p_offset}%
+ {\scratchoffset\zeropoint}%
+ \setbox\scratchbox\hpack
\bgroup % (2)
\forgetall
- \advance\hsize-2\dimexpr\paragraphsparameter\c!offset\relax
+ \advance\hsize-2\scratchoffset
\let\typo_paragraphs_start_cell\typo_paragraphs_start_cell_indeed
\let\typo_paragraphs_stop_cell \typo_paragraphs_stop_cell_indeed
\typo_paragraphs_start_cell_indeed}
@@ -205,6 +209,9 @@
\unexpanded\def\stopparagraphs
{\stopparagraphscell
\egroup % (2)
+ \letparagraphsparameter\c!align\v!flushleft % normal
+ \paragraphsparameter\c!before
+ \dontleavehmode\inheritedparagraphsframed{\box\scratchbox}%
\paragraphsparameter\c!after
\egroup} % (1)
diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv
index edaf231e2..f80df82d7 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkiv
+++ b/tex/context/base/mkiv/tabl-tbl.mkiv
@@ -1033,6 +1033,7 @@
\appendtoks
\setuevalue{\e!start\currenttabulation}{\tabl_start_defined[\currenttabulation]}%
+ \letvalue{\e!stop\currenttabulation}\relax
\letvalue{\??tabulatehead\currenttabulation}\empty
\letvalue{\??tabulatefoot\currenttabulation}\empty
\to \everydefinetabulation
@@ -1072,7 +1073,7 @@
%\expandafter\ifx\lastnamedcs\empty
\let\tabl_tabulate_insert_foot\empty
\else
- \let\tabl_tabulate_insert_foot\tabl_tabulate_insert_head_content
+ \let\tabl_tabulate_insert_foot\tabl_tabulate_insert_foot_content
\fi
\else
\let\tabl_tabulate_insert_foot\empty
@@ -1196,7 +1197,7 @@
\unexpanded\def\tabl_tabulate_start_ignore
{\em Nested tabulate is not (yet) supported.\relax
- \expandafter\gobbleuntil\csname\e!stop\v!tabulate\endcsname}
+ \expandafter\gobbleuntil\csname\ifconditional\c_tabl_generic stoptabulate\else\e!stop\v!tabulate\fi\endcsname}
\appendtoks
\letvalue{\e!start\v!tabulate}\tabl_tabulate_start_ignore % only the main one
@@ -1337,7 +1338,7 @@
\d_tabl_tabulate_indent\dimexpr\leftskip+\hangindent\ifx\p_indenting\v!yes+\parindent\fi\relax
\global\c_tabl_tabulate_column\zerocount
\processcontent
- {\e!stop\ifx\currenttabulationparent\empty\v!tabulate\else\currenttabulationparent\fi}
+ {\ifconditional\c_tabl_generic stoptabulate\else\e!stop\ifx\currenttabulationparent\empty\v!tabulate\else\currenttabulationparent\fi\fi}
\tabl_tabulate_insert_body
\tabl_tabulate_process}
@@ -2678,11 +2679,21 @@
%D \stopwhatever
%D \stoptyping
-%D This is needed because we soemtimes use the english command in
+%D This is needed because we sometimes use the english command in
%D tracing macros. In fact, most detailed tracing macros that
%D are done with \LUA\ only work in the english interface anyway.
-\definetabulate[tabulate] \setuptabulate[tabulate][\c!format=\v!none] % so no \v! here
+% \definetabulate[tabulate] \setuptabulate[tabulate][\c!format=\v!none] % so no \v! here
+
+\newconditional\c_tabl_generic
+
+\unexpanded\setuvalue{starttabulate}%
+ {\bgroup % whole thing
+ \settrue\c_tabl_generic
+ \let\currenttabulationparent\empty
+ \dodoubleempty\tabl_start_regular}
+
+\letvalue{stoptabulate}\relax
%D The following helpers are just there because we also have them at the \LUA\ end:
%D
diff --git a/tex/context/base/mkiv/tabl-xtb.lua b/tex/context/base/mkiv/tabl-xtb.lua
index 0835576c7..524ca109c 100644
--- a/tex/context/base/mkiv/tabl-xtb.lua
+++ b/tex/context/base/mkiv/tabl-xtb.lua
@@ -128,7 +128,7 @@ function xtables.create(settings)
local widths = { }
local heights = { }
local depths = { }
- local spans = { }
+ -- local spans = { }
local distances = { }
local autowidths = { }
local modes = { }
@@ -143,7 +143,7 @@ function xtables.create(settings)
widths = widths,
heights = heights,
depths = depths,
- spans = spans,
+ -- spans = spans,
distances = distances,
modes = modes,
autowidths = autowidths,
@@ -250,9 +250,24 @@ function xtables.set_reflow_width()
local c = data.currentcolumn
local rows = data.rows
local row = rows[r]
+ local cold = c
while row[c].span do -- can also be previous row ones
c = c + 1
end
+ -- bah, we can have a span already
+ if c > cold then
+ local ro = row[cold]
+ local rx = ro.nx
+ local ry = ro.ny
+ if rx > 1 or ry > 1 then
+ local rn = row[c]
+ rn.nx = rx
+ rn.ny = ry
+ ro.nx = 1 -- or 0
+ ro.ny = 1 -- or 0
+ -- do we also need to set ro.span and rn.span
+ end
+ end
local tb = getbox("b_tabl_x")
local drc = row[c]
--
@@ -290,6 +305,8 @@ function xtables.set_reflow_width()
-- end
-- end
if drc.ny < 2 then
+ -- report_xtable("set width, old: ht=%p, dp=%p",heights[r],depths[r])
+ -- report_xtable("set width, new: ht=%p, dp=%p",height,depth)
if height > heights[r] then
heights[r] = height
end
@@ -306,11 +323,11 @@ function xtables.set_reflow_width()
local fixedcolumns = data.fixedcolumns
local fixedrows = data.fixedrows
if dimensionstate == 1 then
- if cspan > 1 then
- -- ignore width
- elseif width > fixedcolumns[c] then -- how about a span here?
- fixedcolumns[c] = width
- end
+ if cspan > 1 then
+ -- ignore width
+ elseif width > fixedcolumns[c] then -- how about a span here?
+ fixedcolumns[c] = width
+ end
elseif dimensionstate == 2 then
fixedrows[r] = height
elseif dimensionstate == 3 then
@@ -360,7 +377,7 @@ function xtables.set_reflow_width()
--
local nx, ny = drc.nx, drc.ny
if nx > 1 or ny > 1 then
- local spans = data.spans
+ -- local spans = data.spans -- not used
local self = true
for y=1,ny do
for x=1,nx do
@@ -369,9 +386,9 @@ function xtables.set_reflow_width()
else
local ry = r + y - 1
local cx = c + x - 1
- if y > 1 then
- spans[ry] = true
- end
+ -- if y > 1 then
+ -- spans[ry] = true -- not used
+ -- end
rows[ry][cx].span = true
end
end
@@ -432,13 +449,17 @@ function xtables.set_reflow_height()
--
if drc.ny < 2 then
if data.fixedrows[r] == 0 then -- and drc.dimensionstate < 2
- local heights = data.heights
- local depths = data.depths
- if height > heights[r] then
- heights[r] = height
- end
- if depth > depths[r] then
- depths[r] = depth
+ if drc.ht + drc.dp <= height + depth then -- new per 2017-12-15
+ local heights = data.heights
+ local depths = data.depths
+ -- report_xtable("set height, old: ht=%p, dp=%p",heights[r],depths[r])
+ -- report_xtable("set height, new: ht=%p, dp=%p",height,depth)
+ if height > heights[r] then
+ heights[r] = height
+ end
+ if depth > depths[r] then
+ depths[r] = depth
+ end
end
end
end
@@ -471,7 +492,7 @@ function xtables.initialize_construct()
--
local width = widths[c]
local height = heights[r]
- local depth = depths[r]
+ local depth = depths[r] -- problem: can be the depth of a one liner
--
for x=1,drc.nx-1 do
width = width + widths[c+x]
@@ -518,7 +539,6 @@ function xtables.reflow_width()
local nofrows = data.nofrows
local nofcolumns = data.nofcolumns
local rows = data.rows
--- inspect(rows)
for r=1,nofrows do
local row = rows[r]
for c=1,nofcolumns do
@@ -550,8 +570,7 @@ function xtables.reflow_width()
showwidths("stage 1",widths,autowidths)
end
local noffrozen = 0
--- here we can also check spans
- -- inspect(data.fixedcspans)
+ -- here we can also check spans
if options[v_max] then
for c=1,nofcolumns do
width = width + widths[c]
@@ -676,8 +695,6 @@ function xtables.reflow_width()
--
data.currentrow = 0
data.currentcolumn = 0
- --
--- inspect(data)
end
function xtables.reflow_height()
@@ -738,8 +755,6 @@ function xtables.reflow_height()
end
end
end
- --
--- inspect(data)
end
local function showspans(data)
@@ -769,7 +784,7 @@ function xtables.construct()
local heights = data.heights
local depths = data.depths
local widths = data.widths
- local spans = data.spans
+ -- local spans = data.spans
local distances = data.distances
local modes = data.modes
local settings = data.settings
@@ -1171,7 +1186,6 @@ function xtables.cleanup()
-- end
-- end
-- data.result = nil
- -- inspect(data)
data = table.remove(stack)
end
diff --git a/tex/context/base/mkiv/tabl-xtb.mkvi b/tex/context/base/mkiv/tabl-xtb.mkvi
index 24b004b2b..dc4a30e2b 100644
--- a/tex/context/base/mkiv/tabl-xtb.mkvi
+++ b/tex/context/base/mkiv/tabl-xtb.mkvi
@@ -140,8 +140,12 @@
\c!autostrut=\v!no,
\c!split=\v!auto, % a number will take that many lines
\c!splitoffset=\zeropoint, % extra space taken
- % \c!aligncharacter=\v!no,
- % \c!alignmentcharacter={,},
+ \c!aligncharacter=\v!no,
+ \c!alignmentcharacter={,},
+ \c!alignmentleftsample=,
+ \c!alignmentrightsample=,
+ \c!alignmentleftwidth=\zeropoint,
+ \c!alignmentrightwidth=\zeropoint,
% \c!option=, % \v!stretch {\v!stretch,\v!width}
% \c!footer=,
% \c!header=,
@@ -335,6 +339,7 @@
\clf_x_table_cleanup
\dostoptagged
\resetbuffer[\tabl_x_current_buffer]%
+ \resetcharacteralign
\egroup}
% text flow split modes
@@ -480,8 +485,50 @@
{\tabl_x_start_cell_nop
\tabl_x_stop_cell}
+% \unexpanded\def\tabl_x_begin_of_cell
+% {%\inhibitblank % already in framed
+% \everypar{\delayedbegstrut}}
+
+\def\tabl_x_setup_character_align
+ {\edef\p_left {\directxtableparameter\c!alignmentleftsample}%
+ \edef\p_right{\directxtableparameter\c!alignmentrightsample}%
+ \ifx\p_left\empty
+ \scratchdimenone\dimexpr\directxtableparameter\c!alignmentleftwidth\relax
+ \else
+ \setbox\scratchbox\hbox{\p_left}%
+ \scratchdimenone\wd\scratchbox
+ \fi
+ \ifx\p_right\empty
+ \scratchdimentwo\dimexpr\directxtableparameter\c!alignmentrightwidth\relax
+ \else
+ \setbox\scratchbox\hbox{\p_right}%
+ \scratchdimentwo\wd\scratchbox
+ \fi
+ \clf_setcharacteraligndetail
+ \clf_x_table_c
+ {\directxtableparameter\c!alignmentcharacter}%
+ \scratchdimenone
+ \scratchdimentwo
+ \relax}
+
+\newtoks\t_tabl_x_every_cell
+
+% \appendtoks
+% \inhibitblank % already in framed
+% \to \t_tabl_x_every_cell
+
+\appendtoks
+ \edef\p_characteralign{\directxtableparameter\c!aligncharacter}%
+ \ifx\p_characteralign\v!yes
+ \ifcase\clf_x_table_r\or
+ \tabl_x_setup_character_align
+ \fi
+ \signalcharacteralign\clf_x_table_c\clf_x_table_r
+ \fi
+\to \t_tabl_x_every_cell
+
\unexpanded\def\tabl_x_begin_of_cell
- {%\inhibitblank % already in framed
+ {\the\t_tabl_x_every_cell
\everypar{\delayedbegstrut}}
\unexpanded\def\tabl_x_end_of_cell
@@ -519,7 +566,7 @@
\let\tabl_x_set_hsize\relax
\unexpanded\def\tabl_x_start_cell_reflow_width_yes[#settings]%
- {\setbox\b_tabl_x\hbox\bgroup
+ {\setbox\b_tabl_x\hpack\bgroup
\ifnum\c_tabl_x_nesting>\plusone
\letxtableparameter\c!width \v!fit % overloads given width
\letxtableparameter\c!height\v!fit % overloads given height
@@ -548,7 +595,7 @@
\tabl_x_set_hsize}
\unexpanded\def\tabl_x_start_cell_reflow_width_nop
- {\setbox\b_tabl_x\hbox\bgroup
+ {\setbox\b_tabl_x\hpack\bgroup
\ifnum\c_tabl_x_nesting>\plusone
\letxtableparameter\c!width \v!fit % overloads given width
\letxtableparameter\c!height\v!fit % overloads given height
@@ -568,7 +615,7 @@
\clf_x_table_set_reflow_width}
\unexpanded\def\tabl_x_start_cell_reflow_height_yes[#settings]%
- {\setbox\b_tabl_x\hbox\bgroup
+ {\setbox\b_tabl_x\hpack\bgroup
\clf_x_table_init_reflow_height
\ifcase\c_tabl_x_skip_mode % can be sped up
\ifnum\c_tabl_x_nesting>\plusone
@@ -582,7 +629,7 @@
\fi}
\unexpanded\def\tabl_x_start_cell_reflow_height_nop
- {\setbox\b_tabl_x\hbox\bgroup
+ {\setbox\b_tabl_x\hpack\bgroup
\clf_x_table_init_reflow_height
\ifcase\c_tabl_x_skip_mode % can be sped up
\ifnum\c_tabl_x_nesting>\plusone
@@ -604,7 +651,7 @@
\unexpanded\def\tabl_x_start_cell_construct_yes[#settings]%
{\dostarttagged\t!tablecell\empty % can't we just tag the box
- \setbox\b_tabl_x\hbox\bgroup
+ \setbox\b_tabl_x\hpack\bgroup
\setupcurrentxtable[#settings]%
\letxtableparameter\c!width \d_tabl_x_width % overloads given width
\letxtableparameter\c!height\d_tabl_x_height % overloads given height
@@ -615,7 +662,7 @@
\unexpanded\def\tabl_x_start_cell_construct_nop
{\dostarttagged\t!tablecell\empty % can't we just tag the box
- \setbox\b_tabl_x\hbox\bgroup
+ \setbox\b_tabl_x\hpack\bgroup
\letxtableparameter\c!width \d_tabl_x_width % overloads given width
\letxtableparameter\c!height\d_tabl_x_height % overloads given height (commenting it ... nice option)
\clf_x_table_init_construct
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 1c21252f7..36b346342 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -71,7 +71,7 @@ appendaction("shipouts", "normalizers", "typesetters.showsuspects")
appendaction("shipouts", "normalizers", "typesetters.margins.finalhandler") -- disabled
------------("shipouts", "normalizers", "nodes.handlers.cleanuppage") -- disabled
appendaction("shipouts", "normalizers", "builders.paragraphs.expansion.trace") -- disabled
-appendaction("shipouts", "normalizers", "typesetters.alignments.handler")
+appendaction("shipouts", "normalizers", "typesetters.alignments.handler") -- disabled
appendaction("shipouts", "normalizers", "nodes.references.handler") -- disabled
appendaction("shipouts", "normalizers", "nodes.destinations.handler") -- disabled
appendaction("shipouts", "normalizers", "nodes.rules.handler") -- disabled
diff --git a/tex/context/base/mkiv/toks-ini.lua b/tex/context/base/mkiv/toks-ini.lua
index 312a8b318..36b47d0dd 100644
--- a/tex/context/base/mkiv/toks-ini.lua
+++ b/tex/context/base/mkiv/toks-ini.lua
@@ -9,6 +9,7 @@ tokens = tokens or { }
local tokens = tokens
local token = token -- the built in one
+local next = next
local tonumber = tonumber
local tostring = tostring
local utfchar = utf.char
diff --git a/tex/context/base/mkiv/trac-ctx.lua b/tex/context/base/mkiv/trac-ctx.lua
index 493ce7936..29159d130 100644
--- a/tex/context/base/mkiv/trac-ctx.lua
+++ b/tex/context/base/mkiv/trac-ctx.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['trac-ctx'] = {
license = "see context related readme files"
}
+local next = next
+
local context = context
local implement = interfaces.implement
local register = trackers.register
diff --git a/tex/context/base/mkiv/trac-fil.lua b/tex/context/base/mkiv/trac-fil.lua
index 8cc903e2a..f422c9f6b 100644
--- a/tex/context/base/mkiv/trac-fil.lua
+++ b/tex/context/base/mkiv/trac-fil.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['trac-fil'] = {
license = "see context related readme files"
}
-local rawset, tonumber, type, pcall = rawset, tonumber, type, pcall
+local rawset, tonumber, type, pcall, next = rawset, tonumber, type, pcall, next
local format, concat = string.format, table.concat
local openfile = io.open
local date = os.date
diff --git a/tex/context/base/mkiv/trac-lmx.lua b/tex/context/base/mkiv/trac-lmx.lua
index 4f4ea62c4..c7f949618 100644
--- a/tex/context/base/mkiv/trac-lmx.lua
+++ b/tex/context/base/mkiv/trac-lmx.lua
@@ -695,6 +695,8 @@ if arg then
if arg[1] == "--show" then if arg[2] then lmx.show (arg[2]) end
elseif arg[1] == "--convert" then if arg[2] then lmx.convert(arg[2], arg[3] or "temp.html") end
end
+else
+ return lmx
end
-- Test 1:
diff --git a/tex/context/base/mkiv/trac-pro.lua b/tex/context/base/mkiv/trac-pro.lua
index 897b6a15c..cbaae7f0c 100644
--- a/tex/context/base/mkiv/trac-pro.lua
+++ b/tex/context/base/mkiv/trac-pro.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['trac-pro'] = {
license = "see context related readme files"
}
-local getmetatable, setmetatable, rawset, type = getmetatable, setmetatable, rawset, type
+local getmetatable, setmetatable, rawset, type, next = getmetatable, setmetatable, rawset, type, next
-- The protection implemented here is probably not that tight but good enough to catch
-- problems due to naive usage.
diff --git a/tex/context/base/mkiv/trac-vis.lua b/tex/context/base/mkiv/trac-vis.lua
index 3822aa4a6..e5f657a30 100644
--- a/tex/context/base/mkiv/trac-vis.lua
+++ b/tex/context/base/mkiv/trac-vis.lua
@@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['trac-vis'] = {
}
local node, nodes, attributes, fonts, tex = node, nodes, attributes, fonts, tex
-local type, tonumber = type, tonumber
+local type, tonumber, next = type, tonumber, next
local gmatch = string.gmatch
local formatters = string.formatters
local compactfloat = number.compactfloat
@@ -121,21 +121,22 @@ local bor = bit32.bor
local enableaction = nodes.tasks.enableaction
-local trace_hbox
-local trace_vbox
-local trace_vtop
-local trace_kern
-local trace_glue
-local trace_penalty
-local trace_fontkern
-local trace_strut
-local trace_whatsit
-local trace_user
-local trace_math
-local trace_italic
-local trace_discretionary
-local trace_expansion
-local trace_line
+-- local trace_hbox
+-- local trace_vbox
+-- local trace_vtop
+-- local trace_kern
+-- local trace_glue
+-- local trace_penalty
+-- local trace_fontkern
+-- local trace_strut
+-- local trace_whatsit
+-- local trace_user
+-- local trace_math
+-- local trace_italic
+-- local trace_discretionary
+-- local trace_expansion
+-- local trace_line
+-- local trace_space
local report_visualize = logs.reporter("visualize")
@@ -162,10 +163,11 @@ local modes = {
discretionary = 32768,
expansion = 65536,
line = 131072,
+ space = 262144,
}
local usedfont, exheight, emwidth
-local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_italic, l_origin, l_discretionary, l_expansion, l_line
+local l_penalty, l_glue, l_kern, l_fontkern, l_hbox, l_vbox, l_vtop, l_strut, l_whatsit, l_glyph, l_user, l_math, l_italic, l_origin, l_discretionary, l_expansion, l_line, l_space
local enabled = false
local layers = { }
@@ -219,6 +221,7 @@ local function enable()
l_discretionary = layers.discretionary
l_expansion = layers.expansion
l_line = layers.line
+ l_space = layers.space
enableaction("shipouts","nodes.visualizers.handler")
report_visualize("enabled")
enabled = true
@@ -362,6 +365,7 @@ local c_negative = "trace:r"
local c_zero = "trace:g"
local c_text = "trace:s"
local c_space = "trace:y"
+local c_space_x = "trace:m"
local c_skip_a = "trace:c"
local c_skip_b = "trace:m"
local c_glyph = "trace:o"
@@ -377,6 +381,7 @@ local c_negative_d = "trace:dr"
local c_zero_d = "trace:dg"
local c_text_d = "trace:ds"
local c_space_d = "trace:dy"
+local c_space_x_d = "trace:dm"
local c_skip_a_d = "trace:dc"
local c_skip_b_d = "trace:dm"
local c_glyph_d = "trace:do"
@@ -405,7 +410,7 @@ local function sometext(str,layer,color,textcolor,lap) -- we can just paste verb
if lap then
info = new_hlist(setlink(new_kern(-width),info))
else
- info = new_hlist(info)
+ info = new_hlist(info) -- a bit overkill: double wrapped
end
if layer then
setattr(info,a_layer,layer)
@@ -413,6 +418,28 @@ local function sometext(str,layer,color,textcolor,lap) -- we can just paste verb
return info, width
end
+local function someblob(str,layer,color,textcolor,width)
+ local text = hpack_string(str,usedfont)
+ local size = getwidth(text)
+ local rule = new_rule(width,2*exheight,exheight/2)
+ local kern = new_kern(-width + (width-size)/2)
+ if color then
+ setcolor(rule,color)
+ end
+ if textcolor then
+ setlistcolor(getlist(text),textcolor)
+ end
+ local info = setlink(rule,kern,text)
+ setlisttransparency(info,c_zero)
+ info = hpack_nodes(info)
+ local width = getwidth(info)
+ info = new_hlist(info)
+ if layer then
+ setattr(info,a_layer,layer)
+ end
+ return info, width
+end
+
local caches = setmetatableindex("table")
local fontkern, italickern do
@@ -898,8 +925,8 @@ local ruledglue do
local gluecodes = nodes.gluecodes
local cleaders_code = gluecodes.cleaders
local userskip_code = gluecodes.userskip
- local space_code = gluecodes.space
- local xspace_code = gluecodes.xspace
+ local space_code = gluecodes.spaceskip
+ local xspace_code = gluecodes.xspaceskip
local leftskip_code = gluecodes.leftskip
local rightskip_code = gluecodes.rightskip
@@ -908,28 +935,28 @@ local ruledglue do
local tags = {
-- userskip = "US",
- lineskip = "LS",
- baselineskip = "BS",
- parskip = "PS",
- abovedisplayskip = "DA",
- belowdisplayskip = "DB",
- abovedisplayshortskip = "SA",
- belowdisplayshortskip = "SB",
- leftskip = "LS",
- rightskip = "RS",
- topskip = "TS",
- splittopskip = "ST",
- tabskip = "AS",
- spaceskip = "SS",
- xspaceskip = "XS",
- parfillskip = "PF",
- thinmuskip = "MS",
- medmuskip = "MM",
- thickmuskip = "ML",
- leaders = "NL",
- cleaders = "CL",
- xleaders = "XL",
- gleaders = "GL",
+ [gluecodes.lineskip] = "LS",
+ [gluecodes.baselineskip] = "BS",
+ [gluecodes.parskip] = "PS",
+ [gluecodes.abovedisplayskip] = "DA",
+ [gluecodes.belowdisplayskip] = "DB",
+ [gluecodes.abovedisplayshortskip] = "SA",
+ [gluecodes.belowdisplayshortskip] = "SB",
+ [gluecodes.leftskip] = "LS",
+ [gluecodes.rightskip] = "RS",
+ [gluecodes.topskip] = "TS",
+ [gluecodes.splittopskip] = "ST",
+ [gluecodes.tabskip] = "AS",
+ [gluecodes.spaceskip] = "SP",
+ [gluecodes.xspaceskip] = "XS",
+ [gluecodes.parfillskip] = "PF",
+ [gluecodes.thinmuskip] = "MS",
+ [gluecodes.medmuskip] = "MM",
+ [gluecodes.thickmuskip] = "ML",
+ [gluecodes.leaders] = "NL",
+ [gluecodes.cleaders] = "CL",
+ [gluecodes.xleaders] = "XL",
+ [gluecodes.gleaders] = "GL",
-- true = "VS",
-- false = "HS",
}
@@ -944,7 +971,7 @@ local ruledglue do
if info then
-- print("glue hit")
else
- if subtype == space_code or subtype == xspace_code then -- not yet all space
+ if subtype == space_code or subtype == xspace_code then
info = sometext(amount,l_glue,c_space)
elseif subtype == leftskip_code or subtype == rightskip_code then
info = sometext(amount,l_glue,c_skip_a)
@@ -969,6 +996,55 @@ local ruledglue do
return head, getnext(current)
end
+ -- ruledspace = function(head,current,parent)
+ -- local subtype = getsubtype(current)
+ -- if subtype == space_code or subtype == xspace_code then
+ -- local width = effectiveglue(current,parent)
+ -- local amount = formatters["%s:%0.3f"](tags[subtype] or "HS",width*pt_factor)
+ -- local info = g_cache_h[amount]
+ -- if info then
+ -- -- print("space hit")
+ -- else
+ -- info = sometext(amount,l_glue,c_space)
+ -- g_cache_h[amount] = info
+ -- end
+ -- info = copy_list(info)
+ -- head, current = insert_node_before(head,current,info)
+ -- return head, getnext(current)
+ -- else
+ -- return head, current
+ -- end
+ -- end
+
+ local g_cache_s = caches["space"]
+ local g_cache_x = caches["xspace"]
+
+ ruledspace = function(head,current,parent)
+ local subtype = getsubtype(current)
+ if subtype == space_code or subtype == xspace_code then -- not yet all space
+ local width = effectiveglue(current,parent)
+ local info
+ if subtype == space_code then
+ info = g_cache_s[width]
+ if not info then
+ info = someblob("SP",l_glue,c_space,nil,width)
+ g_cache_s[width] = info
+ end
+ else
+ info = g_cache_x[width]
+ if not info then
+ info = someblob("XS",l_glue,c_space_x,nil,width)
+ g_cache_x[width] = info
+ end
+ end
+ info = copy_list(info)
+ head, current = insert_node_before(head,current,info)
+ return head, getnext(current)
+ else
+ return head, current
+ end
+ end
+
end
local ruledkern do
@@ -1103,24 +1179,28 @@ do
local line_code = listcodes.line
local function visualize(head,vertical,forced,parent)
- local trace_hbox = false
- local trace_vbox = false
- local trace_vtop = false
- local trace_kern = false
- local trace_glue = false
- local trace_penalty = false
- local trace_fontkern = false
- local trace_strut = false
- local trace_whatsit = false
- local trace_glyph = false
- local trace_simple = false
- local trace_user = false
- local trace_math = false
- local trace_italic = false
- local trace_origin = false
- local current = head
- local previous = nil
- local attr = unsetvalue
+ local trace_hbox = false
+ local trace_vbox = false
+ local trace_vtop = false
+ local trace_kern = false
+ local trace_glue = false
+ local trace_penalty = false
+ local trace_fontkern = false
+ local trace_strut = false
+ local trace_whatsit = false
+ local trace_glyph = false
+ local trace_simple = false
+ local trace_user = false
+ local trace_math = false
+ local trace_italic = false
+ local trace_origin = false
+ local trace_discretionary = false
+ local trace_expansion = false
+ local trace_line = false
+ local trace_space = false
+ local current = head
+ local previous = nil
+ local attr = unsetvalue
local prev_trace_fontkern = nil
local prev_trace_italic = nil
local prev_trace_expansion = nil
@@ -1150,6 +1230,7 @@ do
trace_discretionary = false
trace_expansion = false
trace_line = false
+ trace_space = false
else -- dead slow:
trace_hbox = band(a, 1) ~= 0
trace_vbox = band(a, 2) ~= 0
@@ -1169,6 +1250,7 @@ do
trace_discretionary = band(a, 32768) ~= 0
trace_expansion = band(a, 65536) ~= 0
trace_line = band(a,131072) ~= 0
+ trace_space = band(a,262144) ~= 0
end
attr = a
end
@@ -1222,6 +1304,8 @@ do
setleader(current,visualize(content,false,nil,parent))
elseif trace_glue then
head, current = ruledglue(head,current,vertical,parent)
+ elseif trace_space then
+ head, current = ruledspace(head,current,parent)
end
elseif id == penalty_code then
if trace_penalty then
diff --git a/tex/context/base/mkiv/typo-dir.mkiv b/tex/context/base/mkiv/typo-dir.mkiv
index 03d2b4717..18914d37b 100644
--- a/tex/context/base/mkiv/typo-dir.mkiv
+++ b/tex/context/base/mkiv/typo-dir.mkiv
@@ -137,7 +137,7 @@
end
\stopluacode
-\def\biditest#1#2#3% font text raw
+\unexpanded\def\biditest#1#2#3% font text raw
{\dontleavehmode\hbox
{\framed[offset=overlay]{\tttf#2}\quad
\enabletrackers[typesetters.directions]%
diff --git a/tex/context/base/mkiv/typo-krn.lua b/tex/context/base/mkiv/typo-krn.lua
index 0a913f8ab..71d9736a4 100644
--- a/tex/context/base/mkiv/typo-krn.lua
+++ b/tex/context/base/mkiv/typo-krn.lua
@@ -446,24 +446,24 @@ function kerns.handler(head)
elseif id == disc_code then
local prev, next, pglyph, nglyph -- delayed till needed
local subtype = getsubtype(start)
- if subtype == automatic_code then
- -- this is kind of special, as we have already injected the
- -- previous kern
- local prev = getprev(start)
- local pglyph = prev and getid(prev) == glyph_code
- languages.expand(start,pglyph and prev)
- -- we can have a different start now
- elseif subtype ~= discretionary_code then
- prev = getprev(start)
- pglyph = prev and getid(prev) == glyph_code
- languages.expand(start,pglyph and prev)
- end
+ -- if subtype == automatic_code then
+ -- -- this is kind of special, as we have already injected the
+ -- -- previous kern
+ -- local prev = getprev(start)
+ -- local pglyph = prev and getid(prev) == glyph_code
+ -- languages.expand(start,pglyph and prev)
+ -- -- we can have a different start now
+ -- elseif subtype ~= discretionary_code then
+ -- prev = getprev(start)
+ -- pglyph = prev and getid(prev) == glyph_code
+ -- languages.expand(start,pglyph and prev)
+ -- end
local pre, post, replace = getdisc(start)
local indeed = false
if pre then
local okay = false
if not prev then
- prev = prev or getprev(start)
+ prev = getprev(start)
pglyph = prev and getid(prev) == glyph_code
end
if pglyph then
@@ -491,7 +491,7 @@ function kerns.handler(head)
if replace then
local okay = false
if not prev then
- prev = prev or getprev(start)
+ prev = getprev(start)
pglyph = prev and getid(prev) == glyph_code
end
if pglyph then
diff --git a/tex/context/base/mkiv/typo-pnc.lua b/tex/context/base/mkiv/typo-pnc.lua
new file mode 100644
index 000000000..1ed8d9940
--- /dev/null
+++ b/tex/context/base/mkiv/typo-pnc.lua
@@ -0,0 +1,169 @@
+if not modules then modules = { } end modules ['typo-pnc'] = {
+ version = 1.001,
+ comment = "companion to typo-pnc.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local nodes = nodes
+local fonts = fonts
+
+local prependaction = nodes.tasks.prependaction
+local enableaction = nodes.tasks.enableaction
+
+local nuts = nodes.nuts
+local tonut = nodes.tonut
+
+local nodecodes = nodes.nodecodes
+local gluecodes = nodes.gluecodes
+local glyph_code = nodecodes.glyph
+local glue_code = nodecodes.glue
+local spaceskip_code = gluecodes.spaceskip
+
+local new_kern = nuts.pool.kern
+local insert_after = nuts.insert_after
+local traverse_id = nuts.traverse_id
+
+local getchar = nuts.getchar
+local getfont = nuts.getfont
+local getboth = nuts.getboth
+local getnext = nuts.getnext
+local getattr = nuts.getattr
+local getid = nuts.getid
+local getsubtype = nuts.getsubtype
+local getwidth = nuts.getwidth
+local setwidth = nuts.setwidth
+
+local parameters = fonts.hashes.parameters
+local categories = characters.categories
+
+local texsetattribute = tex.setattribute
+local unsetvalue = attributes.unsetvalue
+
+local period = 0x2E
+local factor = 0.5
+
+-- alternative: tex.getlccode and tex.getuccode
+
+typesetters = typesetters or { }
+local typesetters = typesetters
+
+local periodkerns = typesetters.periodkerns or { }
+typesetters.periodkerns = periodkerns
+
+local report = logs.reporter("period kerns")
+local trace = false
+
+trackers.register("typesetters.periodkerns",function(v) trace = v end)
+
+periodkerns.mapping = periodkerns.mapping or { }
+periodkerns.factors = periodkerns.factors or { }
+local a_periodkern = attributes.private("periodkern")
+
+storage.register("typesetters/periodkerns/mapping", periodkerns.mapping, "typesetters.periodkerns.mapping")
+storage.register("typesetters/periodkerns/factors", periodkerns.factors, "typesetters.periodkerns.factors")
+
+local mapping = periodkerns.mapping
+local factors = periodkerns.factors
+
+function periodkerns.handler(head)
+ local done = false
+ local hnut = tonut(head)
+ for current in traverse_id(glyph_code,tonut(hnut)) do
+ if getchar(current) == period then
+ local a = getattr(current,a_periodkern)
+ if a then
+ local factor = mapping[a]
+ if factor then
+ local prev, next = getboth(current)
+ if prev and next and getid(prev) == glyph_code and getid(next) == glyph_code then
+ local pchar = getchar(prev)
+ local pcode = categories[getchar(prev)]
+ if pcode == "lu" or pcode == "ll" then
+ local nchar = getchar(next)
+ local ncode = categories[getchar(next)]
+ if ncode == "lu" or ncode == "ll" then
+ local next2 = getnext(next)
+ if next2 and getid(next2) == glyph_code and getchar(next2) == period then
+ -- A.B.
+ local fontspace, inserted
+ if factor ~= 0 then
+ fontspace = parameters[getfont(current)].space -- can be sped up
+ inserted = factor * fontspace
+ insert_after(hnut,current,new_kern(inserted))
+ if trace then
+ report("inserting space at %C . [%p] %C .",pchar,inserted,nchar)
+ end
+ done = true
+ end
+ local next3 = getnext(next2)
+ if next3 and getid(next3) == glue_code and getsubtype(next3) == spaceskip_code then
+ local width = getwidth(next3)
+ local space = fontspace or parameters[getfont(current)].space -- can be sped up
+ if width > space then -- space + extraspace
+ local next4 = getnext(next3)
+ if next4 and getid(next4) == glyph_code then
+ local fchar = getchar(next4)
+ if categories[fchar] ~= "lu" then
+ -- A.B.<glue>X
+ if trace then
+ if inserted then
+ report("reverting space at %C . [%p] %C . [%p->%p] %C",pchar,inserted,nchar,width,space,fchar)
+ else
+ report("reverting space at %C . %C . [%p->%p] %C",pchar,nchar,width,space,fchar)
+ end
+ end
+ setwidth(next3,space)
+ done = true
+ else
+ if trace then
+ if inserted then
+ report("keeping space at %C . [%p] %C . [%p] %C",pchar,inserted,nchar,width,fchar)
+ else
+ report("keeping space at %C . %C . [%p] %C",pchar,nchar,width,fchar)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ return head, done
+end
+
+local enabled = false
+
+function periodkerns.set(factor)
+ factor = tonumber(factor) or 0
+ if not enabled then
+ prependaction("processors","normalizers","typesetters.periodkerns.handler")
+ enableaction("processors","typesetters.periodkerns.handler")
+ enabled = true
+ end
+ local a = factors[factor]
+ if not a then
+ a = #mapping + 1
+ factors[factors], mapping[a] = a, factor
+ end
+ factor = a
+ texsetattribute(a_periodkern,factor)
+ return factor
+end
+
+-- interface
+
+interfaces.implement {
+ name = "setperiodkerning",
+ actions = periodkerns.set,
+ arguments = "string"
+}
+
+
diff --git a/tex/context/base/mkiv/typo-pnc.mkiv b/tex/context/base/mkiv/typo-pnc.mkiv
new file mode 100644
index 000000000..39d0c85f4
--- /dev/null
+++ b/tex/context/base/mkiv/typo-pnc.mkiv
@@ -0,0 +1,55 @@
+%D \module
+%D [ file=typo-pnc,
+%D version=2017.06.23, % experiment in project
+%D title=\CONTEXT\ Typesetting Macros,
+%D subtitle=Punctuation,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\writestatus{loading}{ConTeXt Typesetting Macros / Punctuation}
+
+\unprotect
+
+% In manuals we often have "foo e.g. bar" where we then have to compensate spaces
+% with "foo e.g.\ bar" so let's see if we can automate that and at the same time
+% inject spaces between the snippets. It gets boring writing this kind of code.
+
+\registerctxluafile{typo-pnc}{}
+
+\definesystemattribute[periodkern][public,global]
+
+\installcorenamespace{periodkerning}
+
+\installcommandhandler \??periodkerning {periodkerning} \??periodkerning
+
+\unexpanded\def\setperiodkerning[#1]%
+ {\edef\currentperiodkerning{#1}%
+ \ifx\currentperiodkerning\s!reset
+ \resetperiodkerning
+ \else
+ \typo_periodkerning_set
+ \fi}
+
+\def\typo_periodkerning_set
+ {\clf_setperiodkerning{\periodkerningparameter\c!factor}}
+
+\unexpanded\def\resetperiodkerning % fast one
+ {\attribute\periodkernattribute\attributeunsetvalue}
+
+\appendtoks
+ \resetperiodkerning
+\to \everyresettypesetting
+
+\defineperiodkerning [zerospaceperiods] [\c!factor=0]
+\defineperiodkerning [smallspaceperiods] [\c!factor=.25]
+\defineperiodkerning [halfspaceperiods] [\c!factor=.5]
+
+% If we ever need a command, see typo-krn.mkiv but it doesn't make much sense
+% to have it.
+
+\protect
diff --git a/tex/context/base/mkiv/typo-sus.lua b/tex/context/base/mkiv/typo-sus.lua
index 502c90417..2d3037bdc 100644
--- a/tex/context/base/mkiv/typo-sus.lua
+++ b/tex/context/base/mkiv/typo-sus.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['typo-sus'] = {
license = "see context related readme files"
}
+local next = next
+
local punctuation = {
po = true,
}
diff --git a/tex/context/base/mkiv/typo-tal.lua b/tex/context/base/mkiv/typo-tal.lua
index 67380f24b..870d006cc 100644
--- a/tex/context/base/mkiv/typo-tal.lua
+++ b/tex/context/base/mkiv/typo-tal.lua
@@ -14,7 +14,7 @@ if not modules then modules = { } end modules ['typo-tal'] = {
-- We can speed up by saving the current fontcharacters[font] + lastfont.
-local next, type = next, type
+local next, type, tonumber = next, type, tonumber
local div = math.div
local utfbyte = utf.byte
@@ -38,6 +38,7 @@ local tonode = nuts.tonode
local getnext = nuts.getnext
local getprev = nuts.getprev
+local getboth = nuts.getboth
local getid = nuts.getid
local getfont = nuts.getfont
local getchar = nuts.getchar
@@ -100,7 +101,7 @@ local validsigns = {
-- If needed we can have more modes which then also means a faster simple handler
-- for non numbers.
-local function setcharacteralign(column,separator)
+local function setcharacteralign(column,separator,before,after)
if not enabled then
enableaction("processors","typesetters.characteralign.handler")
enabled = true
@@ -123,11 +124,14 @@ local function setcharacteralign(column,separator)
separator = comma
method = v_number
end
+ local before = tonumber(before) or 0
+ local after = tonumber(after) or 0
dataset = {
separator = separator,
list = { },
- maxafter = 0,
- maxbefore = 0,
+ maxbefore = before,
+ maxafter = after,
+ predefined = before > 0 or after > 0,
collected = false,
method = method,
separators = validseparators,
@@ -153,6 +157,12 @@ implement {
}
implement {
+ name = "setcharacteraligndetail",
+ actions = setcharacteralign,
+ arguments = { "integer", "string", "dimension", "dimension" }
+}
+
+implement {
name = "resetcharacteralign",
actions = resetcharacteralign
}
@@ -257,10 +267,9 @@ function characteralign.handler(originalhead,where)
elseif (b_start or a_start) and id == glue_code then
-- maybe only in number mode
-- somewhat inefficient
- local next = getnext(current)
- local prev = getprev(current)
+ local prev, next = getboth(current)
if next and prev and getid(next) == glyph_code and getid(prev) == glyph_code then -- too much checking
- local width = fontcharacters[getfont(b_start)][separator or period].width
+ local width = fontcharacters[getfont(b_start or a_start)][separator or period].width
setglue(current,width)
setattr(current,a_character,punctuationspace)
if a_start then
@@ -310,8 +319,25 @@ function characteralign.handler(originalhead,where)
current = getnext(current)
end
end
- local entry = list[row]
- if entry then
+ local predefined = dataset.predefined
+ local before, after
+ if predefined then
+ before = b_start and list_dimensions(b_start,getnext(b_stop)) or 0
+ after = a_start and list_dimensions(a_start,getnext(a_stop)) or 0
+ else
+ local entry = list[row]
+ if entry then
+ before = entry.before or 0
+ after = entry.after or 0
+ else
+ before = b_start and list_dimensions(b_start,getnext(b_stop)) or 0
+ after = a_start and list_dimensions(a_start,getnext(a_stop)) or 0
+ list[row] = {
+ before = before,
+ after = after,
+ }
+ return tonode(head), true
+ end
if not dataset.collected then
-- print("[maxbefore] [maxafter]")
local maxbefore = 0
@@ -330,61 +356,53 @@ function characteralign.handler(originalhead,where)
dataset.maxafter = maxafter
dataset.collected = true
end
- local maxbefore = dataset.maxbefore
- local maxafter = dataset.maxafter
- local before = entry.before or 0
- local after = entry.after or 0
- local new_kern = trace_split and traced_kern or new_kern
- if b_start then
- if before < maxbefore then
- head = insert_node_before(head,b_start,new_kern(maxbefore-before))
- end
- if not c then
- -- print("[before]")
- if dataset.hasseparator then
- local width = fontcharacters[getfont(b_stop)][separator].width
- insert_node_after(head,b_stop,new_kern(maxafter+width))
- end
- elseif a_start then
- -- print("[before] [separator] [after]")
- if after < maxafter then
- insert_node_after(head,a_stop,new_kern(maxafter-after))
- end
- else
- -- print("[before] [separator]")
- if maxafter > 0 then
- insert_node_after(head,c,new_kern(maxafter))
- end
+ end
+ local maxbefore = dataset.maxbefore
+ local maxafter = dataset.maxafter
+ local new_kern = trace_split and traced_kern or new_kern
+ if b_start then
+ if before < maxbefore then
+ head = insert_node_before(head,b_start,new_kern(maxbefore-before))
+ end
+ if not c then
+ -- print("[before]")
+ if dataset.hasseparator then
+ local width = fontcharacters[getfont(b_start)][separator].width
+ insert_node_after(head,b_stop,new_kern(maxafter+width))
end
elseif a_start then
- if c then
- -- print("[separator] [after]")
- if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
- end
- else
- -- print("[after]")
- local width = fontcharacters[getfont(b_stop)][separator].width
- head = insert_node_before(head,a_start,new_kern(maxbefore+width))
- end
+ -- print("[before] [separator] [after]")
if after < maxafter then
insert_node_after(head,a_stop,new_kern(maxafter-after))
end
- elseif c then
- -- print("[separator]")
- if maxbefore > 0 then
- head = insert_node_before(head,c,new_kern(maxbefore))
- end
+ else
+ -- print("[before] [separator]")
if maxafter > 0 then
insert_node_after(head,c,new_kern(maxafter))
end
end
- else
- entry = {
- before = b_start and list_dimensions(b_start,getnext(b_stop)) or 0,
- after = a_start and list_dimensions(a_start,getnext(a_stop)) or 0,
- }
- list[row] = entry
+ elseif a_start then
+ if c then
+ -- print("[separator] [after]")
+ if maxbefore > 0 then
+ head = insert_node_before(head,c,new_kern(maxbefore))
+ end
+ else
+ -- print("[after]")
+ local width = fontcharacters[getfont(b_stop)][separator].width
+ head = insert_node_before(head,a_start,new_kern(maxbefore+width))
+ end
+ if after < maxafter then
+ insert_node_after(head,a_stop,new_kern(maxafter-after))
+ end
+ elseif c then
+ -- print("[separator]")
+ if maxbefore > 0 then
+ head = insert_node_before(head,c,new_kern(maxbefore))
+ end
+ if maxafter > 0 then
+ insert_node_after(head,c,new_kern(maxafter))
+ end
end
return tonode(head), true
end
diff --git a/tex/context/base/mkiv/typo-tal.mkiv b/tex/context/base/mkiv/typo-tal.mkiv
index 5ac0eeea4..7170578d1 100644
--- a/tex/context/base/mkiv/typo-tal.mkiv
+++ b/tex/context/base/mkiv/typo-tal.mkiv
@@ -56,10 +56,11 @@
% D
% D \typebuffer \blank \getbuffer \blank
-\unexpanded\def\signalcharacteralign#1#2{\attribute\characteralignattribute\numexpr#1*\maxcardminusone+#2\relax} % 0xFFFF
-\unexpanded\def\setcharacteralign #1#2{\clf_setcharacteralign#1{#2}}
-\unexpanded\def\resetcharacteralign {\clf_resetcharacteralign}
-\unexpanded\def\nocharacteralign {\attribute\characteralignattribute\attributeunsetvalue}
+\unexpanded\def\signalcharacteralign #1#2{\attribute\characteralignattribute\numexpr#1*\maxcardminusone+#2\relax} % 0xFFFF
+\unexpanded\def\setcharacteralign #1#2{\clf_setcharacteralign#1{#2}}
+\unexpanded\def\resetcharacteralign {\clf_resetcharacteralign}
+\unexpanded\def\nocharacteralign {\attribute\characteralignattribute\attributeunsetvalue}
+\unexpanded\def\setcharacteraligndetail#1#2#3#4{\clf_setcharacteraligndetail#1{#2}#3#4\relax}
%D Mostly downward compatible:
%D
@@ -73,18 +74,54 @@
%D \stopbuffer
%D
%D \typebuffer \blank \getbuffer \blank
-
+%D
+%D \startbuffer
+%D \startcharacteralign[leftsample=123.456,rightsample=00,character={,}]
+%D \checkcharacteralign{123.456,78}\par
+%D \checkcharacteralign {456}\par
+%D \checkcharacteralign {23.456}\par
+%D \checkcharacteralign {78,9}\par
+%D \checkcharacteralign {78}\par
+%D \stopcharacteralign
+%D \stopbuffer
+%D
+%D \typebuffer \blank \getbuffer \blank
+%D
+%D \startbuffer
+%D \startcharacteralign[leftwidth=123.456,rightwidth=00,character={,}]
+%D \checkcharacteralign{123.456,78}\par
+%D \checkcharacteralign {456}\par
+%D \checkcharacteralign {23.456}\par
+%D \checkcharacteralign {78,9}\par
+%D \checkcharacteralign {78}\par
+%D \stopcharacteralign
+%D \stopbuffer
+%D
+%D \typebuffer \blank \getbuffer \blank
+%D
%D We have (currently) two modes: \type {text} and \type {number}. The handler tries
%D to determine the mode automatically. When using periods and commas as separators
%D the \type {number} mode is chosen. If you use for instance a \type {-} as
%D separator, \type {text} is chosen, but you can enforce \type {number} with \type
-%D {number->-} (as with other mechanisms, the arrow indicates a methot to apply).
+%D {number->-} (as with other mechanisms, the arrow indicates a method to apply).
%D
%D One can use \type {\nocharacteralign} to disable this mechanism, for instance in
%D a table cell.
\def\alignmentcharacter{,}
+\installcorenamespace{characteralign}
+
+\installparameterhandler\??characteralign {characteralign}
+\installsetuphandler \??characteralign {characteralign}
+
+\setupcharacteralign
+ [\c!leftwidth =\zeropoint,
+ \c!rightwidth =\zeropoint,
+ \c!leftsample =,
+ \c!rightsample=,
+ \c!character =\alignmentcharacter]
+
\unexpanded\def\typo_charalign_pass_one
{\advance\scratchcounter\plusone
\setbox\scratchbox\typo_charalign_pass}
@@ -99,13 +136,71 @@
\unexpanded\def\startcharacteralign
{\dosingleempty\typo_charalign_start}
-\def\typo_charalign_start[#1]#2\stopcharacteralign
+\def\typo_charalign_start[#1]%
+ {\doifelseassignment{#1}\typo_charalign_start_one\typo_charalign_start_two{#1}}
+
+\def\typo_charalign_start_one#1#2\stopcharacteralign
+ {\bgroup
+ % for now no instances
+ \setupcurrentcharacteralign[#1]%
+ \edef\p_left {\characteralignparameter\c!leftsample}%
+ \edef\p_right{\characteralignparameter\c!rightsample}%
+ \ifx\p_left\empty
+ \scratchdimenone\dimexpr\characteralignparameter\c!leftwidth\relax
+ \else
+ \setbox\scratchbox\hbox{\p_left}%
+ \scratchdimenone\wd\scratchbox
+ \fi
+ \ifx\p_right\empty
+ \scratchdimentwo\dimexpr\characteralignparameter\c!rightwidth\relax
+ \else
+ \setbox\scratchbox\hbox{\p_right}%
+ \scratchdimentwo\wd\scratchbox
+ \fi
+ \ifzeropt\scratchdimenone
+ \ifzeropt\scratchdimentwo
+ \donefalse
+ \else
+ \donetrue
+ \fi
+ \else
+ \donetrue
+ \fi
+ \edef\alignmentcharacter{\characteralignparameter\c!character}%
+ \ifdone
+ \clf_setcharacteraligndetail
+ \plusone
+ \alignmentcharacter
+ \scratchdimenone
+ \scratchdimentwo
+ \else
+ \clf_setcharacteralign
+ \plusone
+ \alignmentcharacter
+ \begingroup
+ \scratchcounter\zerocount
+ \let\checkcharacteralign\typo_charalign_pass_one
+ \settrialtypesetting
+ #2\relax
+ \endgroup
+ \fi
+ \begingroup
+ \scratchcounter\zerocount
+ \let\checkcharacteralign\typo_charalign_pass_two
+ #2\relax
+ \endgroup
+ \resetcharacteralign
+ \egroup}
+
+\def\typo_charalign_start_two#1#2\stopcharacteralign
{\bgroup
\edef\m_temp{#1}%
\ifx\m_temp\empty \else
\let\alignmentcharacter\m_temp
\fi
- \setcharacteralign\plusone\alignmentcharacter
+ \clf_setcharacteralign
+ \plusone
+ \alignmentcharacter
\begingroup
\scratchcounter\zerocount
\let\checkcharacteralign\typo_charalign_pass_one
diff --git a/tex/context/base/mkiv/util-evo-imp-server.lua b/tex/context/base/mkiv/util-evo-imp-server.lua
new file mode 100644
index 000000000..31d779102
--- /dev/null
+++ b/tex/context/base/mkiv/util-evo-imp-server.lua
@@ -0,0 +1,127 @@
+if not modules then modules = { } end modules ['util-imp-evohome-server'] = {
+ version = 1.002,
+ comment = "simple server for simple evohome extensions",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE",
+ license = "see context related readme files"
+}
+
+local P, C, patterns, lpegmatch = lpeg.P, lpeg.C, lpeg.patterns, lpeg.match
+local urlhashed, urlquery, urlunescapeget = url.hashed, url.query, url.unescapeget
+local ioflush = io.flush
+
+local newline = patterns.newline
+local spacer = patterns.spacer
+local whitespace = patterns.whitespace
+local method = P("GET")
+ + P("POST")
+local identify = (1-method)^0
+ * C(method)
+ * spacer^1
+ * C((1-spacer)^1)
+ * spacer^1
+ * P("HTTP/")
+ * (1-whitespace)^0
+ * C(P(1)^0)
+
+do
+
+ local loaded = package.loaded
+
+ if not loaded.socket then loaded.socket = loaded["socket.core"] end
+ if not loaded.mime then loaded.mime = loaded["mime.core"] end
+
+end
+
+local evohome = require("util-evo")
+ require("trac-lmx")
+
+local report = logs.reporter("evohome","server")
+local convert = lmx.convert
+
+function evohome.server(specification)
+
+ local filename = specification.filename
+
+ if not filename then
+ report("unable to run server, no filename given")
+ return
+ end
+
+ local step, process, presets = evohome.actions.poller(filename)
+
+ if not (step and process and presets) then
+ report("unable to run server, invalid presets")
+ return
+ end
+
+ local template = presets.files.template
+
+ if not template then
+ report("unable to run server, no template given")
+ return
+ end
+
+ local port = specification.port or (presets.server and presets.server.port) or 806
+ local host = specification.host or (presets.server and presets.server.host) or "*"
+
+ package.extraluapath(presets.filepath)
+
+ local socket = socket or require("socket")
+ local copas = copas or require("copas")
+
+ local function copashttp(skt)
+ local client = copas.wrap(skt)
+ local request, e = client:receive()
+ if not e then
+ local method, fullurl, body = lpegmatch(identify,request)
+ if method ~= "" and fullurl ~= "" then
+ local fullurl = urlunescapeget(fullurl)
+ local hashed = urlhashed(fullurl)
+ process(hashed.queries or { })
+ ioflush()
+ end
+ -- todo: split off css and use that instead of general one, now too much
+ local content = convert(presets.results and presets.results.template or template,false,presets)
+ if not content then
+ report("error in converting template")
+ content = "error in template"
+ end
+ client:send("HTTP/1.1 200 OK\r\n")
+ client:send("Connection: close\r\n")
+ client:send("Content-Length: " .. #content .. "\r\n")
+ client:send("Content-Type: text/html\r\n")
+ client:send("Location: " .. host .. "\r\n")
+ client:send("Cache-Control: no-cache, no-store, must-revalidate, max-age=0\r\n")
+ client:send("\r\n")
+ client:send(content)
+ client:send("\r\n")
+ client:close()
+ end
+ end
+
+ local function copaspoll()
+ while step do
+ local delay = step()
+ if type(delay) == "number" then
+ copas.sleep(delay or 0)
+ end
+ end
+ end
+
+ local server = socket.bind(host,port)
+
+ if server then
+ report("server started at %s:%s",host,port)
+ ioflush()
+ copas.addserver(server,copashttp)
+ copas.addthread(copaspoll)
+ copas.loop()
+ else
+ report("unable to start server at %s:%s",host,port)
+ os.exit()
+ end
+
+end
+
+return evohome
diff --git a/tex/context/base/mkiv/util-evo.lua b/tex/context/base/mkiv/util-evo.lua
index eeaad5843..25ad7f94d 100644
--- a/tex/context/base/mkiv/util-evo.lua
+++ b/tex/context/base/mkiv/util-evo.lua
@@ -14,88 +14,176 @@ if not modules then modules = { } end modules ['util-evo'] = {
-- later). Anyway, apart from integrating it into my home automation setup so that I
-- can add control based on someone present in a zone, I wanted to be able to render
-- statistics. So that's why we have a module in ConTeXt for doing that. It's also
--- an example of Lua.
+-- an example of Lua and abusing LuaTeX for something not related to typesetting.
--
-- As with other scripts, it assumes that mtxrun is used so that we have the usual
--- libraries present.
+-- Lua libraries present.
--
-- The code is not that complex but figuring out the right request takes bit of
-- searching the web. There is an api specification at:
--
--- https://developer.honeywell.com/api-methods?field_smart_method_tags_tid=All
+-- https://developer.honeywell.com/api-methods?field_smart_method_tags_tid=All
--
--- Details like the application id can be found in several places. There are
--- snippets of (often partial or old) code on discussion platforms so in the one can
--- get there.
+-- Details like the application id can be found in several places. There are snippets
+-- of (often partial or old) code on the web but still one needs to experiment and
+-- combine information. We assume unique zone names and ids across gateways; I only
+-- have one installed anyway.
+--
+-- The original application was to just get the right information for generating
+-- statistics but in the meantime I also use this code to add additional functionality
+-- to the system, for instance switching between rooms (office, living room, attic) and
+-- absence for one or more rooms.
--- todo: load everything and keep it in mem and only save it when there are changes
--- todo: use a temp files per month
-- todo: %path% in filenames
require("util-jsn")
+local next, type, setmetatable, rawset, rawget = next, type, setmetatable, rawset, rawget
local json = utilities.json
local formatters = string.formatters
local floor, div = math.floor, math.div
local resultof, ostime, osdate, ossleep = os.resultof, os.time, os.date, os.sleep
local jsontolua, jsontostring = json.tolua, json.tostring
-local savetable, loadtable = table.save, table.load
-local setmetatableindex = table.setmetatableindex
+local savetable, loadtable, sortedkeys = table.save, table.load, table.sortedkeys
+local setmetatableindex, setmetatablenewindex = table.setmetatableindex, table.setmetatablenewindex
local replacer = utilities.templates.replacer
+local lower = string.lower -- no utf support yet (encoding needs checking in evohome)
local applicationid = "b013aa26-9724-4dbd-8897-048b9aada249"
----- applicationid = "91db1612-73fd-4500-91b2-e63b069b185c"
local report = logs.reporter("evohome")
+local trace = false
+
+trackers.register("evohome.trace",function(v) trace = v end) -- not yet used
local defaultpresets = {
interval = 30 * 60,
+ files = {
+ everything = "evohome-everything.lua",
+ history = "evohome-history.lua",
+ latest = "evohome-latest.lua",
+ schedules = "evohome-schedules.lua",
+ actions = "evohome-actions.lua",
+ template = "evohome.lmx",
+ },
credentials = {
-- username = "unset",
-- password = "unset",
-- accesstoken = "unset",
-- userid = "unset",
},
- -- everything = "evohome-everything",
- -- history = "evohome-history",
}
+local function validfile(presets,filename)
+ if lfs.isfile(filename) then
+ -- we're okay
+ return filename
+ end
+ if file.pathpart(filename) ~= "" then
+ -- can be a file that has to be created
+ return filename
+ end
+ local presetsname = presets.filename
+ if not presetsname then
+ -- hope for the best
+ return filename
+ end
+ -- we now have the full path
+ return file.join(file.pathpart(presetsname),filename)
+end
+
local function validpresets(presets)
- if type(presets == "table") and presets.credentials then
- setmetatableindex(presets,defaultpresets)
- setmetatableindex(presets.credentials,defaultpresets.credentials)
- return presets
- else
- report("invalid presets")
+ if type(presets) ~= "table" then
+ report("invalid presets, no table")
+ return
+ end
+ local credentials = presets.credentials
+ if not credentials then
+ report("invalid presets, no credentials")
+ return
+ end
+ local gateways = presets.gateways
+ if not gateways then
+ report("invalid presets, no gateways")
+ return
+ end
+ local files = presets.files
+ if not files then
+ report("invalid presets, no files")
+ return
+ end
+ for k, v in next, files do
+ files[k] = validfile(presets,v) or v
end
+ local data = presets.data
+ if not data then
+ data = { }
+ presets.data = data
+ end
+ local g = data.gateways
+ if not g then
+ local g = { }
+ data.gateways = g
+ for i=1,#gateways do
+ local gi = gateways[i]
+ g[gi.macaddress] = gi
+ end
+ end
+ local zones = data.zones
+ if not zones then
+ zones = { }
+ data.zones = zones
+ setmetatablenewindex(zones,function(t,k,v) rawset(t,lower(k),v) end)
+ setmetatableindex (zones,function(t,k) return rawget(t,lower(k)) end)
+ end
+ local states = data.states
+ if not states then
+ states = { }
+ data.states = states
+ setmetatablenewindex(states,function(t,k,v) rawset(t,lower(k),v) end)
+ setmetatableindex (states,function(t,k) return rawget(t,lower(k)) end)
+ end
+ setmetatableindex(presets,defaultpresets)
+ setmetatableindex(credentials,defaultpresets.credentials)
+ setmetatableindex(files,defaultpresets.files)
+ return presets
end
local function loadedtable(filename)
- for i=1,10 do
- local t = loadtable(filename)
- if t then
- return t
- else
- ossleep(1/4)
+ if type(filename) == "string" then
+ for i=1,10 do
+ local t = loadtable(filename)
+ if t then
+ return t
+ else
+ ossleep(1/4)
+ end
end
end
return { }
end
local function loadpresets(filename)
- return loadtable(filename)
+ local presets = loadtable(filename)
+ if presets then
+ presets.filename = filename
+ presets.filepath = file.expandname(file.pathpart(filename))
+ -- package.extraluapath(presets.filepath) -- better do that elsewhere and once
+ end
+ return presets
end
local function loadhistory(filename)
- if type(filename) == "table" then
- filename = filename.history
+ if type(filename) == "table" and validpresets(filename) then
+ filename = filename.files and filename.files.history
end
return loadedtable(filename)
end
local function loadeverything(filename)
- if type(filename) == "table" then
- filename = filename.everything
+ if type(filename) == "table" and validpresets(filename) then
+ filename = filename.files and filename.files.everything
end
return loadedtable(filename)
end
@@ -137,9 +225,9 @@ local function getaccesstoken(presets)
}
local r = s and resultof(s)
local t = r and jsontolua(r)
- return result(t,"getting access token: %s")
+ return result(t,"getting access token %a")
end
- return result(false,"getting access token: %s")
+ return result(false,"getting access token %a")
end
local f = replacer (
@@ -160,9 +248,9 @@ local function getuserinfo(presets)
}
local r = s and resultof(s)
local t = r and jsontolua(r)
- return result(t,"getting user info: %s")
+ return result(t,"getting user info for %a")
end
- return result(false,"getting user info: %s")
+ return result(false,"getting user info for %a")
end
local f = replacer (
@@ -184,9 +272,9 @@ local function getlocationinfo(presets)
}
local r = s and resultof(s)
local t = r and jsontolua(r)
- return result(t,"getting location info: %s")
+ return result(t,"getting location info for %a")
end
- return result(false,"getting location info: %s")
+ return result(false,"getting location info for %a")
end
local f = replacer (
@@ -198,19 +286,22 @@ local f = replacer (
[["https://tccna.honeywell.com/WebAPI/emea/api/v1/temperatureZone/%zoneid%/schedule"]]
)
-local function getschedule(presets,zoneid,zonename)
- if zoneid and validpresets(presets) then
- local c = presets.credentials
- local s = c and f {
- accesstoken = c.accesstoken,
- applicationid = applicationid,
- zoneid = zoneid,
- }
- local r = s and resultof(s)
- local t = r and jsontolua(r)
- return result(t,"getting schedule for zone %s: %s",zonename or "?")
+local function getschedule(presets,zonename)
+ if validpresets(presets) then
+ local zoneid = presets.data.zones[zonename].zoneId
+ if zoneid then
+ local c = presets.credentials
+ local s = c and f {
+ accesstoken = c.accesstoken,
+ applicationid = applicationid,
+ zoneid = zoneid,
+ }
+ local r = s and resultof(s)
+ local t = r and jsontolua(r)
+ return result(t,"getting schedule for zone %a, %s",zonename or "?")
+ end
end
- return result(false,"getting schedule for zone %s: %s",zonename or "?")
+ return result(false,"getting schedule for zone %a, %s",zonename or "?")
end
local f = replacer (
@@ -232,29 +323,128 @@ local function getstatus(presets,locationid,locationname)
}
local r = s and resultof(s)
local t = r and jsontolua(r)
- return result(t and t.gateways and t,"getting status for location %s: %s",locationname or "?")
+ return result(t and t.gateways and t,"getting status for location %a, %s",locationname or "?")
end
- return result(false,"getting status for location %s: %s",locationname or "?")
+ return result(false,"getting status for location %a, %s",locationname or "?")
end
local function validated(presets)
if validpresets(presets) then
- local data = getaccesstoken(presets)
- if data then
- presets.credentials.accesstoken = data.access_token
- local data = getuserinfo(presets)
+ local data = getlocationinfo(presets)
+ if data and type(data) == "table" and data[1] and data[1].locationInfo then
+ return true
+ else
+ local data = getaccesstoken(presets)
if data then
- presets.credentials.userid = data.userId
- return true
+ presets.credentials.accesstoken = data.access_token
+ local data = getuserinfo(presets)
+ if data then
+ presets.credentials.userid = data.userId
+ return true
+ end
+ end
+ end
+ end
+end
+
+local function findzone(presets,name)
+ if not presets then
+ return
+ end
+ local data = presets.data
+ if not data then
+ return
+ end
+ local usedzones = data.zones
+ return usedzones and usedzones[name]
+end
+
+local function gettargets(zone) -- maybe also for a day
+ local schedule = zone.schedule
+ local min = false
+ local max = false
+ if schedule then
+ local schedules = schedule.dailySchedules
+ if schedules then
+ for i=1,#schedules do
+ local switchpoints = schedules[i].switchpoints
+ for i=1,#switchpoints do
+ local m = switchpoints[i].temperature
+ if not min or m < min then
+ min = m
+ end
+ if not max or m > max then
+ max = m
+ end
+ end
+ end
+ else
+ report("zone %a has no schedule",name)
+ end
+ end
+ return min, max
+end
+
+local function updatezone(presets,name,zone)
+ if not zone then
+ zone = findzone(presets,name)
+ end
+ if zone then
+ local oldtarget = presets.data.states[name]
+ local min = zone.heatSetpointCapabilities.minHeatSetpoint or 5
+ local max = zone.heatSetpointCapabilities.maxHeatSetpoint or 12
+ local mintarget, maxtarget = gettargets(zone)
+ -- todo: maybe get these from presets
+ if mintarget == false then
+ if min < 5 then
+ mintarget = 5
+ -- report("zone %a, min target limited to %a",name,mintarget)
+ else
+ mintarget = min
+ end
+ end
+ if maxtarget == false then
+ if max > 18.5 then
+ maxtarget = 18.5
+ -- report("zone %a, max target limited to %a",name,maxtarget)
+ else
+ maxtarget = max
end
end
+ local current = zone.temperatureStatus.temperature or 0
+ local target = zone.heatSetpointStatus.targetTemperature
+ local mode = zone.heatSetpointStatus.setpointMode
+ local state = (mode == "FollowSchedule" and "schedule" ) or
+ (mode == "PermanentOverride" and target <= mintarget and "permanent") or
+ (mode == "TemporaryOverride" and target <= mintarget and "off" ) or
+ (mode == "TemporaryOverride" and target >= maxtarget and "on" ) or
+ ( "unknown" )
+ local t = {
+ name = zone.name,
+ id = zone.zoneId,
+ schedule = zone.schedule,
+ mode = mode,
+ current = current,
+ target = target,
+ min = min,
+ max = max,
+ state = state,
+ lowest = mintarget,
+ highest = maxtarget,
+ }
+ -- report("zone %a, current %a, target %a",name,current,target)
+ presets.data.states[name] = t
+ return t
end
end
-local function geteverything(presets,filename)
+
+local function geteverything(presets,noschedules)
if validated(presets) then
local data = getlocationinfo(presets)
if data then
+ local usedgateways = presets.data.gateways
+ local usedzones = presets.data.zones
for i=1,#data do
local gateways = data[i].gateways
local locationinfo = data[i].locationInfo
@@ -263,48 +453,63 @@ local function geteverything(presets,filename)
local status = getstatus(presets,locationid,locationinfo.name)
if status then
for i=1,#gateways do
- local g = status.gateways[i]
- local gateway = gateways[i]
- local systems = gateway.temperatureControlSystems
- if systems then
- local s = g.temperatureControlSystems
- for i=1,#systems do
- local zones = systems[i].zones
- if zones then
- local z = s[i].zones
- for i=1,#zones do
- local zone = zones[i]
- if zone.zoneType == "ZoneTemperatureControl" then
- local z = z[i]
- zone.schedule = getschedule(presets,zone.zoneId,zone.name)
- if z.name == zone.name then
- zone.heatSetpointStatus = z.heatSetpointStatus
- zone.temperatureStatus = z.temperatureStatus
+ local gatewaystatus = status.gateways[i]
+ local gatewayinfo = gateways[i]
+ local gatewaysystems = gatewayinfo.temperatureControlSystems
+ local info = gatewayinfo.gatewayInfo
+ local statussystems = gatewaystatus.temperatureControlSystems
+ if gatewaysystems and statussystems and info then
+ local mac = info.mac
+ if usedgateways[mac] then
+ report("%s gateway with mac address %a","using",mac)
+ for j=1,#gatewaysystems do
+ local gatewayzones = gatewaysystems[j].zones
+ local zonestatus = statussystems[j].zones
+ if gatewayzones and zonestatus then
+ for k=1,#gatewayzones do
+ local zonestatus = zonestatus[k]
+ local gatewayzone = gatewayzones[k]
+ if zonestatus and gatewayzone then
+ local zonename = zonestatus.name
+ local zoneid = zonestatus.zoneId
+ if gatewayzone.zoneType == "ZoneTemperatureControl" and zonename == gatewayzone.name then
+ gatewayzone.heatSetpointStatus = zonestatus.heatSetpointStatus
+ gatewayzone.temperatureStatus = zonestatus.temperatureStatus
+ local zonestatus = usedzones[zonename] -- findzone(states,zonename)
+ local schedule = zonestatus and zonestatus.schedule
+ usedzones[zonename] = gatewayzone
+ if schedule and noschedules then
+ gatewayzone.schedule = schedule
+ else
+ gatewayzone.schedule = getschedule(presets,zonename)
+ end
+ updatezone(presets,zonename,gatewayzone)
+ end
end
end
end
end
+ else
+ report("%s gateway with mac address %a","skipping",mac)
end
end
end
end
end
end
- if not filename then
- filename = presets.everything
- end
- if filename then
- savetable(filename,data)
- end
- return result(data,"getting everything: %s")
+ savetable(presets.files.everything,data)
+ return result(data,"getting everything, %s")
end
end
- return result(false,"getting everything: %s")
+ return result(false,"getting everything, %s")
end
-local function gettemperatures(presets,filename)
+local function gettemperatures(presets)
if validated(presets) then
- local data = loadeverything(filename or presets)
+ local data = loadeverything(presets)
+ if not data or not next(data) then
+ data = geteverything(presets)
+ end
if data then
local updated = false
for i=1,#data do
@@ -341,14 +546,14 @@ local function gettemperatures(presets,filename)
end
end
end
- if updated and filename then
+ if updated then
data.time = ostime()
- savetable(filename,data)
+ savetable(presets.files.latest,data)
end
- return result(data,"getting temperatures: %s")
+ return result(data,"getting temperatures, %s")
end
end
- return result(false,"getting temperatures: %s")
+ return result(false,"getting temperatures, %s")
end
local function setmoment(target,time,data)
@@ -389,98 +594,72 @@ local function setmoment(target,time,data)
}
end
-local function loadtemperatures(filename)
- local status = loadeverything(filename)
- if status then
- setmetatable(status,mt)
- local zones = status[1].gateways[1].temperatureControlSystems[1].zones
- if zones then
- local summary = { time = status.time }
- for i=1,#zones do
- local zone = zones[i]
- if zone.modelType == "HeatingZone" then
- local temperatureStatus = zone.temperatureStatus
- local heatSetpointCapabilities = zone.heatSetpointCapabilities
- local heatSetpointStatus = zone.heatSetpointStatus
- summary[#summary+1] = {
- name = zone.name,
- current = temperatureStatus and temperatureStatus .temperature or 0,
- min = heatSetpointCapabilities and heatSetpointCapabilities.minHeatSetpoint or 0,
- max = heatSetpointCapabilities and heatSetpointCapabilities.maxHeatSetpoint or 0,
- target = heatSetpointStatus and heatSetpointStatus .targetTemperature or 0,
- }
+local function loadtemperatures(presets)
+ if validpresets(presets) then
+ local status = loadeverything(presets)
+ if status then
+ local usedgateways = presets.data.gateways
+ for i=1,#status do
+ local gateways = status[i].gateways
+ if gateways then
+ for i=1,#gateways do
+ local gatewayinfo = gateways[i]
+ local systems = gatewayinfo.temperatureControlSystems
+ local info = gatewayinfo.gatewayInfo
+ if systems and info and usedgateways[info.mac] then
+ for i=1,#systems do
+ local zones = systems[i].zones
+ if zones then
+ local summary = { time = status.time }
+ for i=1,#zones do
+ local zone = zones[i]
+ if zone.zoneType == "ZoneTemperatureControl" then
+ summary[#summary+1] = updatezone(presets,zone.name,zone)
+ end
+ end
+ return result(summary,"loading temperatures, %s")
+ end
+ end
+ end
+ end
end
end
- return result(summary,"loading temperatures: %s")
end
end
- return result(false,"loading temperatures: %s")
+ return result(false,"loading temperatures, %s")
end
-local function updatetemperatures(presets,filename,historyname)
+local function updatetemperatures(presets)
if validpresets(presets) then
- if not filename then
- filename = presets.everything
- end
- if not historyname then
- historyname = presets.history
- end
- gettemperatures(presets,filename)
- local t = loadtemperatures(filename)
- if t then
- local data = { }
- for i=1,#t do
- local ti = t[i]
- data[ti.name] = ti.current
- end
- local history = loadhistory(historyname) or { }
- setmoment(history,ostime(),data)
- savetable(historyname,history)
- return result(t,"updating temperatures: %s")
- end
- end
- return result(false,"updating temperatures: %s")
-end
-
-local mt = { __index = { [1] = { gateways = { [1] = { temperatureControlSystems = { [1] = { } } } } } } }
-
-local function findzone(status,name)
- if status then
- setmetatable(status,mt)
- local zones = status[1].gateways[1].temperatureControlSystems[1].zones
- if zones then
- for i=1,#zones do
- local zone = zones[i]
- if zone.modelType == "HeatingZone" and zone.name == name then
- return zone
+ local everythingname = presets.files.everything
+ local historyname = presets.files.history
+ if everythingname and historyname then
+ gettemperatures(presets,everythingname)
+ local t = loadtemperatures(presets)
+ if t then
+ local data = { }
+ for i=1,#t do
+ local ti = t[i]
+ data[ti.name] = ti.current
end
+ local history = loadhistory(historyname) or { }
+ setmoment(history,ostime(),data)
+ savetable(historyname,history)
+ return result(t,"updating temperatures, %s")
end
end
end
+ return result(false,"updating temperatures, %s")
end
-local function getzonestate(filename,name)
- local status = loadeverything(filename)
- local zone = findzone(status,name)
- if zone then
- local t = {
- name = zone.name,
- current = zone.temperatureStatus.temperature or 0,
- min = zone.heatSetpointCapabilities.minHeatSetpoint,
- max = zone.heatSetpointCapabilities.maxHeatSetpoint,
- target = zone.heatSetpointStatus.targetTemperature,
- mode = zone.heatSetpointStatus.setpointMode,
- schedule = zone.schedule,
- }
- return result(t,"getting state of zone %s: %s",name)
- end
- return result(false,"getting state of zone %s: %s",name)
+local function getzonestate(presets,name)
+ return validpresets(presets) and presets.data.states[name]
end
local f = replacer (
[[curl ]] ..
- [[-X PUT ]] ..
[[--silent --insecure ]] ..
+ [[-X PUT ]] ..
[[-H "Authorization: bearer %accesstoken%" ]] ..
[[-H "Accept: application/json, application/xml, text/json, text/x-json, text/javascript, text/xml" ]] ..
[[-H "applicationId: %applicationid%" ]] ..
@@ -489,62 +668,330 @@ local f = replacer (
[["https://tccna.honeywell.com/WebAPI/emea/api/v1/temperatureZone/%zoneid%/heatSetpoint"]]
)
-local function setzonestate(presets,name,temperature)
- if validated(presets) then
- local data = loadeverything(presets)
- local zone = findzone(data,name)
- if zone then
- local m = type(temperature) == "number" and temperature > 0 and
- {
+local function untilmidnight()
+ local t = osdate("*t")
+ t.hour = 23
+ t.min = 59
+ t.sec = 59
+ return osdate("%Y-%m-%dT%H:%M:%SZ",ostime(t))
+end
+
+local followschedule = {
+ -- HeatSetpointValue = 0,
+ SetpointMode = "FollowSchedule",
+}
+
+local function setzonestate(presets,name,temperature,permanent)
+ local zone = findzone(presets,name)
+ if zone then
+ local m = followschedule
+ if type(temperature) == "number" and temperature > 0 then
+ if permanent then
+ m = {
HeatSetpointValue = temperature,
- SetpointMode = "TemporaryOverride",
- TimeUntil = osdate("%Y-%m-%dT%H:%M:%SZ",os.time() + 60*60),
+ SetpointMode = "PermanentOverride",
}
- or
- {
- HeatSetpointValue = 0,
- SetpointMode = "FollowSchedule",
+ else
+ m = {
+ HeatSetpointValue = temperature,
+ SetpointMode = "TemporaryOverride",
+ TimeUntil = untilmidnight(),
}
+ end
+ end
+ local s = f {
+ accesstoken = presets.credentials.accesstoken,
+ applicationid = applicationid,
+ zoneid = zone.zoneId,
+ settings = jsontostring(m),
+ }
+ local r = s and resultof(s)
+ local t = r and jsontolua(r)
+-- inspect(r)
+-- inspect(t)
+ return result(t,"setting state of zone %a, %s",name)
+ end
+ return result(false,"setting state of zone %a, %s",name)
+end
- local s = f {
- accesstoken = presets.credentials.accesstoken,
- applicationid = applicationid,
- zoneid = zone.zoneId,
- settings = jsontostring(m),
+local function resetzonestate(presets,name)
+ setzonestate(presets,name)
+end
+
+--
+
+local function update(presets,noschedules)
+ local everything = geteverything(presets,noschedules)
+ if everything then
+ presets.data.everything = everything
+ return presets
+ end
+end
+
+local function initialize(filename)
+ local presets = loadpresets(filename)
+ if presets then
+ return update(presets)
+ end
+end
+
+local function off(presets,name)
+ local zone = presets and getzonestate(presets,name)
+ if zone then
+ setzonestate(presets,name,zone.lowest)
+ end
+end
+
+local function on(presets,name)
+ local zone = presets and getzonestate(presets,name)
+ if zone then
+ setzonestate(presets,name,zone.highest)
+ end
+end
+
+local function schedule(presets,name)
+ local zone = presets and getzonestate(presets,name)
+ if zone then
+ resetzonestate(presets,name)
+ end
+end
+
+local function permanent(presets,name)
+ local zone = presets and getzonestate(presets,name)
+ if zone then
+ setzonestate(presets,name,zone.lowest,true)
+ end
+end
+
+-- tasks
+
+local function settask(presets,when,tag,action)
+ if when == "tomorrow" then
+ local list = presets.scheduled
+ if not list then
+ list = loadtable(presets.files.schedules) or { }
+ presets.scheduled = list
+ end
+ if action then
+ list[tag] = {
+ time = ostime() + 24*60*60,
+ done = false,
+ category = category,
+ action = action,
}
- local r = s and resultof(s)
- local t = r and jsontolua(r)
- return result(t,"setting state of zone %s: %s",name)
+ else
+ list[tag] = nil
+ end
+ savetable(presets.files.schedules,list)
+ end
+end
+
+local function gettask(presets,when,tag)
+ if when == "tomorrow" then
+ local list = presets.scheduled
+ if not list then
+ list = loadtable(presets.files.schedules) or { }
+ presets.scheduled = list
+ end
+ return list[tag]
+ end
+end
+
+local function resettask(presets,when,tag)
+ settask(presets,when,tag)
+end
+
+local function checktasks(presets)
+ local list = presets.scheduled
+ if not list then
+ list = loadtable(presets.files.schedules) or { }
+ presets.scheduled = list
+ end
+ if list then
+ local t = osdate("*t")
+ local q = { }
+ for k, v in next, list do
+ local d = osdate("*t",v.time)
+ if not v.done and d.year == t.year and d.month == t.month and d.day == t.day then
+ local a = v.action
+ if type(a) == "function" then
+ a()
+ end
+ v.done = true
+ end
+ if d.year <= t.year and d.month <= t.month and d.day < t.day then
+ q[k] = true
+ end
end
+ if next(q) then
+ for k, v in next, q do
+ list[q] = nil
+ end
+ savetable(presets.files.schedules,list)
+ end
+ return list
end
- return result(false,"setting state of zone %s: %s",name)
end
-local evohome = {
+-- predefined tasks
+
+local function settomorrow(presets,tag,action)
+ settask(presets,"tomorrow",tag,action)
+end
+
+local function resettomorrow(presets,tag)
+ settask(presets,"tomorrow",tag)
+end
+
+local function tomorrowset(presets,tag)
+ return gettask(presets,"tomorrow",tag) and true or false
+end
+
+--
+
+local evohome
+
+local function poller(presets)
+ --
+ if type(presets) ~= "string" then
+ report("invalid presets file")
+ os.exit()
+ end
+ report("loading presets from %a",presets)
+ local presets = loadpresets(presets)
+ if not validpresets(presets) then
+ report("invalid presets, aborting")
+ os.exit()
+ end
+ --
+ local actions = presets.files.actions
+ if type(actions) ~= "string" then
+ report("invalid actions file")
+ os.exit()
+ end
+ report("loading actions from %a",actions)
+ local actions = loadtable(actions)
+ if type(actions) ~= "table" then
+ report("invalid actions, aborting")
+ os.exit()
+ end
+ actions = actions.actions
+ if type(actions) ~= "table" then
+ report("invalid actions file, no actions subtable")
+ os.exit()
+ end
+ --
+ report("updating device status")
+ update(presets)
+ --
+ presets.report = report
+ presets.evohome = evohome
+ presets.results = { }
+ --
+ function presets.getstate(name)
+ return getzonestate(presets,name)
+ end
+ function presets.tomorrowset(name)
+ return tomorrowset(presets,name)
+ end
+ --
+ local template = actions.template or presets.files.template
+ --
+ local process = function(t)
+ local category = t.category
+ local action = t.action
+ if category and action then
+ local c = actions[category]
+ if c then
+ local a = c[action]
+ if type(a) == "function" then
+ report("category %a, action %a, executing",category,action)
+ presets.results.template = template -- can be overloaded by action
+ a(presets)
+ update(presets,true)
+ else
+ report("category %a, action %a, invalid action, known: %, t",category,action,sortedkeys(c))
+ end
+ else
+ report("category %a, action %a, invalid category, known categories: %, t",category,action,sortedkeys(actions))
+ end
+ else
+ -- logs.report("invalid category and action")
+ end
+ end
+ --
+ local delay = presets.delay or 10
+ local interval = 15 * 60 -- 15 minutes
+ local interval = 60 * 60 -- 60 minutes
+ local refresh = 5 * 60
+ local passed = 0
+ local step = function()
+ if passed > interval then
+ report("refreshing states, every %i seconds",interval)
+ -- todo: update stepwise as this also updates the schedules that we don't really
+ -- change often and definitely not in the middle of the night, so maybe just
+ -- update 9:00 12:00 15:00 18:00 21:00
+ update(presets)
+ passed = 0
+ else
+ passed = passed + delay
+ end
+ checktasks(presets)
+ return delay
+ end
+ --
+ presets.refreshtime = refresh
+ --
+ return step, process, presets
+end
+
+--
+
+evohome = {
helpers = {
- getaccesstoken = getaccesstoken,
- getuserinfo = getuserinfo,
- getlocationinfo = getlocationinfo,
- getschedule = getschedule,
+ getaccesstoken = getaccesstoken, -- presets
+ getuserinfo = getuserinfo, -- presets
+ getlocationinfo = getlocationinfo, -- presets
+ getschedule = getschedule, -- presets, name
+ --
+ geteverything = geteverything, -- presets, noschedules
+ gettemperatures = gettemperatures, -- presets
+ getzonestate = getzonestate, -- presets, name
+ setzonestate = setzonestate, -- presets, name, temperature
+ resetzonestate = resetzonestate, -- presets, name
+ getzonedata = findzone, -- presets, name
+ --
+ loadpresets = loadpresets, -- filename
+ loadhistory = loadhistory, -- presets | filename
+ loadeverything = loadeverything, -- presets | filename
+ loadtemperatures = loadtemperatures, -- presets | filename
+ --
+ updatetemperatures = updatetemperatures, -- presets
},
- geteverything = geteverything,
- gettemperatures = gettemperatures,
- getzonestate = getzonestate,
- setzonestate = setzonestate,
- loadtemperatures = loadtemperatures,
- updatetemperatures = updatetemperatures,
- loadpresets = loadpresets,
- loadhistory = loadhistory,
- loadeverything = loadeverything,
+ actions= {
+ initialize = initialize, -- filename
+ update = update, -- presets
+ --
+ off = off, -- presets, name
+ on = on, -- presets, name
+ schedule = schedule, -- presets, name
+ permanent = permanent, -- presets, name
+ --
+ settomorrow = settomorrow, -- presets, tag, function
+ resettomorrow = resettomorrow, -- presets, tag
+ tomorrowset = tomorrowset, -- presets, tag
+ --
+ poller = poller, -- presets
+ }
}
if utilities then
utilities.evohome = evohome
end
--- local presets = evohome.loadpresets("c:/data/develop/domotica/code/evohome-presets.lua")
--- evohome.setzonestate(presets,"Voorkamer",22)
--- evohome.setzonestate(presets,"Voorkamer")
+-- local presets = evohome.helpers.loadpresets("c:/data/develop/domotica/code/evohome-presets.lua")
+-- evohome.helpers.setzonestate(presets,"Voorkamer",22)
+-- evohome.helpers.setzonestate(presets,"Voorkamer")
return evohome
diff --git a/tex/context/base/mkiv/util-jsn.lua b/tex/context/base/mkiv/util-jsn.lua
index e75b5cf5d..e5f83e06c 100644
--- a/tex/context/base/mkiv/util-jsn.lua
+++ b/tex/context/base/mkiv/util-jsn.lua
@@ -21,7 +21,7 @@ local format = string.format
local utfchar = utf.char
local concat = table.concat
-local tonumber, tostring, rawset, type = tonumber, tostring, rawset, type
+local tonumber, tostring, rawset, type, next = tonumber, tostring, rawset, type, next
local json = utilities.json or { }
utilities.json = json
diff --git a/tex/context/base/mkiv/util-prs.lua b/tex/context/base/mkiv/util-prs.lua
index 650a7ead6..48d59a9f3 100644
--- a/tex/context/base/mkiv/util-prs.lua
+++ b/tex/context/base/mkiv/util-prs.lua
@@ -566,14 +566,16 @@ function parsers.rfc4180splitter(specification)
local field = escaped + non_escaped + Cc("")
local record = Ct(field * (separator * field)^1)
local headerline = record * Cp()
- local wholeblob = Ct((newline^(specification.strict and -1 or 1) * record)^0)
+ local morerecords = (newline^(specification.strict and -1 or 1) * record)^0
+ local headeryes = Ct(morerecords)
+ local headernop = Ct(record * morerecords)
return function(data,getheader)
if getheader then
local header, position = lpegmatch(headerline,data)
- local data = lpegmatch(wholeblob,data,position)
+ local data = lpegmatch(headeryes,data,position)
return data, header
else
- return lpegmatch(wholeblob,data)
+ return lpegmatch(headernop,data)
end
end
end
@@ -604,10 +606,10 @@ local cardinal = lpegpatterns.cardinal / tonumber
local spacers = lpegpatterns.spacer^0
local endofstring = lpegpatterns.endofstring
-local stepper = spacers * ( C(cardinal) * ( spacers * S(":-") * spacers * ( C(cardinal) + Cc(true) ) + Cc(false) )
+local stepper = spacers * ( cardinal * ( spacers * S(":-") * spacers * ( cardinal + Cc(true) ) + Cc(false) )
* Carg(1) * Carg(2) / ranger * S(", ")^0 )^1
-local stepper = spacers * ( C(cardinal) * ( spacers * S(":-") * spacers * ( C(cardinal) + (P("*") + endofstring) * Cc(true) ) + Cc(false) )
+local stepper = spacers * ( cardinal * ( spacers * S(":-") * spacers * ( cardinal + (P("*") + endofstring) * Cc(true) ) + Cc(false) )
* Carg(1) * Carg(2) / ranger * S(", ")^0 )^1 * endofstring -- we're sort of strict (could do without endofstring)
function parsers.stepper(str,n,action)
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index d938ee449..f15f291ee 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -12,11 +12,12 @@ local strings = utilities.strings
local format, gsub, rep, sub, find = string.format, string.gsub, string.rep, string.sub, string.find
local load, dump = load, string.dump
-local tonumber, type, tostring = tonumber, type, tostring
+local tonumber, type, tostring, next = tonumber, type, tostring, next
local unpack, concat = table.unpack, table.concat
local P, V, C, S, R, Ct, Cs, Cp, Carg, Cc = lpeg.P, lpeg.V, lpeg.C, lpeg.S, lpeg.R, lpeg.Ct, lpeg.Cs, lpeg.Cp, lpeg.Carg, lpeg.Cc
local patterns, lpegmatch = lpeg.patterns, lpeg.match
-local utfchar, utfbyte = utf.char, utf.byte
+local utfchar, utfbyte, utflen = utf.char, utf.byte, utf.len
+
----- loadstripped = utilities.lua.loadstripped
----- setmetatableindex = table.setmetatableindex
@@ -145,6 +146,18 @@ function strings.tabtospace(str,tab)
return lpegmatch(pattern,str,1,tab or 7)
end
+function string.utfpadding(s,n)
+ if not n or n == 0 then
+ return ""
+ end
+ local l = utflen(s)
+ if n > 0 then
+ return nspaces[n-l]
+ else
+ return nspaces[-n-l]
+ end
+end
+
-- local t = {
-- "1234567123456712345671234567",
-- "\tb\tc",
@@ -281,41 +294,48 @@ end
--
-- More info can be found in cld-mkiv.pdf so here I stick to a simple list.
--
--- integer %...i number
--- integer %...d number
--- unsigned %...u number
--- character %...c number
--- hexadecimal %...x number
--- HEXADECIMAL %...X number
--- octal %...o number
--- string %...s string number
--- float %...f number
--- checked float %...F number
--- exponential %...e number
--- exponential %...E number
--- autofloat %...g number
--- autofloat %...G number
--- utf character %...c number
--- force tostring %...S any
--- force tostring %Q any
--- force tonumber %N number (strip leading zeros)
--- signed number %I number
--- rounded number %r number
--- 0xhexadecimal %...h character number
--- 0xHEXADECIMAL %...H character number
--- U+hexadecimal %...u character number
--- U+HEXADECIMAL %...U character number
--- points %p number (scaled points)
--- basepoints %b number (scaled points)
--- table concat %...t table
--- table concat %{.}t table
--- serialize %...T sequenced (no nested tables)
--- serialize %{.}T sequenced (no nested tables)
--- boolean (logic) %l boolean
--- BOOLEAN %L boolean
--- whitespace %...w
--- automatic %...a 'whatever' (string, table, ...)
--- automatic %...A "whatever" (string, table, ...)
+-- integer %...i number
+-- integer %...d number
+-- unsigned %...u number
+-- character %...c number
+-- hexadecimal %...x number
+-- HEXADECIMAL %...X number
+-- octal %...o number
+-- string %...s string number
+-- float %...f number
+-- checked float %...F number
+-- exponential %...e number
+-- exponential %...E number
+-- stripped e %...j number
+-- stripped E %...J number
+-- autofloat %...g number
+-- autofloat %...G number
+-- utf character %...c number
+-- force tostring %...S any
+-- force tostring %Q any
+-- force tonumber %N number (strip leading zeros)
+-- signed number %I number
+-- rounded number %r number
+-- 0xhexadecimal %...h character number
+-- 0xHEXADECIMAL %...H character number
+-- U+hexadecimal %...u character number
+-- U+HEXADECIMAL %...U character number
+-- points %p number (scaled points)
+-- basepoints %b number (scaled points)
+-- table concat %...t table
+-- table concat %{.}t table
+-- serialize %...T sequenced (no nested tables)
+-- serialize %{.}T sequenced (no nested tables)
+-- boolean (logic) %l boolean
+-- BOOLEAN %L boolean
+-- whitespace %...w number
+-- whitespace %...W (fixed)
+-- automatic %...a 'whatever' (string, table, ...)
+-- automatic %...A "whatever" (string, table, ...)
+-- zap %...z skip
+-- comma/period real %...m
+-- period/comma real %...M
+-- formatted float %...k n.m
local n = 0
@@ -520,6 +540,7 @@ local utfchar=utf.char
local utfbyte=utf.byte
local lpegmatch=lpeg.match
local nspaces=string.nspaces
+local utfpadding=string.utfpadding
local tracedchar=string.tracedchar
local autosingle=string.autosingle
local autodouble=string.autodouble
@@ -546,6 +567,7 @@ else
utfbyte = utf.byte,
lpegmatch = lpeg.match,
nspaces = string.nspaces,
+ utfpadding = string.utfpadding,
tracedchar = string.tracedchar,
autosingle = string.autosingle,
autodouble = string.autodouble,
@@ -597,6 +619,31 @@ local format_S = function(f) -- can be optimized
end
end
+local format_right = function(f)
+ n = n + 1
+ f = tonumber(f)
+ if not f or f == 0 then
+ return format("(a%s or '')",n)
+ elseif f > 0 then
+ return format("utfpadding(a%s,%i)..a%s",n,f,n)
+ else
+ return format("a%s..utfpadding(a%s,%i)",n,n,f)
+ end
+end
+
+local format_left = function(f)
+ n = n + 1
+ f = tonumber(f)
+ if not f or f == 0 then
+ return format("(a%s or '')",n)
+ end
+ if f < 0 then
+ return format("utfpadding(a%s,%i)..a%s",n,-f,n)
+ else
+ return format("a%s..utfpadding(a%s,%i)",n,n,-f)
+ end
+end
+
local format_q = function()
n = n + 1
return format("(a%s and format('%%q',a%s) or '')",n,n) -- goodie: nil check (maybe separate lpeg, not faster)
@@ -928,6 +975,9 @@ local builder = Cs { "start",
+ V("m") + V("M") -- new (formatted number)
+ V("z") -- new
--
+ + V(">") -- left padding
+ + V("<") -- right padding
+ --
-- + V("?") -- ignored, probably messed up %
)
+ V("*")
@@ -978,11 +1028,14 @@ local builder = Cs { "start",
["m"] = (prefix_tab * P("m")) / format_m, -- %m => xxx.xxx.xxx,xx (optional prefix instead of .)
["M"] = (prefix_tab * P("M")) / format_M, -- %M => xxx,xxx,xxx.xx (optional prefix instead of ,)
--
- ["z"] = (prefix_any * P("z")) / format_z, -- %M => xxx,xxx,xxx.xx (optional prefix instead of ,)
+ ["z"] = (prefix_any * P("z")) / format_z, -- %z => skip n arguments
--
["a"] = (prefix_any * P("a")) / format_a, -- %a => '...' (forces tostring)
["A"] = (prefix_any * P("A")) / format_A, -- %A => "..." (forces tostring)
--
+ ["<"] = (prefix_any * P("<")) / format_left,
+ [">"] = (prefix_any * P(">")) / format_right,
+ --
["*"] = Cs(((1-P("%"))^1 + P("%%")/"%%")^1) / format_rest, -- rest (including %%)
["?"] = Cs(((1-P("%"))^1 )^1) / format_rest, -- rest (including %%)
--
diff --git a/tex/context/base/mkiv/util-tpl.lua b/tex/context/base/mkiv/util-tpl.lua
index 468dd429c..5e75a151b 100644
--- a/tex/context/base/mkiv/util-tpl.lua
+++ b/tex/context/base/mkiv/util-tpl.lua
@@ -16,7 +16,7 @@ local templates = utilities.templates
local trace_template = false trackers.register("templates.trace",function(v) trace_template = v end)
local report_template = logs.reporter("template")
-local tostring = tostring
+local tostring, next = tostring, next
local format, sub, byte = string.format, string.sub, string.byte
local P, C, R, Cs, Cc, Carg, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.R, lpeg.Cs, lpeg.Cc, lpeg.Carg, lpeg.match, lpeg.patterns
diff --git a/tex/context/base/mkiv/util-you.lua b/tex/context/base/mkiv/util-you.lua
index 79a0e83e7..32a7e07d4 100644
--- a/tex/context/base/mkiv/util-you.lua
+++ b/tex/context/base/mkiv/util-you.lua
@@ -30,22 +30,43 @@ utilities.youless = youless
local lpegmatch = lpeg.match
local formatters = string.formatters
+local sortedhash = table.sortedhash
+
+local tonumber, type, next = tonumber, type, next
+
+local round, div = math.round, math.div
+local osdate, ostime = os.date, os.time
+
+local report = logs.reporter("youless")
+local trace = false
-- dofile("http.lua")
local http = socket.http
-local f_normal = formatters["http://%s/V?%s=%i&f=j"]
-local f_password = formatters["http://%s/L?w=%s"]
+-- f=j : json
+
+local f_password = formatters["http://%s/L?w=%s"]
-local function fetch(url,password,what,i)
- local url = f_normal(url,what,i)
- local data, h = http.request(url)
- local result = data and utilities.json.tolua(data)
- return result
+local f_fetchers = {
+ electricity = formatters["http://%s/V?%s=%i&f=j"],
+ gas = formatters["http://%s/W?%s=%i&f=j"],
+ pulse = formatters["http://%s/Z?%s=%i&f=j"],
+}
+
+local function fetch(url,password,what,i,category)
+ local fetcher = f_fetchers[category or "electricity"]
+ if not fetcher then
+ report("invalid fetcher %a",category)
+ else
+ local url = fetcher(url,what,i)
+ local data, h = http.request(url)
+ local result = data and utilities.json.tolua(data)
+ return result
+ end
end
--- "123" " 1,234"
+-- "123" " 23" " 1,234"
local tovalue = lpeg.Cs((lpeg.R("09") + lpeg.P(1)/"")^1) / tonumber
@@ -58,48 +79,99 @@ local totime = (lpeg.C(4) / tonumber) * lpeg.P("-")
* (lpeg.C(2) / tonumber) * lpeg.P(":")
* (lpeg.C(2) / tonumber)
-local function get(url,password,what,i,data,average,variant)
+local function collapsed(data,dirty)
+ for list, parent in next, dirty do
+ local t, n = { }, { }
+ for k, v in next, list do
+ local d = div(k,10) * 10
+ t[d] = (t[d] or 0) + v
+ n[d] = (n[d] or 0) + 1
+ end
+ for k, v in next, t do
+ t[k] = round(t[k]/n[k])
+ end
+ parent[1][parent[2]] = t
+ end
+ return data
+end
+
+local function get(url,password,what,step,data,option,category)
if not data then
data = { }
end
+ local dirty = { }
while true do
- local d = fetch(url,password,what,i)
- if d and next(d) then
+ local d = fetch(url,password,what,step,category)
+ local v = d and d.val
+ if v and #v > 0 then
local c_year, c_month, c_day, c_hour, c_minute, c_seconds = lpegmatch(totime,d.tm)
if c_year and c_seconds then
local delta = tonumber(d.dt)
- local tnum = os.time { year = c_year, month = c_month, day = c_day, hour = c_hour, minute = c_minute }
- local v = d.val
+ local tnum = ostime {
+ year = c_year,
+ month = c_month,
+ day = c_day,
+ hour = c_hour,
+ min = c_minute,
+ sec = c_seconds,
+ }
for i=1,#v do
- local newvalue = lpegmatch(tovalue,v[i])
- if newvalue then
- local t = tnum + (i-1)*delta
- local current = os.date("%Y-%m-%dT%H:%M:%S",t)
- local c_year, c_month, c_day, c_hour, c_minute, c_seconds = lpegmatch(totime,current)
- if c_year and c_seconds then
- local years = data.years if not years then years = { } data.years = years end
- local d_year = years[c_year] if not d_year then d_year = { } years[c_year] = d_year end
- local months = d_year.months if not months then months = { } d_year.months = months end
- local d_month = months[c_month] if not d_month then d_month = { } months[c_month] = d_month end
- local days = d_month.days if not days then days = { } d_month.days = days end
- local d_day = days[c_day] if not d_day then d_day = { } days[c_day] = d_day end
- if average then
- d_day.average = newvalue
- else
- local hours = d_day.hours if not hours then hours = { } d_day.hours = hours end
- local d_hour = hours[c_hour] if not d_hour then d_hour = { } hours[c_hour] = d_hour end
- d_hour[c_minute] = newvalue
+ local vi = v[i]
+ if vi ~= "*" then
+ local newvalue = lpegmatch(tovalue,vi)
+ if newvalue then
+ local t = tnum + (i-1)*delta
+ -- local current = osdate("%Y-%m-%dT%H:%M:%S",t)
+ -- local c_year, c_month, c_day, c_hour, c_minute, c_seconds = lpegmatch(totime,current)
+ local c = osdate("*t",tnum + (i-1)*delta)
+ local c_year = c.year
+ local c_month = c.month
+ local c_day = c.day
+ local c_hour = c.hour
+ local c_minute = c.min
+ local c_seconds = c.sec
+ if c_year and c_seconds then
+ local years = data.years if not years then years = { } data.years = years end
+ local d_year = years[c_year] if not d_year then d_year = { } years[c_year] = d_year end
+ local months = d_year.months if not months then months = { } d_year.months = months end
+ local d_month = months[c_month] if not d_month then d_month = { } months[c_month] = d_month end
+ local days = d_month.days if not days then days = { } d_month.days = days end
+ local d_day = days[c_day] if not d_day then d_day = { } days[c_day] = d_day end
+ if option == "average" or option == "total" then
+ if trace then
+ local oldvalue = d_day[option]
+ if oldvalue and oldvalue ~= newvalue then
+ report("category %s, step %i, time %s: old %s %s updated to %s",category,step,osdate("%Y-%m-%dT%H:%M:%S",t),option,oldvalue,newvalue)
+ end
+ end
+ d_day[option] = newvalue
+ elseif option == "value" then
+ local hours = d_day.hours if not hours then hours = { } d_day.hours = hours end
+ local d_hour = hours[c_hour] if not d_hour then d_hour = { } hours[c_hour] = d_hour end
+ if trace then
+ local oldvalue = d_hour[c_minute]
+ if oldvalue and oldvalue ~= newvalue then
+ report("category %s, step %i, time %s: old %s %s updated to %s",category,step,osdate("%Y-%m-%dT%H:%M:%S",t),"value",oldvalue,newvalue)
+ end
+ end
+ d_hour[c_minute] = newvalue
+ if not dirty[d_hour] then
+ dirty[d_hour] = { hours, c_hour }
+ end
+ else
+ -- can't happen
+ end
end
end
end
end
end
else
- return data
+ return collapsed(data,dirty)
end
- i = i + 1
+ step = step + 1
end
- return data
+ return collapsed(data,dirty)
end
-- day of month (kwh)
@@ -132,6 +204,7 @@ function youless.collect(specification)
local detail = specification.detail or false
local nobackup = specification.nobackup or false
local password = specification.password or ""
+ local oldstuff = false
if host == "" then
return
end
@@ -140,13 +213,36 @@ function youless.collect(specification)
else
data = table.load(filename) or data
end
- if variant == "kwh" then
- get(host,password,"m",1,data,true)
- elseif variant == "watt" then
- get(host,password,"d",0,data,true)
- get(host,password,"w",1,data)
+ if variant == "electricity" then
+ get(host,password,"m",1,data,"total","electricity")
+ if oldstuff then
+ get(host,password,"d",1,data,"average","electricity")
+ end
+ get(host,password,"w",1,data,"value","electricity")
if detail then
- get(host,password,"h",1,data) -- todo: get this for calculating the precise max
+ get(host,password,"h",1,data,"value","electricity") -- todo: get this for calculating the precise max
+ end
+ elseif variant == "pulse" then
+ -- It looks like the 'd' option returns the wrong values or at least not the same sort
+ -- as the other ones, so we calculate the means ourselves. And 'w' is not consistent with
+ -- that too, so ...
+ get(host,password,"m",1,data,"total","pulse")
+ if oldstuff then
+ get(host,password,"d",1,data,"average","pulse")
+ end
+ detail = true
+ get(host,password,"w",1,data,"value","pulse")
+ if detail then
+ get(host,password,"h",1,data,"value","pulse")
+ end
+ elseif variant == "gas" then
+ get(host,password,"m",1,data,"total","gas")
+ if oldstuff then
+ get(host,password,"d",1,data,"average","gas")
+ end
+ get(host,password,"w",1,data,"value","gas")
+ if detail then
+ get(host,password,"h",1,data,"value","gas")
end
else
return
@@ -164,15 +260,21 @@ function youless.collect(specification)
if type(check) == "table" then
local keepname = file.replacesuffix(filename,"old")
os.remove(keepname)
- if not lfs.isfile(keepname) then
+ if lfs.isfile(keepname) then
+ report("error in removing %a",keepname)
+ else
os.rename(filename,keepname)
os.rename(tempname,filename)
end
+ else
+ report("error in saving %a",tempname)
end
else
local keepname = file.join(path,formatters["%s-%s"](os.date("%Y-%m-%d-%H-%M-%S",os.time()),base))
os.rename(filename,keepname)
- if not lfs.isfile(filename) then
+ if lfs.isfile(filename) then
+ report("error in renaming %a",filename)
+ else
table.save(filename,data)
end
end
@@ -181,76 +283,111 @@ end
-- local data = youless.collect {
-- host = "192.168.2.50",
--- variant = "watt",
--- filename = "youless-watt.lua"
+-- variant = "electricity",
+-- category = "electricity",
+-- filename = "youless-electricity.lua"
-- }
-
+--
-- inspect(data)
-- local data = youless.collect {
--- host = "192.168.2.50",
--- variant = "kwh",
--- filename = "youless-kwh.lua"
+-- host = "192.168.2.50",
+-- variant = "pulse",
+-- category = "electricity",
+-- filename = "youless-pulse.lua"
-- }
+--
+-- inspect(data)
+-- local data = youless.collect {
+-- host = "192.168.2.50",
+-- variant = "gas",
+-- category = "gas",
+-- filename = "youless-gas.lua"
+-- }
+--
-- inspect(data)
+-- We remain compatible so we stick to electricity and not unit fields.
+
function youless.analyze(data)
- if data and data.variant == "watt" and data.years then
- for y, year in next, data.years do
- local a_year, n_year, m_year = 0, 0, 0
- if year.months then
- for m, month in next, year.months do
- local a_month, n_month = 0, 0
- if month.days then
- for d, day in next, month.days do
- local a_day, n_day = 0, 0
- if day.hours then
- for h, hour in next, day.hours do
- local a_hour, n_hour, m_hour = 0, 0, 0
- for k, v in next, hour do
- if type(k) == "number" then
- a_hour = a_hour + v
- n_hour = n_hour + 1
- if v > m_hour then
- m_hour = v
- end
+ if type(data) == "string" then
+ data = table.load(data)
+ end
+ if type(data) ~= "table" then
+ return false, "no data"
+ end
+ if not data.years then
+ return false, "no years"
+ end
+ local variant = data.variant
+ local unit, maxunit
+ if variant == "electricity" or variant == "watt" then
+ unit = "watt"
+ maxunit = "maxwatt"
+ elseif variant == "gas" then
+ unit = "liters"
+ maxunit = "maxliters"
+ elseif variant == "pulse" then
+ unit = "watt"
+ maxunit = "maxwatt"
+ else
+ return false, "invalid variant"
+ end
+ for y, year in next, data.years do
+ local a_year, n_year, m_year = 0, 0, 0
+ if year.months then
+ for m, month in next, year.months do
+ local a_month, n_month = 0, 0
+ if month.days then
+ for d, day in next, month.days do
+ local a_day, n_day = 0, 0
+ if day.hours then
+ for h, hour in next, day.hours do
+ local a_hour, n_hour, m_hour = 0, 0, 0
+ for k, v in next, hour do
+ if type(k) == "number" then
+ a_hour = a_hour + v
+ n_hour = n_hour + 1
+ if v > m_hour then
+ m_hour = v
end
end
- n_day = n_day + n_hour
- a_day = a_day + a_hour
- hour.maxwatt = m_hour
- hour.watt = a_hour / n_hour
- if m_hour > m_year then
- m_year = m_hour
- end
end
- end
- if n_day > 0 then
- a_month = a_month + a_day
- n_month = n_month + n_day
- day.watt = a_day / n_day
- else
- day.watt = 0
+ n_day = n_day + n_hour
+ a_day = a_day + a_hour
+ hour[maxunit] = m_hour
+ hour[unit] = a_hour / n_hour
+ if m_hour > m_year then
+ m_year = m_hour
+ end
end
end
- end
- if n_month > 0 then
- a_year = a_year + a_month
- n_year = n_year + n_month
- month.watt = a_month / n_month
- else
- month.watt = 0
+ if n_day > 0 then
+ a_month = a_month + a_day
+ n_month = n_month + n_day
+ day[unit] = a_day / n_day
+ else
+ day[unit] = 0
+ end
end
end
- end
- if n_year > 0 then
- year.watt = a_year / n_year
- year.maxwatt = m_year
- else
- year.watt = 0
- year.maxwatt = 0
+ if n_month > 0 then
+ a_year = a_year + a_month
+ n_year = n_year + n_month
+ month[unit] = a_month / n_month
+ else
+ month[unit] = 0
+ end
end
end
+ if n_year > 0 then
+ year[unit] = a_year / n_year
+ year[maxunit] = m_year
+ else
+ year[unit] = 0
+ year[maxunit] = 0
+ end
end
+ return data
end
diff --git a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
index cd474242f..bba07f41d 100644
--- a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
+++ b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv
@@ -40,8 +40,8 @@
\starttypescript[ebgaramond]
\definetypeface [ebgaramond] [rm] [serif] [ebgaramond] [default] [designsize=auto]
- \definetypeface [ebgaramond] [tt] [mono] [dejavu] [default]
- \definetypeface [ebgaramond] [mm] [math] [bonum] [default]
+ \definetypeface [ebgaramond] [tt] [mono] [dejavu] [default] [rscale=0.8] % rather arbitrary but seldom mixed anyway
+ \definetypeface [ebgaramond] [mm] [math] [bonum] [default] [rscale=0.8] % rather arbitrary but seldom mixed anyway
\stoptypescript
\stoptypescriptcollection
diff --git a/tex/context/interface/mkii/keys-cs.xml b/tex/context/interface/mkii/keys-cs.xml
index 93e6bb477..97c22dec7 100644
--- a/tex/context/interface/mkii/keys-cs.xml
+++ b/tex/context/interface/mkii/keys-cs.xml
@@ -627,6 +627,10 @@
<cd:constant name='align' value='zarovnani'/>
<cd:constant name='aligncharacter' value='aligncharacter'/>
<cd:constant name='alignmentcharacter' value='alignmentcharacter'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='zarovnejtitul'/>
<cd:constant name='alternative' value='alternativa'/>
@@ -913,6 +917,7 @@
<cd:constant name='leftoffset' value='levyoffset'/>
<cd:constant name='leftquotation' value='citacevlevo'/>
<cd:constant name='leftquote' value='citovatvlevo'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='vetavlevo'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='stylvlevo'/>
@@ -985,6 +990,7 @@
<cd:constant name='nlines' value='nradky'/>
<cd:constant name='norm' value='norm'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='nvpravo'/>
<cd:constant name='ntop' value='nvrsek'/>
@@ -1115,6 +1121,7 @@
<cd:constant name='rightoffset' value='pravyoffset'/>
<cd:constant name='rightquotation' value='citacevpravo'/>
<cd:constant name='rightquote' value='citovatvpravo'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='vetavpravo'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='stylvpravo'/>
diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml
index 99b58bc74..070844355 100644
--- a/tex/context/interface/mkii/keys-de.xml
+++ b/tex/context/interface/mkii/keys-de.xml
@@ -379,6 +379,7 @@
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normal'/>
<cd:variable name='nospacing' value='nospacing'/>
+ <cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='nicht'/>
<cd:variable name='notation' value='notation'/>
<cd:variable name='note' value='note'/>
@@ -627,6 +628,10 @@
<cd:constant name='align' value='ausrichtung'/>
<cd:constant name='aligncharacter' value='aligncharacter'/>
<cd:constant name='alignmentcharacter' value='alignmentcharacter'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='titelausrichten'/>
<cd:constant name='alternative' value='alternative'/>
@@ -913,6 +918,7 @@
<cd:constant name='leftoffset' value='linkeroffset'/>
<cd:constant name='leftquotation' value='linkerzitat'/>
<cd:constant name='leftquote' value='linkerzitieren'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='linkersatz'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='linkerstil'/>
@@ -985,6 +991,7 @@
<cd:constant name='nlines' value='zzeile'/>
<cd:constant name='norm' value='norm'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='nrechts'/>
<cd:constant name='ntop' value='noben'/>
@@ -1115,6 +1122,7 @@
<cd:constant name='rightoffset' value='rechterabstand'/>
<cd:constant name='rightquotation' value='rechterzitat'/>
<cd:constant name='rightquote' value='rechterzitieren'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='rechtersatz'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='rechterstil'/>
@@ -1171,7 +1179,9 @@
<cd:constant name='source' value='quelle'/>
<cd:constant name='space' value='spatium'/>
<cd:constant name='spaceafter' value='nachspatium'/>
+ <cd:constant name='spaceafterside' value='spaceafterside'/>
<cd:constant name='spacebefore' value='vorspatium'/>
+ <cd:constant name='spacebeforeside' value='spacebeforeside'/>
<cd:constant name='spaceinbetween' value='spaceinbetween'/>
<cd:constant name='spacing' value='spatiumausgleich'/>
<cd:constant name='specification' value='specification'/>
diff --git a/tex/context/interface/mkii/keys-en.xml b/tex/context/interface/mkii/keys-en.xml
index 3ac165945..d091a8fff 100644
--- a/tex/context/interface/mkii/keys-en.xml
+++ b/tex/context/interface/mkii/keys-en.xml
@@ -379,6 +379,7 @@
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normal'/>
<cd:variable name='nospacing' value='nospacing'/>
+ <cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='not'/>
<cd:variable name='notation' value='notation'/>
<cd:variable name='note' value='note'/>
@@ -627,6 +628,10 @@
<cd:constant name='align' value='align'/>
<cd:constant name='aligncharacter' value='aligncharacter'/>
<cd:constant name='alignmentcharacter' value='alignmentcharacter'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='aligntitle'/>
<cd:constant name='alternative' value='alternative'/>
@@ -913,6 +918,7 @@
<cd:constant name='leftoffset' value='leftoffset'/>
<cd:constant name='leftquotation' value='leftquotation'/>
<cd:constant name='leftquote' value='leftquote'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='leftsentence'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='leftstyle'/>
@@ -985,6 +991,7 @@
<cd:constant name='nlines' value='nlines'/>
<cd:constant name='norm' value='norm'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='nright'/>
<cd:constant name='ntop' value='ntop'/>
@@ -1004,6 +1011,7 @@
<cd:constant name='numberset' value='numberset'/>
<cd:constant name='numberstarter' value='numberstarter'/>
<cd:constant name='numberstopper' value='numberstopper'/>
+ <cd:constant name='numberstrut' value='numberstrut'/>
<cd:constant name='numberstyle' value='numberstyle'/>
<cd:constant name='numberwidth' value='numberwidth'/>
<cd:constant name='nx' value='nx'/>
@@ -1115,6 +1123,7 @@
<cd:constant name='rightoffset' value='rightoffset'/>
<cd:constant name='rightquotation' value='rightquotation'/>
<cd:constant name='rightquote' value='rightquote'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='rightsentence'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='rightstyle'/>
@@ -1171,7 +1180,9 @@
<cd:constant name='source' value='source'/>
<cd:constant name='space' value='space'/>
<cd:constant name='spaceafter' value='spaceafter'/>
+ <cd:constant name='spaceafterside' value='spaceafterside'/>
<cd:constant name='spacebefore' value='spacebefore'/>
+ <cd:constant name='spacebeforeside' value='spacebeforeside'/>
<cd:constant name='spaceinbetween' value='spaceinbetween'/>
<cd:constant name='spacing' value='spacing'/>
<cd:constant name='specification' value='specification'/>
@@ -1236,6 +1247,7 @@
<cd:constant name='titledistance' value='titledistance'/>
<cd:constant name='titleleft' value='titleleft'/>
<cd:constant name='titleright' value='titleright'/>
+ <cd:constant name='titlestrut' value='titlestrut'/>
<cd:constant name='titlestyle' value='titlestyle'/>
<cd:constant name='to' value='to'/>
<cd:constant name='toffset' value='toffset'/>
diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml
index 5c5d2f0fb..2b2256d46 100644
--- a/tex/context/interface/mkii/keys-fr.xml
+++ b/tex/context/interface/mkii/keys-fr.xml
@@ -627,6 +627,10 @@
<cd:constant name='align' value='alignement'/>
<cd:constant name='aligncharacter' value='caracterealigne'/>
<cd:constant name='alignmentcharacter' value='alignementcaractere'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='alignementtitre'/>
<cd:constant name='alternative' value='alternative'/>
@@ -913,6 +917,7 @@
<cd:constant name='leftoffset' value='decalagegauche'/>
<cd:constant name='leftquotation' value='citationgauche'/>
<cd:constant name='leftquote' value='citergauche'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='phrasegauche'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='leftstyle'/>
@@ -985,6 +990,7 @@
<cd:constant name='nlines' value='nlignes'/>
<cd:constant name='norm' value='norme'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='ndroite'/>
<cd:constant name='ntop' value='nsup'/>
@@ -1115,6 +1121,7 @@
<cd:constant name='rightoffset' value='rightoffset'/>
<cd:constant name='rightquotation' value='citationdroite'/>
<cd:constant name='rightquote' value='citerdroite'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='phrasedroite'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='styledroit'/>
diff --git a/tex/context/interface/mkii/keys-it.xml b/tex/context/interface/mkii/keys-it.xml
index b70b455d8..4ad49cc05 100644
--- a/tex/context/interface/mkii/keys-it.xml
+++ b/tex/context/interface/mkii/keys-it.xml
@@ -379,6 +379,7 @@
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normale'/>
<cd:variable name='nospacing' value='nospacing'/>
+ <cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='non'/>
<cd:variable name='notation' value='notation'/>
<cd:variable name='note' value='note'/>
@@ -627,6 +628,10 @@
<cd:constant name='align' value='allinea'/>
<cd:constant name='aligncharacter' value='allineacarattere'/>
<cd:constant name='alignmentcharacter' value='carattereallineamento'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='allineatitolo'/>
<cd:constant name='alternative' value='alternativa'/>
@@ -913,6 +918,7 @@
<cd:constant name='leftoffset' value='offsetsinistro'/>
<cd:constant name='leftquotation' value='citazionesinistra'/>
<cd:constant name='leftquote' value='menzionesinistra'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='frasesinistra'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='stilesinistra'/>
@@ -985,6 +991,7 @@
<cd:constant name='nlines' value='nrighe'/>
<cd:constant name='norm' value='norma'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='ndestra'/>
<cd:constant name='ntop' value='ncima'/>
@@ -1004,6 +1011,7 @@
<cd:constant name='numberset' value='numberset'/>
<cd:constant name='numberstarter' value='numberstarter'/>
<cd:constant name='numberstopper' value='numberstopper'/>
+ <cd:constant name='numberstrut' value='numberstrut'/>
<cd:constant name='numberstyle' value='stilenumero'/>
<cd:constant name='numberwidth' value='numberwidth'/>
<cd:constant name='nx' value='nx'/>
@@ -1115,6 +1123,7 @@
<cd:constant name='rightoffset' value='offsetdestro'/>
<cd:constant name='rightquotation' value='citazionedestra'/>
<cd:constant name='rightquote' value='menzionedestra'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='frasedestra'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='stiledestra'/>
@@ -1171,7 +1180,9 @@
<cd:constant name='source' value='origine'/>
<cd:constant name='space' value='spazio'/>
<cd:constant name='spaceafter' value='spaziodopo'/>
+ <cd:constant name='spaceafterside' value='spaceafterside'/>
<cd:constant name='spacebefore' value='spazioprima'/>
+ <cd:constant name='spacebeforeside' value='spacebeforeside'/>
<cd:constant name='spaceinbetween' value='spaceinbetween'/>
<cd:constant name='spacing' value='spaziatura'/>
<cd:constant name='specification' value='specification'/>
@@ -1236,6 +1247,7 @@
<cd:constant name='titledistance' value='distanzatitolo'/>
<cd:constant name='titleleft' value='titleleft'/>
<cd:constant name='titleright' value='titleright'/>
+ <cd:constant name='titlestrut' value='titlestrut'/>
<cd:constant name='titlestyle' value='stiletitolo'/>
<cd:constant name='to' value='verso'/>
<cd:constant name='toffset' value='toffset'/>
diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml
index 9d1416601..d6d1bc047 100644
--- a/tex/context/interface/mkii/keys-pe.xml
+++ b/tex/context/interface/mkii/keys-pe.xml
@@ -627,6 +627,10 @@
<cd:constant name='align' value='تنظیم'/>
<cd:constant name='aligncharacter' value='حرف‌تنظیم'/>
<cd:constant name='alignmentcharacter' value='حرف‌تنظیم‌کردن'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='عنوان‌تنظیم'/>
<cd:constant name='alternative' value='جایگزین'/>
@@ -913,6 +917,7 @@
<cd:constant name='leftoffset' value='آفست‌چپ'/>
<cd:constant name='leftquotation' value='نقل‌قول‌چپ'/>
<cd:constant name='leftquote' value='نقل‌چپ'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='جمله‌چپ'/>
<cd:constant name='leftspeech' value='سخنرانی‌چپ'/>
<cd:constant name='leftstyle' value='سبک‌چپ'/>
@@ -985,6 +990,7 @@
<cd:constant name='nlines' value='nlines'/>
<cd:constant name='norm' value='norm'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='nright'/>
<cd:constant name='ntop' value='ntop'/>
@@ -1115,6 +1121,7 @@
<cd:constant name='rightoffset' value='آفست‌راست'/>
<cd:constant name='rightquotation' value='نقل‌قول‌راست'/>
<cd:constant name='rightquote' value='نقل‌راست'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='جمله‌راست'/>
<cd:constant name='rightspeech' value='سخنرانی‌راست'/>
<cd:constant name='rightstyle' value='سبک‌راست'/>
@@ -1171,7 +1178,9 @@
<cd:constant name='source' value='منبع'/>
<cd:constant name='space' value='فضا'/>
<cd:constant name='spaceafter' value='فضا‌بعداز'/>
+ <cd:constant name='spaceafterside' value='spaceafterside'/>
<cd:constant name='spacebefore' value='فضا‌قبل‌از'/>
+ <cd:constant name='spacebeforeside' value='spacebeforeside'/>
<cd:constant name='spaceinbetween' value='فضا‌دربین'/>
<cd:constant name='spacing' value='فضاگذاری'/>
<cd:constant name='specification' value='specification'/>
diff --git a/tex/context/interface/mkii/keys-ro.xml b/tex/context/interface/mkii/keys-ro.xml
index 3e868e1aa..5fcab2cae 100644
--- a/tex/context/interface/mkii/keys-ro.xml
+++ b/tex/context/interface/mkii/keys-ro.xml
@@ -379,6 +379,7 @@
<cd:variable name='norepeat' value='norepeat'/>
<cd:variable name='normal' value='normal'/>
<cd:variable name='nospacing' value='nospacing'/>
+ <cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='nu'/>
<cd:variable name='notation' value='notation'/>
<cd:variable name='note' value='note'/>
@@ -627,6 +628,10 @@
<cd:constant name='align' value='aliniere'/>
<cd:constant name='aligncharacter' value='aliniazacaracter'/>
<cd:constant name='alignmentcharacter' value='alierecaracter'/>
+ <cd:constant name='alignmentleftsample' value='alignmentleftsample'/>
+ <cd:constant name='alignmentleftwidth' value='alignmentleftwidth'/>
+ <cd:constant name='alignmentrightsample' value='alignmentrightsample'/>
+ <cd:constant name='alignmentrightwidth' value='alignmentrightwidth'/>
<cd:constant name='alignsymbol' value='alignsymbol'/>
<cd:constant name='aligntitle' value='alinieretitlu'/>
<cd:constant name='alternative' value='alternativ'/>
@@ -913,6 +918,7 @@
<cd:constant name='leftoffset' value='offsetstanga'/>
<cd:constant name='leftquotation' value='citatstanga'/>
<cd:constant name='leftquote' value='minicitatstanga'/>
+ <cd:constant name='leftsample' value='leftsample'/>
<cd:constant name='leftsentence' value='propozitiestanga'/>
<cd:constant name='leftspeech' value='leftspeech'/>
<cd:constant name='leftstyle' value='stilstanga'/>
@@ -985,6 +991,7 @@
<cd:constant name='nlines' value='nlinii'/>
<cd:constant name='norm' value='norm'/>
<cd:constant name='note' value='note'/>
+ <cd:constant name='notes' value='notes'/>
<cd:constant name='nr' value='nr'/>
<cd:constant name='nright' value='ndreapta'/>
<cd:constant name='ntop' value='nsus'/>
@@ -1004,6 +1011,7 @@
<cd:constant name='numberset' value='numberset'/>
<cd:constant name='numberstarter' value='numberstarter'/>
<cd:constant name='numberstopper' value='numberstopper'/>
+ <cd:constant name='numberstrut' value='numberstrut'/>
<cd:constant name='numberstyle' value='stilnumar'/>
<cd:constant name='numberwidth' value='numberwidth'/>
<cd:constant name='nx' value='nx'/>
@@ -1115,6 +1123,7 @@
<cd:constant name='rightoffset' value='offsetdreapta'/>
<cd:constant name='rightquotation' value='citatdreapta'/>
<cd:constant name='rightquote' value='minicitatdreapta'/>
+ <cd:constant name='rightsample' value='rightsample'/>
<cd:constant name='rightsentence' value='propozitiedreapta'/>
<cd:constant name='rightspeech' value='rightspeech'/>
<cd:constant name='rightstyle' value='stildreapta'/>
@@ -1171,7 +1180,9 @@
<cd:constant name='source' value='sursa'/>
<cd:constant name='space' value='spatiu'/>
<cd:constant name='spaceafter' value='spatiudupa'/>
+ <cd:constant name='spaceafterside' value='spaceafterside'/>
<cd:constant name='spacebefore' value='spatiuinainte'/>
+ <cd:constant name='spacebeforeside' value='spacebeforeside'/>
<cd:constant name='spaceinbetween' value='spaceinbetween'/>
<cd:constant name='spacing' value='spatiere'/>
<cd:constant name='specification' value='specification'/>
@@ -1236,6 +1247,7 @@
<cd:constant name='titledistance' value='distantatitlu'/>
<cd:constant name='titleleft' value='titleleft'/>
<cd:constant name='titleright' value='titleright'/>
+ <cd:constant name='titlestrut' value='titlestrut'/>
<cd:constant name='titlestyle' value='stiltitlu'/>
<cd:constant name='to' value='catre'/>
<cd:constant name='toffset' value='toffset'/>
diff --git a/tex/context/interface/mkiv/context-en.xml b/tex/context/interface/mkiv/context-en.xml
index 9f47a1f53..e39caba78 100644
--- a/tex/context/interface/mkiv/context-en.xml
+++ b/tex/context/interface/mkiv/context-en.xml
@@ -10078,6 +10078,14 @@
<cd:constant type="none"/>
<cd:inherit name="blank"/>
</cd:parameter>
+ <cd:parameter name="spacebeforeside">
+ <cd:constant type="none"/>
+ <cd:inherit name="blank"/>
+ </cd:parameter>
+ <cd:parameter name="spaceafterside">
+ <cd:constant type="none"/>
+ <cd:inherit name="blank"/>
+ </cd:parameter>
<cd:parameter name="sidethreshold">
<cd:constant type="old"/>
<cd:constant default="yes" type="dimension"/>
@@ -15744,7 +15752,7 @@
</cd:assignments>
</cd:arguments>
</cd:command>
- <cd:command _error_="category=&quot;fonts&quot; file=&quot;typo-drp.mkiv&quot;" level="style" name="setupinitial">
+ <cd:command category="fonts" file="typo-drp.mkiv" level="style" name="setupinitial">
<cd:arguments>
<cd:keywords list="yes" optional="yes">
<cd:constant type="cd:name"/>
@@ -17105,6 +17113,7 @@
<cd:constant type="joinedup"/>
<cd:constant type="serried"/>
<cd:constant type="stopper"/>
+ <cd:constant type="nostopper"/>
<cd:constant type="unpacked"/>
<cd:constant type="repeat"/>
<cd:constant type="norepeat"/>
@@ -34026,6 +34035,7 @@
<cd:constant type="no"/>
<cd:constant type="hidden"/>
<cd:constant type="empty"/>
+ <cd:constant type="section"/>
</cd:parameter>
<cd:parameter name="number">
<cd:constant default="yes" type="yes"/>
@@ -35808,6 +35818,7 @@
<cd:command file="supp-box.mkiv" level="system" name="strutht"/>
<cd:command file="supp-box.mkiv" level="system" name="strutwd"/>
<cd:command file="supp-box.mkiv" level="system" name="struthtdp"/>
+ <cd:command file="supp-box.mkiv" level="system" name="strutgap"/>
<cd:command file="spac-ver.mkiv" level="style" name="setupstruts">
<cd:arguments>
<cd:keywords optional="yes">
diff --git a/tex/context/interface/mkiv/i-backend.xml b/tex/context/interface/mkiv/i-backend.xml
index ff52eed7d..5db77b5bd 100644
--- a/tex/context/interface/mkiv/i-backend.xml
+++ b/tex/context/interface/mkiv/i-backend.xml
@@ -86,4 +86,4 @@
</cd:arguments>
</cd:command>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf
index 4301961ca..0dfec2ab9 100644
--- a/tex/context/interface/mkiv/i-context.pdf
+++ b/tex/context/interface/mkiv/i-context.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-floats.xml b/tex/context/interface/mkiv/i-floats.xml
index c05fae69f..977ed3aa7 100644
--- a/tex/context/interface/mkiv/i-floats.xml
+++ b/tex/context/interface/mkiv/i-floats.xml
@@ -170,6 +170,14 @@
<cd:constant type="none"/>
<cd:inherit name="blank"/>
</cd:parameter>
+ <cd:parameter name="spacebeforeside">
+ <cd:constant type="none"/>
+ <cd:inherit name="blank"/>
+ </cd:parameter>
+ <cd:parameter name="spaceafterside">
+ <cd:constant type="none"/>
+ <cd:inherit name="blank"/>
+ </cd:parameter>
<cd:parameter name="sidethreshold">
<cd:constant type="old"/>
<cd:constant type="dimension" default="yes"/> <!-- value=".5\strutdp" -->
@@ -782,4 +790,4 @@
</cd:arguments>
</cd:command>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-initial.xml b/tex/context/interface/mkiv/i-initial.xml
index 7f0993acc..6c0dd7657 100644
--- a/tex/context/interface/mkiv/i-initial.xml
+++ b/tex/context/interface/mkiv/i-initial.xml
@@ -14,7 +14,7 @@
</cd:arguments>
</cd:command>
- <cd:command name="setupinitial" level="style"category="fonts" file="typo-drp.mkiv">
+ <cd:command name="setupinitial" level="style" category="fonts" file="typo-drp.mkiv">
<cd:arguments>
<cd:resolve name="keyword-name-list-optional"/>
<cd:assignments list="yes">
@@ -78,4 +78,4 @@
</cd:arguments>
</cd:command>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-itemgroup.xml b/tex/context/interface/mkiv/i-itemgroup.xml
index b811592be..84cae20bb 100644
--- a/tex/context/interface/mkiv/i-itemgroup.xml
+++ b/tex/context/interface/mkiv/i-itemgroup.xml
@@ -43,6 +43,7 @@
<cd:constant type="joinedup"/>
<cd:constant type="serried"/>
<cd:constant type="stopper"/>
+ <cd:constant type="nostopper"/>
<cd:constant type="unpacked"/>
<cd:constant type="repeat"/>
<cd:constant type="norepeat"/>
@@ -599,4 +600,4 @@
-->
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf
index 95cf9aa50..d98590aeb 100644
--- a/tex/context/interface/mkiv/i-readme.pdf
+++ b/tex/context/interface/mkiv/i-readme.pdf
Binary files differ
diff --git a/tex/context/interface/mkiv/i-section.xml b/tex/context/interface/mkiv/i-section.xml
index c2c8bbdd5..f3cf13d3e 100644
--- a/tex/context/interface/mkiv/i-section.xml
+++ b/tex/context/interface/mkiv/i-section.xml
@@ -112,6 +112,7 @@
<cd:constant type="no"/>
<cd:constant type="hidden"/>
<cd:constant type="empty"/>
+ <cd:constant type="section"/>
</cd:parameter>
<cd:parameter name="number">
<cd:constant type="yes" default="yes"/>
diff --git a/tex/context/interface/mkiv/i-strut.xml b/tex/context/interface/mkiv/i-strut.xml
index ff200e4db..0653dd214 100644
--- a/tex/context/interface/mkiv/i-strut.xml
+++ b/tex/context/interface/mkiv/i-strut.xml
@@ -12,6 +12,8 @@
<cd:command name="struthtdp" level="system" file="supp-box.mkiv"/>
+ <cd:command name="strutgap" level="system" file="supp-box.mkiv"/>
+
<cd:command name="setupstruts" level="style" file="spac-ver.mkiv">
<cd:arguments>
<cd:keywords optional="yes">
@@ -60,4 +62,4 @@
<cd:command name="strut" type="environment" begin="beg" end="end" level="system" file="spac-ver.mkiv"/>
-</cd:interface> \ No newline at end of file
+</cd:interface>
diff --git a/tex/context/interface/mkiv/i-todo.xml b/tex/context/interface/mkiv/i-todo.xml
new file mode 100644
index 000000000..a3d17515f
--- /dev/null
+++ b/tex/context/interface/mkiv/i-todo.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+
+<!--
+
+ page-ffl.mkiv:
+
+ \startfacingfloat[tag] ... \stopfacingfloat
+ \definefacingfloat
+ \setupfacingfloat
+
+ keywords: spaceinbetween inbetween style color page
+
+ typo-pnc.mkiv
+
+ \setperiodkerning
+ \resetperiodkerning
+ \defineperiodkerning
+
+ keywords: factor
+
+-->
diff --git a/tex/context/modules/mkiv/m-timing.mkiv b/tex/context/modules/mkiv/m-timing.mkiv
index 5502768f6..404d5bae0 100644
--- a/tex/context/modules/mkiv/m-timing.mkiv
+++ b/tex/context/modules/mkiv/m-timing.mkiv
@@ -31,7 +31,7 @@
\definecolor[usage:time] [darkblue]
\definecolor[usage:frame][darkgray]
-\ctxloadluafile{trac-tim}{}
+\ctxloadluafile{trac-tim}
\startluacode
local progress = moduledata.progress
diff --git a/tex/context/modules/mkiv/m-typesetting.mkiv b/tex/context/modules/mkiv/m-typesetting.mkiv
index 34713fa38..56cf85bbe 100644
--- a/tex/context/modules/mkiv/m-typesetting.mkiv
+++ b/tex/context/modules/mkiv/m-typesetting.mkiv
@@ -21,19 +21,30 @@
\definecombination
[fourpages]
+ [twopages]
[distance=.5\bodyfontsize,
width=\textwidth]
\definecombination
[sixpages]
+ [twopages]
[distance=.5\bodyfontsize,
width=\textwidth]
+\definemeasure[firstpages][\dimexpr\dimexpr\textwidth-1 \bodyfontsize\relax/2\relax]
\definemeasure[twopages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
\definemeasure[fourpages] [\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
\definemeasure[sixpages] [\dimexpr\dimexpr\textwidth-2.5\bodyfontsize\relax/6\relax]
\definemeasure[eightpages][\dimexpr\dimexpr\textwidth-3 \bodyfontsize\relax/4\relax]
+\starttexdefinition unexpanded WhenValidPage#1
+ \ifnum#1>\noffigurepages\relax
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi
+\stoptexdefinition
+
\starttexdefinition unexpanded OnePage #1
\startlinecorrection[blank]
\startcombination[twopages][1*1]
@@ -42,6 +53,15 @@
\stoplinecorrection
\stoptexdefinition
+\starttexdefinition unexpanded FirstPages #1
+ \startlinecorrection[blank]
+ \startcombination[twopages][2*1]
+ {\typesetfile[#1.tex][page=1,width=\measure{firstpages}]} {1}
+ {\typesetfile[#1.tex][page=2,width=\measure{firstpages}]} {2}
+ \stopcombination
+ \stoplinecorrection
+\stoptexdefinition
+
\starttexdefinition unexpanded OneSpread #1
\startlinecorrection[blank]
\startcombination[twopages][1*1]
@@ -71,10 +91,10 @@
\starttexdefinition unexpanded FourPages #1
\startlinecorrection[blank]
\startcombination[fourpages][4*1]
- {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
- {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
+ {\typesetfile[#1.tex][page=1,width=\measure{fourpages}]} {1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{fourpages}]}} {\WhenValidPage{2}{2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
@@ -82,10 +102,10 @@
\starttexdefinition unexpanded FourSpread #1
\startlinecorrection[blank]
\startcombination[fourpages][4*1]
- {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{fourpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{fourpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{fourpages}]} {5}
+ {\typesetfile[#1.tex][page=2,width=\measure{fourpages}]} {2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{fourpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{fourpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{fourpages}]}} {\WhenValidPage{5}{5}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
@@ -93,12 +113,12 @@
\starttexdefinition unexpanded SixPages #1
\startlinecorrection[blank]
\startcombination[sixpages][6*1]
- {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
- {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
- {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
+ {\typesetfile[#1.tex][page=1,width=\measure{sixpages}]} {1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{sixpages}]}} {\WhenValidPage{2}{2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
@@ -106,12 +126,12 @@
\starttexdefinition unexpanded SixSpread #1
\startlinecorrection[blank]
\startcombination[sixpages][6*1]
- {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
- {\typesetfile[#1.tex][page=3,width=\measure{sixpages}]} {3}
- {\typesetfile[#1.tex][page=4,width=\measure{sixpages}]} {4}
- {\typesetfile[#1.tex][page=5,width=\measure{sixpages}]} {5}
- {\typesetfile[#1.tex][page=6,width=\measure{sixpages}]} {6}
- {\typesetfile[#1.tex][page=7,width=\measure{sixpages}]} {7}
+ {\typesetfile[#1.tex][page=2,width=\measure{sixpages}]} {2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{sixpages}]}} {\WhenValidPage{3}{3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{sixpages}]}} {\WhenValidPage{4}{4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{sixpages}]}} {\WhenValidPage{5}{5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{sixpages}]}} {\WhenValidPage{6}{6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{sixpages}]}} {\WhenValidPage{7}{7}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
@@ -119,14 +139,14 @@
\starttexdefinition unexpanded EightPages #1
\startlinecorrection[blank]
\startcombination[fourpages][4*2]
- {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
- {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
- {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
- {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
- {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
- {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
- {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
- {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
+ {\typesetfile[#1.tex][page=1,width=\measure{eightpages}]} {#1 / 1}
+ {\WhenValidPage{2}{\typesetfile[#1.tex][page=2,width=\measure{eightpages}]}} {\WhenValidPage{2}{#1 / 2}}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
+ {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
@@ -134,14 +154,14 @@
\starttexdefinition unexpanded EightSpread #1
\startlinecorrection[blank]
\startcombination[fourpages][4*2]
- {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
- {\typesetfile[#1.tex][page=3,width=\measure{eightpages}]} {#1 / 3}
- {\typesetfile[#1.tex][page=4,width=\measure{eightpages}]} {#1 / 4}
- {\typesetfile[#1.tex][page=5,width=\measure{eightpages}]} {#1 / 5}
- {\typesetfile[#1.tex][page=6,width=\measure{eightpages}]} {#1 / 6}
- {\typesetfile[#1.tex][page=7,width=\measure{eightpages}]} {#1 / 7}
- {\typesetfile[#1.tex][page=8,width=\measure{eightpages}]} {#1 / 8}
- {\typesetfile[#1.tex][page=9,width=\measure{eightpages}]} {#1 / 9}
+ {\typesetfile[#1.tex][page=2,width=\measure{eightpages}]} {#1 / 2}
+ {\WhenValidPage{3}{\typesetfile[#1.tex][page=3,width=\measure{eightpages}]}} {\WhenValidPage{3}{#1 / 3}}
+ {\WhenValidPage{4}{\typesetfile[#1.tex][page=4,width=\measure{eightpages}]}} {\WhenValidPage{4}{#1 / 4}}
+ {\WhenValidPage{5}{\typesetfile[#1.tex][page=5,width=\measure{eightpages}]}} {\WhenValidPage{5}{#1 / 5}}
+ {\WhenValidPage{6}{\typesetfile[#1.tex][page=6,width=\measure{eightpages}]}} {\WhenValidPage{6}{#1 / 6}}
+ {\WhenValidPage{7}{\typesetfile[#1.tex][page=7,width=\measure{eightpages}]}} {\WhenValidPage{7}{#1 / 7}}
+ {\WhenValidPage{8}{\typesetfile[#1.tex][page=8,width=\measure{eightpages}]}} {\WhenValidPage{8}{#1 / 8}}
+ {\WhenValidPage{9}{\typesetfile[#1.tex][page=9,width=\measure{eightpages}]}} {\WhenValidPage{9}{#1 / 9}}
\stopcombination
\stoplinecorrection
\stoptexdefinition
diff --git a/tex/context/modules/mkiv/s-evohome.mkiv b/tex/context/modules/mkiv/s-evohome.mkiv
index e5c2ae6bb..1b1dc2c81 100644
--- a/tex/context/modules/mkiv/s-evohome.mkiv
+++ b/tex/context/modules/mkiv/s-evohome.mkiv
@@ -11,25 +11,20 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% in cronjob on one of the servers:
-%
-% mtxrun --script youless --collect --host=192.168.2.50 --watt youless-watt.lua
-% mtxrun --script youless --collect --host=192.168.2.50 --kwk youless-kwh.lua
-
\setupbodyfont[dejavu]
\starttext
\startluacode
-require("util-evo")
+local evohome = require("util-evo")
moduledata.evohome = { }
function moduledata.evohome.status(specification)
- local presets = utilities.evohome.loadpresets(specification.presets)
- local zones = utilities.evohome.loadtemperatures(presets)
+ local presets = evohome.helpers.loadpresets(specification.presets)
+ local zones = evohome.helpers.loadtemperatures(presets)
-- todo : time
@@ -65,8 +60,9 @@ function moduledata.evohome.status(specification)
for i=1,#zones do
local zone = zones[i]
- local data = utilities.evohome.getzonestate(presets,zone.name)
- local schedule = data.schedule or { }
+-- evohome.helpers.updatezone(presets,zone.name)
+ local data = evohome.helpers.getzonestate(presets,zone.name)
+ local schedule = data and data.schedule or { }
context.startsubject { title = zone.name }
context.starttabulate { "|l|c|c|" }
context.BC() context("day")
@@ -101,8 +97,8 @@ end
function moduledata.evohome.history(specification)
- local presets = utilities.evohome.loadpresets(specification.presets)
- local zones = utilities.evohome.loadtemperatures(presets)
+ local presets = evohome.helpers.loadpresets(specification.presets)
+ local zones = evohome.helpers.loadtemperatures(presets)
if not zones then
context("no zones")
@@ -110,7 +106,7 @@ function moduledata.evohome.history(specification)
return
end
- local data = utilities.evohome.loadhistory(presets)
+ local data = evohome.helpers.loadhistory(presets)
if not zones then
context("no history")
@@ -279,7 +275,7 @@ end
local specification = {
year = 2017,
-- month = 11,
- presets = "c:/data/develop/domotica/code/evohome-presets.lua",
+ presets = "c:/data/develop/domotica/evohome/evohome-presets.lua",
}
moduledata.evohome.status (specification)
diff --git a/tex/context/modules/mkiv/s-fonts-ligatures.mkiv b/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
index fc49ec5c5..6a5da48ea 100644
--- a/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-ligatures.mkiv
@@ -156,12 +156,12 @@
\stoptexdefinition
\starttexdefinition showotfligaturesexample #1#2
- \ctxlua{document.currentdiscexpansion = fonts.getdiscexpansion()}%
+ % \ctxlua{document.currentdiscexpansion = fonts.getdiscexpansion()}%
\showotfligaturescaptions {#1}
\showotfligatureslines {#2}
\showotfligaturesparagraphs{#2}
\showotfligaturesextremes {#2}
- \ctxlua{fonts.setdiscexpansion(document.currentdiscexpansion)}%
+ % \ctxlua{fonts.setdiscexpansion(document.currentdiscexpansion)}%
\stoptexdefinition
% todo: n -> and split in lua
diff --git a/tex/context/modules/mkiv/s-fonts-variable.mkiv b/tex/context/modules/mkiv/s-fonts-variable.mkiv
index 1a826314d..5c9d53d33 100644
--- a/tex/context/modules/mkiv/s-fonts-variable.mkiv
+++ b/tex/context/modules/mkiv/s-fonts-variable.mkiv
@@ -73,10 +73,6 @@
\stopbuffer
\showfontvariations
- [font=file:VotoSerifGX.ttf,
- ]% max=6]
-
- \showfontvariations
[font=file:adobevfprototype.otf]
\showfontvariations
@@ -85,9 +81,9 @@
\showfontvariations
[font=file:DecoVar-VF.ttf]
- \showfontvariations
- [font=file:VotoSerifGX.ttf,
- max=15]
+ % \showfontvariations
+ % [font=file:VotoSerifGX.ttf,
+ % max=15]
\showfontvariations
[font=file:Selawik-Variable.ttf]
@@ -109,6 +105,6 @@
% [font=file:AmstelvarAlpha-VF.ttf]
\showfontvariations
- [font=file:bahnshrift.ttf]
+ [font=file:bahnschrift.ttf]
\stoptext
diff --git a/tex/context/modules/mkiv/s-youless.mkiv b/tex/context/modules/mkiv/s-youless.mkiv
index e15973b9c..d8b6e2ff6 100644
--- a/tex/context/modules/mkiv/s-youless.mkiv
+++ b/tex/context/modules/mkiv/s-youless.mkiv
@@ -23,125 +23,165 @@
% in cronjob on one of the servers:
%
-% mtxrun --script youless --collect --host=192.168.2.50 --watt youless-watt.lua
-% mtxrun --script youless --collect --host=192.168.2.50 --kwk youless-kwh.lua
+% mtxrun --script youless --collect --host=192.168.2.50 --nobackup --electricity youless-electricity.lua
\startluacode
require("util-you")
- moduledata.youless = { }
+ local round = math.round
- function moduledata.youless.kwh(specification)
- -- todo
- end
+ moduledata.youless = { }
- function moduledata.youless.watt(specification)
+ local function process(specification)
- local year = tonumber(specification.year) or os.today().year
- local data = table.load(specification.filename or "youless-watt.lua")
+ local data, message = utilities.youless.analyze(specification.filename or "youless-electricity.lua")
- if not data or data.variant ~= "watt" then
- context("invalid variant")
+ if not data then
+ context(message)
return
end
- utilities.youless.analyze(data)
-
- -- for the moment no specific font scaling
-
- local years = data.years
-
- if not years then
- context("no years")
- return
+ local year = tonumber(specification.year) or os.today().year
+ local years = data.years
+ local variant = data.variant
+ local unit = specification.unit
+ local maxunit = specification.maxunit
+
+ local max = specification[maxunit]
+
+ if not max then
+ if unit == "watt" then
+ max = 10000
+ elseif unit == "liters" then
+ max = 1000
+ else
+ max = 5000 -- can't happen
+ end
end
- for y=year,year do
-
- local year = years[y]
- local scale = 20
- local mark = 3
- local maxwatt = specification.maxwatt or year.maxwatt
-
- for m=1,12 do
- local month = year.months[m]
- if month then
- context.startMPpage { offset = "10pt" }
- context("linecap := butt; pickup pencircle scaled .5")
+ local max = max
+ local delta = round(max/10)
+ local scale = round(delta/20)
+ local mark = 3
- for i=0,(math.div(maxwatt,1000)+1)*1000,100 do
- context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",0,i/scale,31 * 24,i/scale)
- end
+ for y=year,year do
+ local year = years[y]
+ if year then
+ local grand = 0
+ for m=1,12 do
+ local month = year.months[m]
+ if month then
+ context.startMPpage { offset = "10pt" }
+ context("linecap := butt; pickup pencircle scaled .5")
+
+ for i=0,(math.div(max,delta)+1)*delta,delta/10 do
+ context("draw (%s,%s) -- (%s,%s) withcolor .6white ;",0,i/scale,31 * 24,i/scale)
+ end
- context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(on 6 off 6) withcolor darkgreen withpen pencircle scaled 1 ;",year.watt /scale,year.watt /scale)
- context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(off 6 on 6) withcolor darkred withpen pencircle scaled 1 ;",month.watt/scale,month.watt/scale)
-
- local days = month.days
- if days then
- local nd = os.nofdays(y,m)
- for d=1,nd do
- local day = days[d]
- local xoffset = (d-1) * 24
- local wd = os.weekday(d,m,y)
- local weekend = wd == 1 or wd == 7
- if not weekend then
- -- okay
- elseif mark == 1 then
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset, -32.5)
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset+24,-17.5,xoffset+24,-32.5)
- elseif mark == 2 then
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset+24,-17.5)
- context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -32.5,xoffset+24,-32.5)
- elseif mark == 3 then
- context("draw unitsquare xysized (%s,%s) shifted (%s,%s) ; ",24,15,xoffset,-32.5)
- end
- context([[draw textext("%s") shifted (%s,%s) ; ]],d,xoffset + 12,-25)
- if day then
- for h=0,23 do
- local hours = day.hours
- if hours then
- local hour = hours[h]
- if hour then
- local dx = xoffset + h
- local dy = hour.watt/scale
- local dm = hour.maxwatt/scale
- context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",dx, 0,dx,dy,weekend and "darkmagenta" or "darkblue")
- context("draw (%s,%s) -- (%s,%s) withcolor %s ; ",dx,dy,dx,dm,"darkgray")
+ context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(on 6 off 6) withcolor darkgreen withpen pencircle scaled 1 ;",year [unit]/scale,year [unit]/scale)
+ context("draw (0,%s) -- (31 * 24,%s) dashed dashpattern(off 6 on 6) withcolor darkred withpen pencircle scaled 1 ;",month[unit]/scale,month[unit]/scale)
+
+ local days = month.days
+ local total = 0
+ if days then
+ local nd = os.nofdays(y,m)
+ for d=1,nd do
+ local day = days[d]
+ local xoffset = (d-1) * 24
+ local wd = os.weekday(d,m,y)
+ local weekend = wd == 1 or wd == 7
+ if not weekend then
+ -- okay
+ elseif mark == 1 then
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset, -17.5,xoffset, -32.5)
+ context("draw (%s,%s) -- (%s,%s) ; ",xoffset+24,-17.5,xoffset+24,-32.5)
+ elseif mark == 2 then
+ context("draw (%s,%s) -- (%s,%s) ;",xoffset, -17.5,xoffset+24,-17.5)
+ context("draw (%s,%s) -- (%s,%s) ;",xoffset, -32.5,xoffset+24,-32.5)
+ elseif mark == 3 then
+ context("draw unitsquare xysized (%s,%s) shifted (%s,%s) ;",24,15,xoffset,-32.5)
+ end
+ context([[draw textext("\strut%s") shifted (%s,%s) ;]],d,xoffset + 12,-25)
+ if day then
+ for h=0,23 do
+ local hours = day.hours
+ if hours then
+ local hour = hours[h]
+ if hour then
+ local dx = xoffset + h
+ local dy = hour[unit]/scale
+ local dm = hour[maxunit]/scale
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ;",dx, 0,dx,dy,weekend and "darkmagenta" or "darkblue")
+ context("draw (%s,%s) -- (%s,%s) withcolor %s ;",dx,dy,dx,dm,"darkgray")
+ end
end
end
+ local use = day.total
+ if use then
+ context([[draw textext("\strut\small\small\small%0.1f") shifted (%s,%s) ;]],use/1000,xoffset + 12,-7.5)
+ total = total + use
+ end
end
end
+ for d=0,30 do
+ local xoffset = d * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+ 0,0,xoffset+ 0,-10)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+ 6,0,xoffset+ 6,-2.5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+12,0,xoffset+12,-5)
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset+18,0,xoffset+18,-2.5)
+ end
+ local xoffset = 31 * 24
+ context("draw (%s,%s) -- (%s,%s) withcolor darkgray ;",xoffset,0,xoffset,-10)
end
- for d=0,30 do
- local xoffset = d * 24
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 0,0,xoffset+ 0,-10)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+ 6,0,xoffset+ 6,-2.5)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+12,0,xoffset+12,-5)
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset+18,0,xoffset+18,-2.5)
- end
- local xoffset = 31 * 24
- context("draw (%s,%s) -- (%s,%s) withcolor darkgray ; ",xoffset,0,xoffset,-10)
- end
- local max = (math.div(maxwatt,1000)+1)
+ grand = grand + total
- for i=0,max*1000,1000 do
- context([[draw textext.lft("%s") shifted (%s,%s) ; ]],i,-10,i/scale)
- context("draw (%s,%s) -- (%s,%s) withcolor .2white ;",0,i/scale,31 * 24,i/scale)
- end
+ local max = (math.div(max,delta))
+
+ for i=0,max*delta,delta do
+ if i > 0 then
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut%r}") shifted (%s,%s) ; ]],i,-10,i/scale)
+ end
+ context("draw (%s,%s) -- (%s,%s) withcolor .2white ;",0,i/scale,31 * 24,i/scale)
+ end
- context([[draw textext("\strut\month{%s}\enspace%s") shifted (%s,%s) ; ]],m, y, 31 * 24 / 2, -50)
- context([[draw textext.lft("watt") shifted (%s,%s) ; ]],-10,-25)
+ context([[draw textext ("\strut\Word{%s}\enspace\emdash\enspace\month{%s}\enspace%s") shifted (%s,%s) ; ]],variant, m, y, 31 * 24 / 2, -50)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut%s}") shifted (%s,%s) ; ]],unit,-10,-25)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut\small\small\small%0.1f %s}") shifted (%s,%s) ;]],total/1000,unit == "watt" and "kWh" or [[m\high{3}]],-10, -7.5)
+ context([[draw textext.lft("\hbox to 3.5em{\hss\strut\small\small\small\Sigma\nbsp%0.1f %s}") shifted (%s,%s) ;]],grand/1000,unit == "watt" and "kWh" or [[m\high{3}]],-10,-50.0)
- context.stopMPpage()
- else
- -- maybe placeholder
+ context.stopMPpage()
+ else
+ -- maybe placeholder
+ end
end
end
-
end
+ end
+
+ function moduledata.youless.kwh(specification)
+ -- todo
+ end
+
+ function moduledata.youless.electricity(specification)
+ specification.unit = "watt"
+ specification.maxunit = "maxwatt"
+ process(specification)
+ end
+
+ moduledata.youless.watt = moduledata.youless.electricity
+
+ function moduledata.youless.gas(specification)
+ specification.unit = "liters"
+ specification.maxunit = "maxliters"
+ process(specification)
+ end
+ function moduledata.youless.pulse(specification)
+ specification.unit = "watt"
+ specification.maxunit = "maxwatt"
+ process(specification)
end
\stopluacode
@@ -160,11 +200,11 @@
\startluacode
- -- os.execute([[mtxrun --script youless --collect --watt "c:/data/system/youless/data/youless-watt.lua"]])
- -- os.execute([[mtxrun --script youless --collect --watt --nobackup "c:/data/system/youless/data/youless-watt.lua"]])
- -- moduledata.youless.watt { year = 2013, filename = "c:/data/system/youless/data/youless-watt.lua" }
+ -- os.execute([[mtxrun --script youless --collect --electricity "c:/data/system/youless/data/youless-electricity.lua"]])
+ -- os.execute([[mtxrun --script youless --collect --electricity --nobackup "c:/data/system/youless/data/youless-electricity.lua"]])
+ -- moduledata.youless.electricity { year = 2017, filename = "c:/data/system/youless/data/youless-electricity.lua" }
- moduledata.youless.watt { year = 2013, filename = "youless-watt.lua" }
+ moduledata.youless.electricity { year = 2017, filename = "youless-electricity.lua" }
\stopluacode
diff --git a/tex/context/modules/mkiv/x-asciimath.lua b/tex/context/modules/mkiv/x-asciimath.lua
index eed69d1f2..794cddbd1 100644
--- a/tex/context/modules/mkiv/x-asciimath.lua
+++ b/tex/context/modules/mkiv/x-asciimath.lua
@@ -35,7 +35,7 @@ if not characters then
require("char-ent")
end
-local type, rawget = type, rawget
+local rawget, next, type = rawget, next, type
local concat, insert, remove = table.concat, table.insert, table.remove
local rep, gmatch, gsub, find = string.rep, string.gmatch, string.gsub, string.find
local utfchar, utfbyte = utf.char, utf.byte
diff --git a/tex/context/modules/mkiv/x-calcmath.lua b/tex/context/modules/mkiv/x-calcmath.lua
index c96d8d0ac..41a43cacd 100644
--- a/tex/context/modules/mkiv/x-calcmath.lua
+++ b/tex/context/modules/mkiv/x-calcmath.lua
@@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['x-calcmath'] = {
-- this really needs to be redone
+local next, type = next, type
local format, lower, upper, gsub, sub = string.format, string.lower, string.upper, string.gsub, string.sub
local concat = table.concat
local lpegmatch = lpeg.match
diff --git a/tex/context/modules/mkiv/x-cals.lua b/tex/context/modules/mkiv/x-cals.lua
index ef85630da..9d54733b8 100644
--- a/tex/context/modules/mkiv/x-cals.lua
+++ b/tex/context/modules/mkiv/x-cals.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['x-cals'] = {
license = "see context related readme files"
}
-local next = next
+local next, type = next, type
local format, lower = string.format, string.lower
local xmlcprint, xmlcollected, xmlelements = xml.cprint, xml.collected, xml.elements
local n_todimen, s_todimen = number.todimen, string.todimen
diff --git a/tex/context/modules/mkiv/x-setups-basics.mkiv b/tex/context/modules/mkiv/x-setups-basics.mkiv
index 0836de76b..be96466b8 100644
--- a/tex/context/modules/mkiv/x-setups-basics.mkiv
+++ b/tex/context/modules/mkiv/x-setups-basics.mkiv
@@ -15,6 +15,14 @@
%D We can make this module a bit cleaner using more recent features or we go \LUA\
%D completely but as this style evolved over 15 years it's a waste of time.
%D
+%D
+%D Thanks to Wolfgang these descriptions have become quite complete! In the process
+%D of covering more commands and expecially different instances of the same command,
+%D either or not generated, the supporting macros became more complex. I must admit
+%D that it's not the nicest code base and whenever I have to add or patch something
+%D I have to suppress the urge to rewrite this file. It needs watching a few
+%D energetic videos (for instance with Simon Phillips drumming) to get going.
+%D
%D As we also have a help server we can make a common framework for this \unknown\
%D but even then, this file is also a test for the the \XML\ processor.
%D
@@ -25,21 +33,46 @@
%D Currently we load the \XML\ file and when not in the english interface we just
%D remap the relevant words to their translation.
-%D Todo: use lua instead of synonyms
+%D \startbuffer
+%D \usemodule[x-setups-basics]
+%D
+%D \loadsetups[context-en]
+%D
+%D \starttext
+%D
+%D \showsetup[starttyping:instance:LUA]
+%D
+%D \showsetup[starttyping:instance:typing]
+%D
+%D \showsetup[starttyping:instance:argument]
+%D
+%D \showsetup [completelistoffloats:instance:chemicals] \blank
+%D \shortsetup[completelistoffloats:instance:chemicals] \blank
+%D \basicsetup[completelistoffloats:instance:chemicals] \blank
+%D
+%D \cmdfullsetup [completelistoffloats:instance:chemicals] \blank
+%D \cmdshortsetup[completelistoffloats:instance:chemicals] \blank
+%D \cmdbasicsetup[completelistoffloats:instance:chemicals] \blank
+%D
+%D % \cmdinternal{...}
+%D
+%D \page \placeeverysetup \page
+%D \page \placeeverysetupname \page
+%D
+%D \stoptext
+%D \stopbuffer
+
+% Todo: use lua instead of synonyms
\unprotect
\defineregister
[texmacro]
-\unexpanded\def\texcommandmeaning#1{}
-\unexpanded\def\texcommandusage #1{}
-
\definesorting
[texcommand]
[texcommands]
- [\texcommandmeaning]
- [\texcommandusage]
+ [\v!none]
\setupsorting
[texcommand]
@@ -77,7 +110,6 @@
\unexpanded\def\setupalwcolor{}
\unexpanded\def\setupoptcolor{darkgray}
-% \unexpanded\def\setupvarword#1{{\sl\detokenize{#1}}}
\unexpanded\def\setupvarword#1{\detokenize{#1}}
\unexpanded\def\setupintword#1{\WORD{\detokenize{#1}}}
\unexpanded\def\setuptxtword#1{\detokenize{#1}}
@@ -150,16 +182,14 @@
\stopxmlsetups
\startxmlsetups xml:setups:register
-% \doif {\xmlatt{#1}{variant}} {instance} {
- \doifcommon {\xmlatt{#1}{variant}} {instance,instance:assignment,instance:ownnumber} {
+ \doifcommon {\xmlatt{#1}{variant}} {instance,instance:assignment,instance:ownnumber,instance:argument} {
\def\docommand##1{
\xmlsetup{#1}{xml:setups:assemblename:instance}
-% \expanded{\texcommand[stp:x:\currentSETUPfullname:##1]{{#1}{##1}}}}%
- \expanded{\texcommand[\currentSETUPfullname:##1]{{#1}{##1}}}}%
+ \expanded{\texcommand[\currentSETUPfullname:##1]{{#1}{##1}}}
+ }%
\processcommacommand[\clf_getinstances{#1}]\docommand
}
\xmlsetup{#1}{xml:setups:assemblename}
-% \expanded{\texcommand[stp:x:\currentSETUPfullname]{{#1}{}}}
\expanded{\texcommand[\currentSETUPfullname]{{#1}{}}}
\stopxmlsetups
@@ -386,7 +416,6 @@
local t = { }
local n = #entries
for i=1,n do
--- t[i] = gsub(entries[i].definition.tag,"^stp:x:","")
t[i] = entries[i].definition.tag
end
table.sort(t)
@@ -488,15 +517,12 @@
\fi}
\def\cmd_show_setup_nop#1% this will trigger 'used'
-% {\registersort[texcommand][stp:x:#1]%
{\registersort[texcommand][#1]%
\ifconditional\c_cmd_show_setup
-% \writestatus{setup}{#1 / \rawsynonymname{texcommand}{stp:x:#1}}%
\writestatus{setup}{#1 / \rawsynonymname{texcommand}{#1}}%
\fi
\startelement[setup][name=#1]%
\startelement[noexport][comment={setup definition #1}]%
-% \edef\cmd_id{\rawsynonymname{texcommand}{stp:x:#1}}%
\edef\cmd_id{\rawsynonymname{texcommand}{#1}}%
\ifx\cmd_id\empty
missing: #1
@@ -517,6 +543,17 @@
\let\placeeverysetup\placeallsetups
+\unexpanded\def\cmd_show_setup_list_basic#1#2#3%
+ {\NC\tttf#2\NC\basicsetup[#2]\NC\NR}
+
+\unexpanded\def\placeeverysetupname
+ {\placelistofsorts
+ [texcommand]
+ [\c!before={\starttabulate[|||]},
+ \c!after=\stoptabulate,
+ \c!criterium=\v!all,
+ \c!command=\cmd_show_setup_list_basic]}
+
%D Typesetting:
\startxmlsetups xml:setups:typeset
@@ -758,24 +795,25 @@
\ignorespaces
\stopxmlsetups
+\startxmlsetups xml:setups:csname \show_setup_component{#1}{csname} \stopxmlsetups
\startxmlsetups xml:setups:content \show_setup_component{#1}{content} \stopxmlsetups
-\startxmlsetups xml:setups:displaymath \show_setup_component{#1}{displaymath}\stopxmlsetups
-\startxmlsetups xml:setups:index \show_setup_component{#1}{index} \stopxmlsetups
-\startxmlsetups xml:setups:math \show_setup_component{#1}{math} \stopxmlsetups
-\startxmlsetups xml:setups:nothing \show_setup_component{#1}{nothing} \stopxmlsetups
-\startxmlsetups xml:setups:file \show_setup_component{#1}{file} \stopxmlsetups
\startxmlsetups xml:setups:position \show_setup_component{#1}{position} \stopxmlsetups
-\startxmlsetups xml:setups:reference \show_setup_component{#1}{reference} \stopxmlsetups
-\startxmlsetups xml:setups:csname \show_setup_component{#1}{csname} \stopxmlsetups
-\startxmlsetups xml:setups:destination \show_setup_component{#1}{destination}\stopxmlsetups
-\startxmlsetups xml:setups:triplet \show_setup_component{#1}{triplet} \stopxmlsetups
-\startxmlsetups xml:setups:word \show_setup_component{#1}{word} \stopxmlsetups
+\startxmlsetups xml:setups:index \show_setup_component{#1}{index} \stopxmlsetups
+\startxmlsetups xml:setups:text \show_setup_component{#1}{text} \stopxmlsetups
+\startxmlsetups xml:setups:apply \show_setup_component{#1}{apply} \stopxmlsetups
\startxmlsetups xml:setups:template \show_setup_component{#1}{template} \stopxmlsetups
+\startxmlsetups xml:setups:triplet \show_setup_component{#1}{triplet} \stopxmlsetups
\startxmlsetups xml:setups:angles \show_setup_component{#1}{angles} \stopxmlsetups
-\startxmlsetups xml:setups:apply \show_setup_component{#1}{apply} \stopxmlsetups
-\startxmlsetups xml:setups:twowords \show_setup_component{#1}{twowords} \stopxmlsetups
-\startxmlsetups xml:setups:threewords \show_setup_component{#1}{threewords} \stopxmlsetups
-\startxmlsetups xml:setups:text \show_setup_component{#1}{text} \stopxmlsetups
+
+%startxmlsetups xml:setups:displaymath \show_setup_component{#1}{displaymath}\stopxmlsetups
+%startxmlsetups xml:setups:math \show_setup_component{#1}{math} \stopxmlsetups
+%startxmlsetups xml:setups:nothing \show_setup_component{#1}{nothing} \stopxmlsetups
+%startxmlsetups xml:setups:file \show_setup_component{#1}{file} \stopxmlsetups
+%startxmlsetups xml:setups:reference \show_setup_component{#1}{reference} \stopxmlsetups
+%startxmlsetups xml:setups:destination \show_setup_component{#1}{destination}\stopxmlsetups
+%startxmlsetups xml:setups:word \show_setup_component{#1}{word} \stopxmlsetups
+%startxmlsetups xml:setups:twowords \show_setup_component{#1}{twowords} \stopxmlsetups
+%startxmlsetups xml:setups:threewords \show_setup_component{#1}{threewords} \stopxmlsetups
% todo: cd:par => \par
% todo: cd:sep => \\
@@ -928,12 +966,12 @@
\stopxmlsetups
\startxmlsetups xml:setups:inherit
-% \cmd_column_two_start{}{}
+ % \cmd_column_two_start{}{}
\rawsetupstring{cd:inherits}:
\enspace
\letterbackslash
\xmlatt{#1}{name}
-% \cmd_column_two_stop
+ % \cmd_column_two_stop
\ignorespaces
\stopxmlsetups
@@ -941,7 +979,7 @@
{\cmd_column_one_start
\cmd_internal_value{#1}%
\cmd_column_one_stop
-% \godown[.75\lineheight]
+ % \godown[.75\lineheight]
\blank[\v!samepage,\v!medium]
\ignorespaces}
@@ -1013,26 +1051,25 @@
% arguments
-\unexpanded\def\show_setup_displaymath#1{\show_setup_any {#1}{displaymath}}
-\unexpanded\def\show_setup_index #1{\show_setup_any {#1}{index}}
-\unexpanded\def\show_setup_math #1{\show_setup_any {#1}{math}}
-\unexpanded\def\show_setup_nothing #1{\show_setup_any {#1}{nothing}}
-\unexpanded\def\show_setup_file #1{\show_setup_any {#1}{file}}
-\unexpanded\def\show_setup_position #1{\show_setup_any {#1}{position}}
-\unexpanded\def\show_setup_template #1{\show_setup_any {#1}{template}}
-\unexpanded\def\show_setup_angles #1{\show_setup_any {#1}{angle}}
-\unexpanded\def\show_setup_reference #1{\show_setup_any {#1}{reference}}
-\unexpanded\def\show_setup_apply #1{\show_setup_any {#1}{apply}}
-\unexpanded\def\show_setup_twowords #1{\show_setup_any {#1}{twowords}}
-\unexpanded\def\show_setup_threewords #1{\show_setup_any {#1}{threewords}}
-\unexpanded\def\show_setup_csname #1{\show_setup_any {#1}{noargument}}
-\unexpanded\def\show_setup_destination#1{\show_setup_any {#1}{destination}}
-\unexpanded\def\show_setup_triplet #1{\show_setup_any {#1}{triplet}}
-\unexpanded\def\show_setup_word #1{\show_setup_any {#1}{word}}
-\unexpanded\def\show_setup_content #1{\show_setup_any {#1}{content}}
-\unexpanded\def\show_setup_text #1{\show_setup_any {#1}{textual}}
-\unexpanded\def\show_setup_to #1{\show_setup_line{#1}{to}}
-\unexpanded\def\show_setup_macro #1{\show_setup_any {#1}{macro}}
+\unexpanded\def\show_setup_csname #1{\show_setup_any{#1}{noargument}}
+\unexpanded\def\show_setup_content #1{\show_setup_any{#1}{content}}
+\unexpanded\def\show_setup_position #1{\show_setup_any{#1}{position}}
+\unexpanded\def\show_setup_index #1{\show_setup_any{#1}{index}}
+\unexpanded\def\show_setup_text #1{\show_setup_any{#1}{textual}}
+\unexpanded\def\show_setup_apply #1{\show_setup_any{#1}{apply}}
+\unexpanded\def\show_setup_template #1{\show_setup_any{#1}{template}}
+\unexpanded\def\show_setup_triplet #1{\show_setup_any{#1}{triplet}}
+\unexpanded\def\show_setup_angles #1{\show_setup_any{#1}{angle}}
+
+%unexpanded\def\show_setup_displaymath#1{\show_setup_any{#1}{displaymath}}
+%unexpanded\def\show_setup_math #1{\show_setup_any{#1}{math}}
+%unexpanded\def\show_setup_nothing #1{\show_setup_any{#1}{nothing}}
+%unexpanded\def\show_setup_file #1{\show_setup_any{#1}{file}}
+%unexpanded\def\show_setup_reference #1{\show_setup_any{#1}{reference}}
+%unexpanded\def\show_setup_destination#1{\show_setup_any{#1}{destination}}
+%unexpanded\def\show_setup_word #1{\show_setup_any{#1}{word}}
+%unexpanded\def\show_setup_twowords #1{\show_setup_any{#1}{twowords}}
+%unexpanded\def\show_setup_threewords #1{\show_setup_any{#1}{threewords}}
% A prelude to a rewrite and some more:
diff --git a/tex/context/modules/mkiv/x-setups-overview.mkiv b/tex/context/modules/mkiv/x-setups-overview.mkiv
index c0047f13a..f6dff12f5 100644
--- a/tex/context/modules/mkiv/x-setups-overview.mkiv
+++ b/tex/context/modules/mkiv/x-setups-overview.mkiv
@@ -1,5 +1,5 @@
%D \module
-%D [ file=setups-basics, % x-set-12,
+%D [ file=setups-overview, % x-set-12,
%D version=2016.04.05, % 2004.10.31,
%D remark=setupx.tex: 1998.07.20 and later,
%D title=\CONTEXT\ Setup Definitions,
@@ -12,10 +12,13 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% context --interface=en --global --result=setup-en x-setups-overview.mkiv
+% context --interface=en --global --result=setup-en x-setups-overview.mkiv --mode=setups:save
+% context --interface=en --global --result=setup-mapping-en x-setups-overview.mkiv --mode=setups:mapping
% \enablemode[setups:save]
+% \enablemode[setups:mapping]
+
\usemodule[setups-basics]
\unprotect
@@ -80,7 +83,12 @@
\definecolor [darkgray] [s=.1]
\usetypescript[palatino]
-\setupbodyfont[palatino,9pt]
+
+\doifelsemode {setups:mapping} {
+ \setupbodyfont[palatino,8pt]
+} {
+ \setupbodyfont[palatino,9pt]
+}
\defineoverlay
[cover]
@@ -91,28 +99,42 @@
[\hbox to \paperwidth{\reuseMPgraphic{cover+back}\hss}]
\startreusableMPgraphic{cover+back}
- numeric h, w ; path p, q, r ; color f, d ; pair s ;
+ numeric h, w; boolean mapping ; path p, q, r ; color f, d ; pair s ;
h := OverlayHeight ; w := 2*OverlayWidth ;
r := unitsquare xyscaled (w,h) ;
fill r withcolor \MPcolor{lightgray} ;
- set_grid(w,h,w/8,w/16) ;
+ mapping := lua.mp.processingmode("setups:mapping") ;
+ if mapping :
+ set_grid(w,h,w/8,w/160) ;
+ pickup pensquare yscaled (w/80) ;
+ else :
+ set_grid(w,h,w/8,w/16) ;
+ pickup pencircle scaled (w/100) ;
+ fi ;
forever :
s := center r randomized (w,h) ;
if new_on_grid(xpart s, ypart s) :
- s := (dx,dy) ;
- p := fullsquare xyscaled(w/4,w/8) ;
- q := (-4w,ypart ulcorner p) -- .5[ulcorner p, urcorner p] -- (4w,ypart urcorner p) ;
- q := q shifted (0,-w/24) ;
- p := p randomized (w/40,w/40) ;
- q := q randomized (0,w/100) ;
- q := q cutafter (p cutafter point 3 of p) ;
- q := q cutbefore (p cutbefore point 3 of p) ;
d := .5[\MPcolor{LocalColor},\MPcolor{lightgray}] randomized (.5,.9) ;
f := \MPcolor{lightgray} randomized (.5,.9) ;
- pickup pencircle scaled (w/100) ;
- fill p shifted s withcolor f ;
- draw p shifted s withcolor d ;
- draw q shifted s withcolor d ;
+ s := (dx,dy) ;
+ if mapping :
+ p := (-w/4,0) -- (w/4,0) ;
+ p := (-w/4,0) -- origin ;
+ q := origin -- ( w/4,0) ;
+ draw p shifted s withcolor d ;
+ draw q shifted s withcolor f ;
+ else :
+ p := fullsquare xyscaled(w/4,w/8) ;
+ q := (-4w,ypart ulcorner p) -- .5[ulcorner p, urcorner p] -- (4w,ypart urcorner p) ;
+ q := q shifted (0,-w/24) ;
+ p := p randomized (w/40,w/40) ;
+ q := q randomized (0,w/100) ;
+ q := q cutafter (p cutafter point 3 of p) ;
+ q := q cutbefore (p cutbefore point 3 of p) ;
+ fill p shifted s withcolor f ;
+ draw p shifted s withcolor d ;
+ draw q shifted s withcolor d ;
+ fi ;
fi ;
exitif grid_full ;
endfor ;
@@ -137,6 +159,11 @@
\c!width=\v!middle,
\c!height=\v!middle]
+\doifmode {setups:mapping} {
+ \setuplayout
+ [\c!backspace=1cm]
+}
+
\setuppagenumbering
[\c!location=\v!footer,
\c!alternative=\v!doublesided]
@@ -234,7 +261,11 @@
\protect
-\placeeverysetup
+\doifelsemode {setups:mapping} {
+ \placeeverysetupname
+} {
+ \placeeverysetup
+}
\unprotect
diff --git a/tex/generic/context/luatex/luatex-core.lua b/tex/generic/context/luatex/luatex-core.lua
index c13d81257..35005d1c8 100644
--- a/tex/generic/context/luatex/luatex-core.lua
+++ b/tex/generic/context/luatex/luatex-core.lua
@@ -1,11 +1,13 @@
+-- luatex-core security and io overloads ...........
+
-- if not modules then modules = { } end modules ['luatex-core'] = {
--- version = 1.001,
+-- version = 1.005,
-- comment = 'companion to luatex',
-- author = 'Hans Hagen & Luigi Scarso',
-- copyright = 'LuaTeX Development Team',
-- }
-LUATEXCOREVERSION = 1.003
+LUATEXCOREVERSION = 1.005
-- This file overloads some Lua functions. The readline variants provide the same
-- functionality as LuaTeX <= 1.04 and doing it this way permits us to keep the
@@ -71,13 +73,38 @@ local function luatex_io_popen(name,...)
end
end
+-- local function luatex_io_lines(name,how)
+-- if name then
+-- local f = io_open(name,how or 'r')
+-- if f then
+-- return function()
+-- return fio_readline(f)
+-- end
+-- end
+-- else
+-- return io_lines()
+-- end
+-- end
+
+-- For some reason the gc doesn't kick in so we need to close explitly
+-- so that the handle is flushed.
+
+local error, type = error, type
+
local function luatex_io_lines(name,how)
- if name then
+ if type(name) == "string" then
local f = io_open(name,how or 'r')
if f then
return function()
- return fio_readline(f)
+ local l = fio_readline(f)
+ if not l then
+ f:close()
+ end
+ return l
end
+ else
+ -- for those who like it this way:
+ error("patched 'io.lines' can't open '" .. name .. "'")
end
else
return io_lines()
@@ -331,6 +358,17 @@ else
end
+-- this is needed for getting require("socket") right
+
+do
+
+ local loaded = package.loaded
+
+ if not loaded.socket then loaded.socket = loaded["socket.core"] end
+ if not loaded.mime then loaded.mime = loaded["mime.core"] end
+
+end
+
-- so far
if utilities and utilities.merger and utilities.merger.compact then
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ef0152436..e828c3023 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 : 11/22/17 13:35:39
+-- merge date : 01/08/18 23:03:13
do -- begin closure to overcome local limits and interference
@@ -11,6 +11,7 @@ if not modules then modules={} end modules ['l-lua']={
copyright="PRAGMA ADE / ConTeXt Development Team",
license="see context related readme files"
}
+local next,type,tonumber=next,type,tonumber
LUAMAJORVERSION,LUAMINORVERSION=string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
LUAMAJORVERSION=tonumber(LUAMAJORVERSION) or 5
LUAMINORVERSION=tonumber(LUAMINORVERSION) or 1
@@ -3648,6 +3649,25 @@ function unicode.toutf32string(n)
char(extract(n,0,8))..char(extract(n,8,8))..char(extract(n,16,8))..char(extract(n,24,8))
end
end
+local len=utf.len
+local rep=rep
+function string.utfpadd(s,n)
+ if n and n~=0 then
+ local l=len(s)
+ if n>0 then
+ local d=n-l
+ if d>0 then
+ return rep(c or " ",d)..s
+ end
+ else
+ local d=- n-l
+ if d>0 then
+ return s..rep(c or " ",d)
+ end
+ end
+ end
+ return s
+end
end -- closure
@@ -3665,11 +3685,11 @@ 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 load,dump=load,string.dump
-local tonumber,type,tostring=tonumber,type,tostring
+local tonumber,type,tostring,next=tonumber,type,tostring,next
local unpack,concat=table.unpack,table.concat
local P,V,C,S,R,Ct,Cs,Cp,Carg,Cc=lpeg.P,lpeg.V,lpeg.C,lpeg.S,lpeg.R,lpeg.Ct,lpeg.Cs,lpeg.Cp,lpeg.Carg,lpeg.Cc
local patterns,lpegmatch=lpeg.patterns,lpeg.match
-local utfchar,utfbyte=utf.char,utf.byte
+local utfchar,utfbyte,utflen=utf.char,utf.byte,utf.len
local loadstripped=nil
if LUAVERSION<5.2 then
loadstripped=function(str,shortcuts)
@@ -3759,6 +3779,17 @@ local pattern=Carg(1)/function(t)
function strings.tabtospace(str,tab)
return lpegmatch(pattern,str,1,tab or 7)
end
+function string.utfpadding(s,n)
+ if not n or n==0 then
+ return ""
+ end
+ local l=utflen(s)
+ if n>0 then
+ return nspaces[n-l]
+ else
+ return nspaces[-n-l]
+ end
+end
local space=spacer^0
local nospace=space/""
local endofline=nospace*newline
@@ -3947,6 +3978,7 @@ local utfchar=utf.char
local utfbyte=utf.byte
local lpegmatch=lpeg.match
local nspaces=string.nspaces
+local utfpadding=string.utfpadding
local tracedchar=string.tracedchar
local autosingle=string.autosingle
local autodouble=string.autodouble
@@ -3971,6 +4003,7 @@ else
utfbyte=utf.byte,
lpegmatch=lpeg.match,
nspaces=string.nspaces,
+ utfpadding=string.utfpadding,
tracedchar=string.tracedchar,
autosingle=string.autosingle,
autodouble=string.autodouble,
@@ -4006,6 +4039,29 @@ local format_S=function(f)
return format("tostring(a%s)",n)
end
end
+local format_right=function(f)
+ n=n+1
+ f=tonumber(f)
+ if not f or f==0 then
+ return format("(a%s or '')",n)
+ elseif f>0 then
+ return format("utfpadding(a%s,%i)..a%s",n,f,n)
+ else
+ return format("a%s..utfpadding(a%s,%i)",n,n,f)
+ end
+end
+local format_left=function(f)
+ n=n+1
+ f=tonumber(f)
+ if not f or f==0 then
+ return format("(a%s or '')",n)
+ end
+ if f<0 then
+ return format("utfpadding(a%s,%i)..a%s",n,-f,n)
+ else
+ return format("a%s..utfpadding(a%s,%i)",n,n,-f)
+ end
+end
local format_q=function()
n=n+1
return format("(a%s and format('%%q',a%s) or '')",n,n)
@@ -4260,6 +4316,8 @@ local builder=Cs { "start",
+V("j")+V("J")
+V("m")+V("M")
+V("z")
++V(">")
++V("<")
)+V("*")
)*(P(-1)+Carg(1))
)^0,
@@ -4303,6 +4361,8 @@ local builder=Cs { "start",
["z"]=(prefix_any*P("z"))/format_z,
["a"]=(prefix_any*P("a"))/format_a,
["A"]=(prefix_any*P("A"))/format_A,
+ ["<"]=(prefix_any*P("<"))/format_left,
+ [">"]=(prefix_any*P(">"))/format_right,
["*"]=Cs(((1-P("%"))^1+P("%%")/"%%")^1)/format_rest,
["?"]=Cs(((1-P("%"))^1 )^1)/format_rest,
["!"]=Carg(2)*prefix_any*P("!")*C((1-P("!"))^1)*P("!")/format_extension,
@@ -7714,6 +7774,7 @@ local sortedkeys,sortedhash,serialize,fastcopy=table.sortedkeys,table.sortedhash
local derivetable=table.derive
local ioflush=io.flush
local round=math.round
+local setmetatable,getmetatable,rawget,rawset=setmetatable,getmetatable,rawget,rawset
local trace_defining=false trackers.register("fonts.defining",function(v) trace_defining=v end)
local trace_scaling=false trackers.register("fonts.scaling",function(v) trace_scaling=v end)
local report_defining=logs.reporter("fonts","defining")
@@ -7841,27 +7902,62 @@ function constructors.trytosharefont(target,tfmdata)
end
end
end
+local synonyms={
+ exheight="x_height",
+ xheight="x_height",
+ ex="x_height",
+ emwidth="quad",
+ em="quad",
+ spacestretch="space_stretch",
+ stretch="space_stretch",
+ spaceshrink="space_shrink",
+ shrink="space_shrink",
+ extraspace="extra_space",
+ xspace="extra_space",
+ slantperpoint="slant",
+}
function constructors.enhanceparameters(parameters)
- local xheight=parameters.x_height
- local quad=parameters.quad
- local space=parameters.space
- local stretch=parameters.space_stretch
- local shrink=parameters.space_shrink
- local extra=parameters.extra_space
- local slant=parameters.slant
- parameters.xheight=xheight
- parameters.spacestretch=stretch
- parameters.spaceshrink=shrink
- parameters.extraspace=extra
- parameters.em=quad
- parameters.ex=xheight
- parameters.slantperpoint=slant
- parameters.spacing={
- width=space,
- stretch=stretch,
- shrink=shrink,
- extra=extra,
- }
+ local mt=getmetatable(parameters)
+ local getter=function(t,k)
+ if not k then
+ return nil
+ end
+ local s=synonyms[k]
+ if s then
+ return rawget(t,s) or (mt and mt[s]) or nil
+ end
+ if k=="spacing" then
+ return {
+ width=t.space,
+ stretch=t.space_stretch,
+ shrink=t.space_shrink,
+ extra=t.extra_space,
+ }
+ end
+ return mt and mt[k] or nil
+ end
+ local setter=function(t,k,v)
+ if not k then
+ return 0
+ end
+ local s=synonyms[k]
+ if s then
+ rawset(t,s,v)
+ elseif k=="spacing" then
+ if type(v)=="table" then
+ rawset(t,"space",v.width or 0)
+ rawset(t,"space_stretch",v.stretch or 0)
+ rawset(t,"space_shrink",v.shrink or 0)
+ rawset(t,"extra_space",v.extra or 0)
+ end
+ else
+ rawset(t,k,v)
+ end
+ end
+ setmetatable(parameters,{
+ __index=getter,
+ __newindex=setter,
+ })
end
local function mathkerns(v,vdelta)
local k={}
@@ -22959,7 +23055,6 @@ local trace_directions=false registertracker("otf.directions",function(v) trace_
local trace_plugins=false registertracker("otf.plugins",function(v) trace_plugins=v end)
local trace_chains=false registertracker("otf.chains",function(v) trace_chains=v end)
local trace_kernruns=false registertracker("otf.kernruns",function(v) trace_kernruns=v end)
-local trace_discruns=false registertracker("otf.discruns",function(v) trace_discruns=v end)
local trace_compruns=false registertracker("otf.compruns",function(v) trace_compruns=v end)
local trace_testruns=false registertracker("otf.testruns",function(v) trace_testruns=v end)
local forcediscretionaries=false
@@ -25154,7 +25249,7 @@ local function handle_contextchain(head,start,dataset,sequence,contexts,rlmode,s
end
else
notmatchreplace[current]=true
- if not notmatchpre[current] then
+ if notmatchpre[current] then
goto next
else
break
@@ -25869,9 +25964,14 @@ local function txtdirstate(start,stack,top,rlparmode)
top=top+1
stack[top]=dir
elseif dir=="-TRT" or dir=="-TLT" then
- top=top-1
- if stack[top]=="+TRT" then
- new=-1
+ if top==1 then
+ top=0
+ new=rlparmode
+ else
+ top=top-1
+ if stack[top]=="+TRT" then
+ new=-1
+ end
end
else
new=rlparmode
@@ -28539,8 +28639,12 @@ local function convert(t,k)
t[k]=v
return v
end
-local start={ "pdf","page","q" }
-local stop={ "pdf","raw","Q" }
+local start={ "pdf","mode","font" }
+local push={ "pdf","page","q" }
+local pop={ "pdf","page","Q" }
+if not LUATEXFUNCTIONALITY or LUATEXFUNCTIONALITY<6472 then
+ start={ "nop" }
+end
local function initializecolr(tfmdata,kind,value)
if value then
local resources=tfmdata.resources
@@ -28589,14 +28693,20 @@ local function initializecolr(tfmdata,kind,value)
local goback=w~=0 and widths[w] or nil
local t={
start,
- not u and actualb or { "pdf","raw",getactualtext(tounicode(u)) }
+ not u and actualb or { "pdf","page",(getactualtext(tounicode(u))) }
}
local n=2
local l=nil
+ local f=false
for i=1,s do
local entry=colorlist[i]
local v=colorvalues[entry.class] or default
if v and l~=v then
+ if f then
+ n=n+1 t[n]=pop
+ end
+ n=n+1 t[n]=push
+ f=true
n=n+1 t[n]=v
l=v
end
@@ -28605,8 +28715,10 @@ local function initializecolr(tfmdata,kind,value)
n=n+1 t[n]=goback
end
end
+ if f then
+ n=n+1 t[n]=pop
+ end
n=n+1 t[n]=actuale
- n=n+1 t[n]=stop
character.commands=t
end
end
@@ -28654,6 +28766,9 @@ local function pdftovirtual(tfmdata,pdfshapes,kind)
}
local getactualtext=otf.getactualtext
local storepdfdata=otf.storepdfdata
+ local b,e=getactualtext(tounicode(0xFFFD))
+ local actualb={ "pdf","page",b }
+ local actuale={ "pdf","page",e }
for unicode,character in sortedhash(characters) do
local index=character.index
if index then
@@ -28674,16 +28789,16 @@ local function pdftovirtual(tfmdata,pdfshapes,kind)
if data then
local setcode,name,nilcode=storepdfdata(data)
if name then
- local bt,et=getactualtext(unicode)
+ local bt=unicode and getactualtext(unicode)
local wd=character.width or 0
local ht=character.height or 0
local dp=character.depth or 0
character.commands={
- { "pdf","direct",bt },
+ not unicode and actualb or { "pdf","page",(getactualtext(unicode)) },
{ "down",dp+dy*hfactor },
{ "right",dx*hfactor },
{ "image",{ filename=name,width=wd,height=ht,depth=dp } },
- { "pdf","direct",et },
+ actuale,
}
character[kind]=true
end
@@ -34436,6 +34551,7 @@ if context then
texio.write_nl("fatal error: this module is not for context")
os.exit()
end
+local next=next
local fonts=fonts
local nodes=nodes
local nuts=nodes.nuts
diff --git a/tex/generic/context/luatex/luatex-mplib.lua b/tex/generic/context/luatex/luatex-mplib.lua
index 785bc707c..c610fca57 100644
--- a/tex/generic/context/luatex/luatex-mplib.lua
+++ b/tex/generic/context/luatex/luatex-mplib.lua
@@ -462,15 +462,19 @@ else
pdf_startfigure(fignum,llx,lly,urx,ury)
pdf_literalcode("q")
if objects then
+ local savedpath = nil
+ local savedhtap = nil
for o=1,#objects do
local object = objects[o]
local objecttype = object.type
if objecttype == "start_bounds" or objecttype == "stop_bounds" then
-- skip
elseif objecttype == "start_clip" then
+ local evenodd = not object.istext and object.postscript == "evenodd"
pdf_literalcode("q")
flushnormalpath(object.path,t,false)
pdf_literalcode("W n")
+ pdf_literalcode(evenodd and "W* n" or "W n")
elseif objecttype == "stop_clip" then
pdf_literalcode("Q")
miterlimit, linecap, linejoin, dashed = -1, -1, -1, false
@@ -482,96 +486,147 @@ else
pdf_textfigure(object.font,object.dsize,object.text,object.width,object.height,object.depth)
pdf_literalcode("Q")
else
- local cs = object.color
- local cr = false
- if cs and #cs > 0 then
- cs, cr = metapost.colorconverter(cs)
- pdf_literalcode(cs)
- end
- local ml = object.miterlimit
- if ml and ml ~= miterlimit then
- miterlimit = ml
- pdf_literalcode("%f M",ml)
- end
- local lj = object.linejoin
- if lj and lj ~= linejoin then
- linejoin = lj
- pdf_literalcode("%i j",lj)
- end
- local lc = object.linecap
- if lc and lc ~= linecap then
- linecap = lc
- pdf_literalcode("%i J",lc)
- end
- local dl = object.dash
- if dl then
- local d = format("[%s] %i d",concat(dl.dashes or {}," "),dl.offset)
- if d ~= dashed then
- dashed = d
- pdf_literalcode(dashed)
+ local evenodd, collect, both = false, false, false
+ local postscript = object.postscript
+ if not object.istext then
+ if postscript == "evenodd" then
+ evenodd = true
+ elseif postscript == "collect" then
+ collect = true
+ elseif postscript == "both" then
+ both = true
+ elseif postscript == "eoboth" then
+ evenodd = true
+ both = true
end
- elseif dashed then
- pdf_literalcode("[] 0 d")
- dashed = false
end
- local path = object.path
- local transformed, penwidth = false, 1
- local open = path and path[1].left_type and path[#path].right_type
- local pen = object.pen
- if pen then
- if pen.type == 'elliptical' then
- transformed, penwidth = pen_characteristics(object) -- boolean, value
- pdf_literalcode("%f w",penwidth)
- if objecttype == 'fill' then
- objecttype = 'both'
- end
- else -- calculated by mplib itself
- objecttype = 'fill'
- end
- end
- if transformed then
- pdf_literalcode("q")
- end
- if path then
- if transformed then
- flushconcatpath(path,open)
+ if collect then
+ if not savedpath then
+ savedpath = { object.path or false }
+ savedhtap = { object.htap or false }
else
- flushnormalpath(path,open)
+ savedpath[#savedpath+1] = object.path or false
+ savedhtap[#savedhtap+1] = object.htap or false
end
- if objecttype == "fill" then
- pdf_literalcode("h f")
- elseif objecttype == "outline" then
- pdf_literalcode((open and "S") or "h S")
- elseif objecttype == "both" then
- pdf_literalcode("h B")
+ else
+ local cs = object.color
+ local cr = false
+ if cs and #cs > 0 then
+ cs, cr = metapost.colorconverter(cs)
+ pdf_literalcode(cs)
end
- end
- if transformed then
- pdf_literalcode("Q")
- end
- local path = object.htap
- if path then
- if transformed then
- pdf_literalcode("q")
+ local ml = object.miterlimit
+ if ml and ml ~= miterlimit then
+ miterlimit = ml
+ pdf_literalcode("%f M",ml)
+ end
+ local lj = object.linejoin
+ if lj and lj ~= linejoin then
+ linejoin = lj
+ pdf_literalcode("%i j",lj)
+ end
+ local lc = object.linecap
+ if lc and lc ~= linecap then
+ linecap = lc
+ pdf_literalcode("%i J",lc)
+ end
+ local dl = object.dash
+ if dl then
+ local d = format("[%s] %i d",concat(dl.dashes or {}," "),dl.offset)
+ if d ~= dashed then
+ dashed = d
+ pdf_literalcode(dashed)
+ end
+ elseif dashed then
+ pdf_literalcode("[] 0 d")
+ dashed = false
+ end
+ local path = object.path
+ local transformed, penwidth = false, 1
+ local open = path and path[1].left_type and path[#path].right_type
+ local pen = object.pen
+ if pen then
+ if pen.type == 'elliptical' then
+ transformed, penwidth = pen_characteristics(object) -- boolean, value
+ pdf_literalcode("%f w",penwidth)
+ if objecttype == 'fill' then
+ objecttype = 'both'
+ end
+ else -- calculated by mplib itself
+ objecttype = 'fill'
+ end
end
if transformed then
- flushconcatpath(path,open)
- else
- flushnormalpath(path,open)
+ pdf_literalcode("q")
end
- if objecttype == "fill" then
- pdf_literalcode("h f")
- elseif objecttype == "outline" then
- pdf_literalcode((open and "S") or "h S")
- elseif objecttype == "both" then
- pdf_literalcode("h B")
+ if path then
+ if savedpath then
+ for i=1,#savedpath do
+ local path = savedpath[i]
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ end
+ savedpath = nil
+ end
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ if objecttype == "fill" then
+ pdf_literalcode("h f")
+ elseif objecttype == "outline" then
+ if both then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ else
+ pdf_literalcode(open and "S" or "h S")
+ end
+ elseif objecttype == "both" then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ end
end
if transformed then
pdf_literalcode("Q")
end
- end
- if cr then
- pdf_literalcode(cr)
+ local path = object.htap
+ if path then
+ if transformed then
+ pdf_literalcode("q")
+ end
+ if savedhtap then
+ for i=1,#savedhtap do
+ local path = savedhtap[i]
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ end
+ savedhtap = nil
+ evenodd = true
+ end
+ if transformed then
+ flushconcatpath(path,open)
+ else
+ flushnormalpath(path,open)
+ end
+ if objecttype == "fill" then
+ pdf_literalcode("h f")
+ elseif objecttype == "outline" then
+ pdf_literalcode(evenodd and "h f*" or "h f")
+ elseif objecttype == "both" then
+ pdf_literalcode(evenodd and "h B*" or "h B")
+ end
+ if transformed then
+ pdf_literalcode("Q")
+ end
+ end
+ if cr then
+ pdf_literalcode(cr)
+ end
end
end
end
diff --git a/tex/generic/context/luatex/luatex-swiglib.lua b/tex/generic/context/luatex/luatex-swiglib.lua
index 3108dd43f..cbb6798c3 100644
--- a/tex/generic/context/luatex/luatex-swiglib.lua
+++ b/tex/generic/context/luatex/luatex-swiglib.lua
@@ -16,16 +16,18 @@ function requireswiglib(required,version)
if library then
return library
else
- local name = string.gsub(required,"%.","/") .. libsuffix
+ local full = string.gsub(required,"%.","/"
+ local path = file.pathpart(full)
+ local name = file.nameonly(full) .. libsuffix
local list = kpse.show_path("clua")
for root in string.gmatch(list,pathsplit) do
local full = false
if type(version) == "string" and version ~= "" then
- full = root .. "/" .. version .. "/" .. name
+ full = root .. "/" .. path .. "/" .. version .. "/" .. name
full = lfs.isfile(full) and full
end
if not full then
- full = root .. "/" .. name
+ full = root .. "/" .. path .. "/" .. name
full = lfs.isfile(full) and full
end
if full then