From 57ea7dad48fbf2541c04e434c31bde655ada3ac4 Mon Sep 17 00:00:00 2001
From: Taco Hoekwater
Date: Mon, 24 May 2010 14:05:02 +0000
Subject: here is context 2010.05.24 13:05
git-svn-id: svn://tug.org/texlive/trunk@18445 c570f23f-e606-0410-a88d-b1316a301751
---
Master/texmf-dist/tex/context/base/anch-bar.mkiv | 41 +-
Master/texmf-dist/tex/context/base/anch-pgr.mkiv | 38 +-
Master/texmf-dist/tex/context/base/anch-pos.lua | 109 +-
Master/texmf-dist/tex/context/base/anch-pos.mkiv | 24 +-
Master/texmf-dist/tex/context/base/anch-snc.mkiv | 2 +-
Master/texmf-dist/tex/context/base/attr-ini.lua | 157 +-
Master/texmf-dist/tex/context/base/attr-ini.mkiv | 74 +-
Master/texmf-dist/tex/context/base/back-ini.lua | 4 +-
Master/texmf-dist/tex/context/base/back-ini.mkiv | 2 +-
Master/texmf-dist/tex/context/base/back-pdf.lua | 36 +-
Master/texmf-dist/tex/context/base/back-pdf.mkiv | 55 +-
Master/texmf-dist/tex/context/base/back-u3d.mkiv | 156 +
Master/texmf-dist/tex/context/base/bibl-bib.lua | 605 +-
Master/texmf-dist/tex/context/base/bibl-bib.mkiv | 943 +-
Master/texmf-dist/tex/context/base/bibl-tra.lua | 194 +
Master/texmf-dist/tex/context/base/bibl-tra.mkii | 1778 +
Master/texmf-dist/tex/context/base/bibl-tra.mkiv | 1552 +
Master/texmf-dist/tex/context/base/bibl-tst.lua | 2 +-
Master/texmf-dist/tex/context/base/blob-ini.lua | 165 +
Master/texmf-dist/tex/context/base/blob-ini.mkiv | 34 +
Master/texmf-dist/tex/context/base/buff-ini.lua | 382 +-
Master/texmf-dist/tex/context/base/buff-ini.mkii | 8 +-
Master/texmf-dist/tex/context/base/buff-ini.mkiv | 54 +-
Master/texmf-dist/tex/context/base/buff-ver.mkii | 10 +-
Master/texmf-dist/tex/context/base/buff-ver.mkiv | 290 +-
Master/texmf-dist/tex/context/base/bxml-apa.mkiv | 613 +
Master/texmf-dist/tex/context/base/catc-ctx.tex | 16 +-
Master/texmf-dist/tex/context/base/catc-def.tex | 12 +-
Master/texmf-dist/tex/context/base/catc-ini.lua | 9 +-
Master/texmf-dist/tex/context/base/catc-ini.mkiv | 57 +-
Master/texmf-dist/tex/context/base/char-act.mkiv | 13 +
Master/texmf-dist/tex/context/base/char-cmp.lua | 3 +-
Master/texmf-dist/tex/context/base/char-def.lua | 240 +-
Master/texmf-dist/tex/context/base/char-enc.lua | 2 +-
Master/texmf-dist/tex/context/base/char-ini.lua | 102 +-
Master/texmf-dist/tex/context/base/char-ini.mkiv | 2 +
Master/texmf-dist/tex/context/base/char-map.lua | 2 +-
Master/texmf-dist/tex/context/base/char-tex.lua | 89 +
Master/texmf-dist/tex/context/base/char-utf.lua | 2 +-
Master/texmf-dist/tex/context/base/char-utf.mkiv | 2 +-
Master/texmf-dist/tex/context/base/chem-ini.lua | 9 +-
Master/texmf-dist/tex/context/base/chem-ini.mkiv | 2 +-
Master/texmf-dist/tex/context/base/chem-str.lua | 24 +-
Master/texmf-dist/tex/context/base/chem-str.mkiv | 15 +-
Master/texmf-dist/tex/context/base/colo-ext.mkii | 10 +-
Master/texmf-dist/tex/context/base/colo-ext.mkiv | 60 +-
Master/texmf-dist/tex/context/base/colo-hex.mkii | 4 +-
Master/texmf-dist/tex/context/base/colo-hex.mkiv | 2 +
Master/texmf-dist/tex/context/base/colo-ini.lua | 255 +-
Master/texmf-dist/tex/context/base/colo-ini.mkiv | 133 +-
Master/texmf-dist/tex/context/base/colo-new.mkii | 1857 -
Master/texmf-dist/tex/context/base/colo-new.mkiv | 331 -
Master/texmf-dist/tex/context/base/colo-new.tex | 1051 -
Master/texmf-dist/tex/context/base/colo-x11.tex | 677 +
Master/texmf-dist/tex/context/base/cont-cz.tex | 35 -
Master/texmf-dist/tex/context/base/cont-fil.tex | 3 +-
Master/texmf-dist/tex/context/base/cont-log.tex | 66 +-
Master/texmf-dist/tex/context/base/cont-new.mkii | 3 +
Master/texmf-dist/tex/context/base/cont-new.mkiv | 116 +-
Master/texmf-dist/tex/context/base/cont-new.tex | 2 +-
Master/texmf-dist/tex/context/base/cont-uk.tex | 38 -
.../texmf-dist/tex/context/base/context-base.lmx | 68 +-
.../tex/context/base/context-characters.lmx | 2 +-
.../texmf-dist/tex/context/base/context-debug.lmx | 2 +-
.../texmf-dist/tex/context/base/context-error.lmx | 2 +-
.../tex/context/base/context-fonttest.lmx | 2 +-
.../texmf-dist/tex/context/base/context-help.lmx | 2 +-
.../texmf-dist/tex/context/base/context-timing.lmx | 2 +-
Master/texmf-dist/tex/context/base/context.mkii | 15 +-
Master/texmf-dist/tex/context/base/context.mkiv | 54 +-
Master/texmf-dist/tex/context/base/context.tex | 2 +-
Master/texmf-dist/tex/context/base/core-bar.tex | 194 -
Master/texmf-dist/tex/context/base/core-blk.tex | 676 -
Master/texmf-dist/tex/context/base/core-box.tex | 953 -
Master/texmf-dist/tex/context/base/core-con.lua | 176 +-
Master/texmf-dist/tex/context/base/core-con.mkiv | 4 +-
Master/texmf-dist/tex/context/base/core-ctx.lua | 25 +-
Master/texmf-dist/tex/context/base/core-ctx.mkiv | 4 +-
Master/texmf-dist/tex/context/base/core-def.mkii | 21 +
Master/texmf-dist/tex/context/base/core-def.mkiv | 38 +-
Master/texmf-dist/tex/context/base/core-env.mkiv | 170 +-
Master/texmf-dist/tex/context/base/core-fil.mkiv | 55 +-
Master/texmf-dist/tex/context/base/core-fnt.mkiv | 183 +-
Master/texmf-dist/tex/context/base/core-grd.mkii | 1074 -
Master/texmf-dist/tex/context/base/core-grd.mkiv | 1074 -
Master/texmf-dist/tex/context/base/core-ini.mkiv | 2 +-
Master/texmf-dist/tex/context/base/core-job.lua | 52 +-
Master/texmf-dist/tex/context/base/core-job.mkii | 5 +
Master/texmf-dist/tex/context/base/core-job.mkiv | 58 +-
Master/texmf-dist/tex/context/base/core-mis.mkiv | 121 +-
Master/texmf-dist/tex/context/base/core-spa.lua | 720 -
Master/texmf-dist/tex/context/base/core-spa.mkii | 4658 --
Master/texmf-dist/tex/context/base/core-spa.mkiv | 4277 --
Master/texmf-dist/tex/context/base/core-sys.lua | 22 +
Master/texmf-dist/tex/context/base/core-sys.mkiv | 149 +-
Master/texmf-dist/tex/context/base/core-two.lua | 8 +-
Master/texmf-dist/tex/context/base/core-two.mkiv | 2 +-
Master/texmf-dist/tex/context/base/core-uti.lua | 33 +-
Master/texmf-dist/tex/context/base/core-uti.mkiv | 2 +
Master/texmf-dist/tex/context/base/core-var.mkiv | 15 +-
Master/texmf-dist/tex/context/base/data-aux.lua | 20 +-
Master/texmf-dist/tex/context/base/data-bin.lua | 9 +-
Master/texmf-dist/tex/context/base/data-con.lua | 6 +-
Master/texmf-dist/tex/context/base/data-crl.lua | 10 +-
Master/texmf-dist/tex/context/base/data-ctx.lua | 6 +-
Master/texmf-dist/tex/context/base/data-gen.lua | 2 +-
Master/texmf-dist/tex/context/base/data-inp.lua | 2 +-
Master/texmf-dist/tex/context/base/data-lst.lua | 15 +-
Master/texmf-dist/tex/context/base/data-lua.lua | 125 +-
Master/texmf-dist/tex/context/base/data-out.lua | 2 +-
Master/texmf-dist/tex/context/base/data-pre.lua | 25 +-
Master/texmf-dist/tex/context/base/data-res.lua | 533 +-
Master/texmf-dist/tex/context/base/data-sch.lua | 142 +
Master/texmf-dist/tex/context/base/data-tex.lua | 37 +-
Master/texmf-dist/tex/context/base/data-tmf.lua | 43 +-
Master/texmf-dist/tex/context/base/data-tmp.lua | 8 +-
Master/texmf-dist/tex/context/base/data-tre.lua | 12 +-
Master/texmf-dist/tex/context/base/data-use.lua | 28 +-
Master/texmf-dist/tex/context/base/data-zip.lua | 78 +-
Master/texmf-dist/tex/context/base/enco-def.mkii | 2 +
Master/texmf-dist/tex/context/base/enco-ffr.mkii | 4 +
Master/texmf-dist/tex/context/base/enco-ini.mkii | 2 +-
Master/texmf-dist/tex/context/base/enco-ini.mkiv | 144 +-
Master/texmf-dist/tex/context/base/enco-l7x.mkii | 236 +
Master/texmf-dist/tex/context/base/font-afm.lua | 133 +-
Master/texmf-dist/tex/context/base/font-agl.lua | 3695 +
Master/texmf-dist/tex/context/base/font-chk.lua | 16 +-
Master/texmf-dist/tex/context/base/font-cid.lua | 13 +-
Master/texmf-dist/tex/context/base/font-col.lua | 5 +-
Master/texmf-dist/tex/context/base/font-col.mkiv | 4 +-
Master/texmf-dist/tex/context/base/font-ctx.lua | 314 +-
Master/texmf-dist/tex/context/base/font-def.lua | 140 +-
Master/texmf-dist/tex/context/base/font-dum.lua | 221 +-
Master/texmf-dist/tex/context/base/font-enc.lua | 4 +-
Master/texmf-dist/tex/context/base/font-enh.lua | 201 +
Master/texmf-dist/tex/context/base/font-ext.lua | 440 +-
Master/texmf-dist/tex/context/base/font-fbk.lua | 2 +-
Master/texmf-dist/tex/context/base/font-gds.lua | 294 +
Master/texmf-dist/tex/context/base/font-gds.mkiv | 83 +
Master/texmf-dist/tex/context/base/font-ini.lua | 58 +-
Master/texmf-dist/tex/context/base/font-ini.mkii | 30 +-
Master/texmf-dist/tex/context/base/font-ini.mkiv | 691 +-
Master/texmf-dist/tex/context/base/font-log.lua | 4 +-
Master/texmf-dist/tex/context/base/font-map.lua | 390 +-
Master/texmf-dist/tex/context/base/font-mis.lua | 28 +-
Master/texmf-dist/tex/context/base/font-ota.lua | 38 +-
Master/texmf-dist/tex/context/base/font-otb.lua | 228 +-
Master/texmf-dist/tex/context/base/font-otc.lua | 29 +-
Master/texmf-dist/tex/context/base/font-otd.lua | 2 +-
Master/texmf-dist/tex/context/base/font-otf.lua | 654 +-
Master/texmf-dist/tex/context/base/font-oti.lua | 2 +-
Master/texmf-dist/tex/context/base/font-otn.lua | 630 +-
Master/texmf-dist/tex/context/base/font-otp.lua | 156 +-
Master/texmf-dist/tex/context/base/font-ott.lua | 19 +-
Master/texmf-dist/tex/context/base/font-pat.lua | 36 +-
Master/texmf-dist/tex/context/base/font-run.mkiv | 45 +-
Master/texmf-dist/tex/context/base/font-syn.lua | 1273 +-
Master/texmf-dist/tex/context/base/font-tfm.lua | 455 +-
Master/texmf-dist/tex/context/base/font-tra.mkiv | 8 +-
Master/texmf-dist/tex/context/base/font-vf.lua | 2 +-
Master/texmf-dist/tex/context/base/font-xtx.lua | 27 +-
Master/texmf-dist/tex/context/base/font-xtx.mkii | 49 +-
Master/texmf-dist/tex/context/base/grph-fig.mkiv | 160 +-
Master/texmf-dist/tex/context/base/grph-fil.lua | 42 +
Master/texmf-dist/tex/context/base/grph-inc.lua | 530 +-
Master/texmf-dist/tex/context/base/grph-inc.mkii | 5 +-
Master/texmf-dist/tex/context/base/grph-inc.mkiv | 29 +-
Master/texmf-dist/tex/context/base/grph-swf.lua | 43 +
Master/texmf-dist/tex/context/base/grph-trf.mkii | 4 +-
Master/texmf-dist/tex/context/base/grph-trf.mkiv | 21 +-
Master/texmf-dist/tex/context/base/grph-u3d.lua | 48 +-
Master/texmf-dist/tex/context/base/hand-ini.mkiv | 34 +-
Master/texmf-dist/tex/context/base/java-ini.lua | 13 +-
Master/texmf-dist/tex/context/base/l-aux.lua | 108 +-
Master/texmf-dist/tex/context/base/l-boolean.lua | 2 +-
Master/texmf-dist/tex/context/base/l-dimen.lua | 109 +-
Master/texmf-dist/tex/context/base/l-dir.lua | 152 +-
Master/texmf-dist/tex/context/base/l-file.lua | 148 +-
Master/texmf-dist/tex/context/base/l-io.lua | 17 +-
Master/texmf-dist/tex/context/base/l-lpeg.lua | 157 +-
Master/texmf-dist/tex/context/base/l-math.lua | 2 +-
Master/texmf-dist/tex/context/base/l-md5.lua | 2 +-
Master/texmf-dist/tex/context/base/l-number.lua | 23 +-
Master/texmf-dist/tex/context/base/l-os.lua | 305 +-
Master/texmf-dist/tex/context/base/l-pdfview.lua | 95 +
Master/texmf-dist/tex/context/base/l-set.lua | 2 +-
Master/texmf-dist/tex/context/base/l-string.lua | 83 +-
Master/texmf-dist/tex/context/base/l-table.lua | 163 +-
Master/texmf-dist/tex/context/base/l-unicode.lua | 39 +-
Master/texmf-dist/tex/context/base/l-url.lua | 49 +-
Master/texmf-dist/tex/context/base/l-utils.lua | 30 +-
Master/texmf-dist/tex/context/base/l-xml.lua | 2442 +-
Master/texmf-dist/tex/context/base/lang-alt.tex | 91 +-
Master/texmf-dist/tex/context/base/lang-bal.tex | 108 +-
Master/texmf-dist/tex/context/base/lang-cjk.mkiv | 14 +-
Master/texmf-dist/tex/context/base/lang-ger.tex | 9 +
Master/texmf-dist/tex/context/base/lang-ini.lua | 281 +-
Master/texmf-dist/tex/context/base/lang-ini.mkii | 42 +-
Master/texmf-dist/tex/context/base/lang-ini.mkiv | 54 +-
Master/texmf-dist/tex/context/base/lang-ita.tex | 52 +-
Master/texmf-dist/tex/context/base/lang-lab.mkiv | 76 +-
Master/texmf-dist/tex/context/base/lang-mis.mkiv | 8 +-
Master/texmf-dist/tex/context/base/lang-sla.tex | 14 +-
Master/texmf-dist/tex/context/base/lang-url.lua | 136 +-
Master/texmf-dist/tex/context/base/lang-url.mkiv | 13 +-
Master/texmf-dist/tex/context/base/lang-wrd.lua | 225 +
Master/texmf-dist/tex/context/base/lang-wrd.mkiv | 54 +
Master/texmf-dist/tex/context/base/lpdf-ano.lua | 140 +-
Master/texmf-dist/tex/context/base/lpdf-col.lua | 2 +-
Master/texmf-dist/tex/context/base/lpdf-fld.lua | 334 +-
Master/texmf-dist/tex/context/base/lpdf-grp.lua | 18 +-
Master/texmf-dist/tex/context/base/lpdf-ini.lua | 461 +-
Master/texmf-dist/tex/context/base/lpdf-ini.mkiv | 15 +-
Master/texmf-dist/tex/context/base/lpdf-mis.lua | 133 +-
Master/texmf-dist/tex/context/base/lpdf-nod.lua | 8 +-
Master/texmf-dist/tex/context/base/lpdf-pdx.lua | 139 +
Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv | 71 +
Master/texmf-dist/tex/context/base/lpdf-ren.lua | 18 +-
Master/texmf-dist/tex/context/base/lpdf-swf.lua | 109 +
Master/texmf-dist/tex/context/base/lpdf-u3d.lua | 127 +-
Master/texmf-dist/tex/context/base/lpdf-wid.lua | 95 +-
Master/texmf-dist/tex/context/base/lpdf-xmp.lua | 165 +
Master/texmf-dist/tex/context/base/lpdf-xmp.xml | 43 +
Master/texmf-dist/tex/context/base/luat-cbk.lua | 128 +-
Master/texmf-dist/tex/context/base/luat-cnf.lua | 18 +-
Master/texmf-dist/tex/context/base/luat-cod.mkiv | 2 +-
Master/texmf-dist/tex/context/base/luat-dum.lua | 69 +-
Master/texmf-dist/tex/context/base/luat-env.lua | 78 +-
Master/texmf-dist/tex/context/base/luat-exe.lua | 21 +-
Master/texmf-dist/tex/context/base/luat-fio.lua | 6 +-
Master/texmf-dist/tex/context/base/luat-ini.lua | 16 +-
Master/texmf-dist/tex/context/base/luat-ini.mkiv | 18 +-
Master/texmf-dist/tex/context/base/luat-iop.lua | 167 +-
Master/texmf-dist/tex/context/base/luat-lib.mkiv | 9 +-
Master/texmf-dist/tex/context/base/luat-lua.lua | 5 +-
Master/texmf-dist/tex/context/base/luat-run.lua | 19 +-
Master/texmf-dist/tex/context/base/luat-sta.lua | 13 +-
Master/texmf-dist/tex/context/base/luat-sto.lua | 12 +-
Master/texmf-dist/tex/context/base/lxml-aux.lua | 543 +
Master/texmf-dist/tex/context/base/lxml-ctx.lua | 131 +
Master/texmf-dist/tex/context/base/lxml-ctx.mkiv | 64 +
Master/texmf-dist/tex/context/base/lxml-dir.lua | 112 +
Master/texmf-dist/tex/context/base/lxml-ent.lua | 124 +-
Master/texmf-dist/tex/context/base/lxml-inf.lua | 53 +
Master/texmf-dist/tex/context/base/lxml-ini.lua | 1138 -
Master/texmf-dist/tex/context/base/lxml-ini.mkiv | 360 +-
Master/texmf-dist/tex/context/base/lxml-lpt.lua | 1259 +
Master/texmf-dist/tex/context/base/lxml-mis.lua | 57 +-
Master/texmf-dist/tex/context/base/lxml-pth.lua | 1555 -
Master/texmf-dist/tex/context/base/lxml-sor.lua | 158 +
Master/texmf-dist/tex/context/base/lxml-sor.mkiv | 94 +
Master/texmf-dist/tex/context/base/lxml-tab.lua | 1025 +-
Master/texmf-dist/tex/context/base/lxml-tex.lua | 1410 +
Master/texmf-dist/tex/context/base/lxml-xml.lua | 288 +
Master/texmf-dist/tex/context/base/m-barcodes.mkiv | 122 +
Master/texmf-dist/tex/context/base/m-chart.mkii | 48 +
Master/texmf-dist/tex/context/base/m-chart.mkiv | 20 +
Master/texmf-dist/tex/context/base/m-chart.tex | 36 +-
Master/texmf-dist/tex/context/base/m-chemic.mkiv | 5 +-
Master/texmf-dist/tex/context/base/m-database.tex | 60 +-
.../texmf-dist/tex/context/base/m-directives.tex | 5 +
Master/texmf-dist/tex/context/base/m-graph.mkiv | 2 +-
Master/texmf-dist/tex/context/base/m-narrowtt.tex | 2 +-
Master/texmf-dist/tex/context/base/m-obsolete.tex | 5 +
Master/texmf-dist/tex/context/base/m-pstric.tex | 113 -
Master/texmf-dist/tex/context/base/m-pstricks.lua | 73 +
Master/texmf-dist/tex/context/base/m-pstricks.mkii | 127 +
Master/texmf-dist/tex/context/base/m-pstricks.mkiv | 66 +
Master/texmf-dist/tex/context/base/m-pstricks.tex | 16 +
Master/texmf-dist/tex/context/base/m-punk.mkiv | 243 +
Master/texmf-dist/tex/context/base/m-punk.tex | 233 +-
Master/texmf-dist/tex/context/base/m-steps.mkii | 83 +
Master/texmf-dist/tex/context/base/m-steps.mkiv | 20 +
Master/texmf-dist/tex/context/base/m-steps.tex | 69 -
Master/texmf-dist/tex/context/base/m-timing.tex | 26 +-
Master/texmf-dist/tex/context/base/m-track.tex | 5 -
Master/texmf-dist/tex/context/base/m-trackers.tex | 5 +
Master/texmf-dist/tex/context/base/m-translate.tex | 6 +-
Master/texmf-dist/tex/context/base/math-ali.mkiv | 273 +-
Master/texmf-dist/tex/context/base/math-arr.mkiv | 74 +-
Master/texmf-dist/tex/context/base/math-def.mkiv | 128 +-
Master/texmf-dist/tex/context/base/math-dim.lua | 17 +-
Master/texmf-dist/tex/context/base/math-ent.lua | 2 +-
Master/texmf-dist/tex/context/base/math-ext.lua | 37 +-
Master/texmf-dist/tex/context/base/math-for.mkiv | 12 +-
Master/texmf-dist/tex/context/base/math-ini.lua | 46 +-
Master/texmf-dist/tex/context/base/math-ini.mkii | 5 +-
Master/texmf-dist/tex/context/base/math-ini.mkiv | 199 +-
Master/texmf-dist/tex/context/base/math-inl.mkiv | 339 +-
Master/texmf-dist/tex/context/base/math-int.mkiv | 5 +-
Master/texmf-dist/tex/context/base/math-lan.mkiv | 67 +
Master/texmf-dist/tex/context/base/math-lbr.mkii | 67 +-
Master/texmf-dist/tex/context/base/math-map.lua | 287 +-
Master/texmf-dist/tex/context/base/math-noa.lua | 78 +-
Master/texmf-dist/tex/context/base/math-pln.mkiv | 2 +-
Master/texmf-dist/tex/context/base/math-run.mkii | 54 +-
Master/texmf-dist/tex/context/base/math-scr.mkiv | 88 +-
Master/texmf-dist/tex/context/base/math-tex.mkii | 2 +
Master/texmf-dist/tex/context/base/math-vfu.lua | 880 +-
Master/texmf-dist/tex/context/base/meta-dum.tex | 2 +
Master/texmf-dist/tex/context/base/meta-fig.mkiv | 2 +-
Master/texmf-dist/tex/context/base/meta-fun.lua | 2 +-
Master/texmf-dist/tex/context/base/meta-ini.mkii | 8 +
Master/texmf-dist/tex/context/base/meta-ini.mkiv | 133 +-
Master/texmf-dist/tex/context/base/meta-pdf.lua | 20 +-
Master/texmf-dist/tex/context/base/meta-pdh.lua | 58 +-
Master/texmf-dist/tex/context/base/meta-pdh.mkiv | 2 +-
Master/texmf-dist/tex/context/base/meta-tex.mkii | 11 +-
Master/texmf-dist/tex/context/base/meta-tex.mkiv | 2 +-
Master/texmf-dist/tex/context/base/meta-txt.tex | 24 +-
Master/texmf-dist/tex/context/base/metatex.tex | 27 +-
Master/texmf-dist/tex/context/base/mlib-ctx.lua | 39 +-
Master/texmf-dist/tex/context/base/mlib-pdf.lua | 8 +-
Master/texmf-dist/tex/context/base/mlib-pps.lua | 212 +-
Master/texmf-dist/tex/context/base/mlib-pps.mkiv | 49 +-
Master/texmf-dist/tex/context/base/mlib-run.lua | 19 +-
.../tex/context/base/mtx-context-arrange.tex | 12 +-
.../tex/context/base/mtx-context-combine.tex | 70 +-
.../tex/context/base/mtx-context-common.tex | 43 +
.../tex/context/base/mtx-context-ideas.tex | 2 -
.../tex/context/base/mtx-context-listing.tex | 74 +-
.../tex/context/base/mtx-context-timing.tex | 2 -
Master/texmf-dist/tex/context/base/mult-chk.lua | 8 +-
Master/texmf-dist/tex/context/base/mult-cld.lua | 170 +-
Master/texmf-dist/tex/context/base/mult-cld.mkiv | 11 +-
Master/texmf-dist/tex/context/base/mult-clm.lua | 184 +
Master/texmf-dist/tex/context/base/mult-de.tex | 69 +-
Master/texmf-dist/tex/context/base/mult-def.lua | 335 +-
Master/texmf-dist/tex/context/base/mult-en.tex | 73 +-
Master/texmf-dist/tex/context/base/mult-fr.tex | 69 +-
Master/texmf-dist/tex/context/base/mult-ini.lua | 47 +-
Master/texmf-dist/tex/context/base/mult-ini.mkiv | 62 +-
Master/texmf-dist/tex/context/base/mult-it.tex | 69 +-
Master/texmf-dist/tex/context/base/mult-mcs.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mde.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-men.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mes.lua | 43 +-
Master/texmf-dist/tex/context/base/mult-mfr.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mit.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mnl.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mno.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mpe.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-mro.tex | 110 +-
Master/texmf-dist/tex/context/base/mult-nl.tex | 73 +-
Master/texmf-dist/tex/context/base/mult-ro.tex | 69 +-
Master/texmf-dist/tex/context/base/mult-sys.tex | 75 +-
Master/texmf-dist/tex/context/base/node-aux.lua | 145 +
Master/texmf-dist/tex/context/base/node-bck.lua | 5 +-
Master/texmf-dist/tex/context/base/node-bck.mkiv | 4 +-
Master/texmf-dist/tex/context/base/node-dir.lua | 308 +
Master/texmf-dist/tex/context/base/node-ext.lua | 2 +-
Master/texmf-dist/tex/context/base/node-fin.lua | 8 +-
Master/texmf-dist/tex/context/base/node-fin.mkiv | 12 +-
Master/texmf-dist/tex/context/base/node-fnt.lua | 11 +-
Master/texmf-dist/tex/context/base/node-ini.lua | 50 +-
Master/texmf-dist/tex/context/base/node-ini.mkiv | 30 +-
Master/texmf-dist/tex/context/base/node-inj.lua | 135 +-
Master/texmf-dist/tex/context/base/node-mig.lua | 120 +
Master/texmf-dist/tex/context/base/node-mig.mkiv | 60 +
Master/texmf-dist/tex/context/base/node-pag.lua | 30 +
Master/texmf-dist/tex/context/base/node-pag.mkiv | 20 +
Master/texmf-dist/tex/context/base/node-par.lua | 88 +-
Master/texmf-dist/tex/context/base/node-par.mkiv | 40 +-
Master/texmf-dist/tex/context/base/node-pro.lua | 32 +-
Master/texmf-dist/tex/context/base/node-ref.lua | 34 +-
Master/texmf-dist/tex/context/base/node-res.lua | 230 +-
Master/texmf-dist/tex/context/base/node-rul.lua | 288 +
Master/texmf-dist/tex/context/base/node-rul.mkiv | 343 +
Master/texmf-dist/tex/context/base/node-seq.lua | 104 +-
Master/texmf-dist/tex/context/base/node-ser.lua | 4 +-
Master/texmf-dist/tex/context/base/node-shp.lua | 4 +-
Master/texmf-dist/tex/context/base/node-tex.lua | 8 +-
Master/texmf-dist/tex/context/base/node-tra.lua | 94 +-
Master/texmf-dist/tex/context/base/node-tsk.lua | 167 +-
Master/texmf-dist/tex/context/base/node-tst.lua | 10 +-
Master/texmf-dist/tex/context/base/node-typ.lua | 53 +
Master/texmf-dist/tex/context/base/pack-box.mkii | 16 +-
Master/texmf-dist/tex/context/base/pack-box.mkiv | 31 +-
Master/texmf-dist/tex/context/base/pack-lyr.mkiv | 20 +-
Master/texmf-dist/tex/context/base/pack-obj.lua | 2 +-
Master/texmf-dist/tex/context/base/pack-obj.mkiv | 3 +-
Master/texmf-dist/tex/context/base/pack-rul.lua | 16 +-
Master/texmf-dist/tex/context/base/pack-rul.mkiv | 273 +-
Master/texmf-dist/tex/context/base/page-app.mkiv | 14 +-
Master/texmf-dist/tex/context/base/page-bck.mkiv | 8 +-
Master/texmf-dist/tex/context/base/page-flt.lua | 227 +
Master/texmf-dist/tex/context/base/page-flt.mkiv | 233 +
Master/texmf-dist/tex/context/base/page-flw.mkiv | 6 +-
Master/texmf-dist/tex/context/base/page-imp.mkiv | 15 +-
Master/texmf-dist/tex/context/base/page-ini.mkii | 2 +-
Master/texmf-dist/tex/context/base/page-ini.mkiv | 164 +-
Master/texmf-dist/tex/context/base/page-lay.mkiv | 69 +-
Master/texmf-dist/tex/context/base/page-lin.lua | 238 +-
Master/texmf-dist/tex/context/base/page-lin.mkiv | 286 +-
Master/texmf-dist/tex/context/base/page-mak.mkiv | 14 +-
Master/texmf-dist/tex/context/base/page-mar.mkiv | 17 +-
Master/texmf-dist/tex/context/base/page-mis.mkiv | 127 +-
Master/texmf-dist/tex/context/base/page-mul.mkiv | 180 +-
Master/texmf-dist/tex/context/base/page-not.mkiv | 11 +-
Master/texmf-dist/tex/context/base/page-one.mkiv | 172 +-
Master/texmf-dist/tex/context/base/page-par.mkiv | 2 +-
Master/texmf-dist/tex/context/base/page-plg.mkiv | 4 +-
Master/texmf-dist/tex/context/base/page-set.mkii | 369 +-
Master/texmf-dist/tex/context/base/page-set.mkiv | 506 +-
Master/texmf-dist/tex/context/base/page-sid.mkiv | 99 +-
Master/texmf-dist/tex/context/base/page-spr.mkiv | 4 +-
Master/texmf-dist/tex/context/base/page-str.lua | 221 +
Master/texmf-dist/tex/context/base/page-str.mkiv | 438 +-
Master/texmf-dist/tex/context/base/page-txt.mkiv | 121 +-
Master/texmf-dist/tex/context/base/ppchtex.mkii | 101 +-
Master/texmf-dist/tex/context/base/ppchtex.mkiv | 113 +-
Master/texmf-dist/tex/context/base/pret-lua.lua | 147 +-
Master/texmf-dist/tex/context/base/pret-mp.lua | 6 +-
Master/texmf-dist/tex/context/base/pret-tex.lua | 6 +-
Master/texmf-dist/tex/context/base/pret-xml.lua | 136 +
Master/texmf-dist/tex/context/base/prop-ini.mkiv | 22 +-
Master/texmf-dist/tex/context/base/prop-lay.mkiv | 6 +-
Master/texmf-dist/tex/context/base/prop-mis.mkiv | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-1.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-10.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-11.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-13.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-14.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-15.lua | 46 +-
.../texmf-dist/tex/context/base/regi-8859-16.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-2.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-3.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-4.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-5.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-6.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-7.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-8.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-8859-9.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1250.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1251.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1252.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1253.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1254.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1255.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1256.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1257.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-cp1258.lua | 46 +-
Master/texmf-dist/tex/context/base/regi-ini.lua | 8 +-
Master/texmf-dist/tex/context/base/regi-ini.mkiv | 2 +-
Master/texmf-dist/tex/context/base/regi-utf.mkii | 1 +
Master/texmf-dist/tex/context/base/s-abr-01.tex | 7 +-
Master/texmf-dist/tex/context/base/s-chi-00.tex | 2 +-
Master/texmf-dist/tex/context/base/s-fnt-10.tex | 1 +
Master/texmf-dist/tex/context/base/s-fnt-25.tex | 40 +-
Master/texmf-dist/tex/context/base/s-fnt-26.tex | 73 +
Master/texmf-dist/tex/context/base/s-inf-01.tex | 203 +
Master/texmf-dist/tex/context/base/s-inf-02.tex | 27 +
Master/texmf-dist/tex/context/base/s-map-10.tex | 3 +-
Master/texmf-dist/tex/context/base/s-mod-00.tex | 11 +-
Master/texmf-dist/tex/context/base/s-mod-01.tex | 17 +-
Master/texmf-dist/tex/context/base/s-mod.ctx | 24 +
Master/texmf-dist/tex/context/base/s-pre-60.tex | 2 +-
Master/texmf-dist/tex/context/base/s-pre-64.tex | 2 +-
Master/texmf-dist/tex/context/base/s-ptj-01.tex | 166 +-
Master/texmf-dist/tex/context/base/scrn-bar.mkiv | 4 +-
Master/texmf-dist/tex/context/base/scrn-but.mkiv | 5 +-
Master/texmf-dist/tex/context/base/scrn-fld.mkii | 2 +
Master/texmf-dist/tex/context/base/scrn-fld.mkiv | 105 +-
Master/texmf-dist/tex/context/base/scrn-hlp.mkiv | 46 +-
Master/texmf-dist/tex/context/base/scrn-int.lua | 2 +-
Master/texmf-dist/tex/context/base/scrn-int.mkii | 24 +-
Master/texmf-dist/tex/context/base/scrn-int.mkiv | 67 +-
Master/texmf-dist/tex/context/base/scrn-men.mkiv | 19 +-
Master/texmf-dist/tex/context/base/scrn-nav.mkiv | 28 +-
Master/texmf-dist/tex/context/base/scrp-cjk.lua | 13 +-
Master/texmf-dist/tex/context/base/scrp-ini.lua | 4 +-
Master/texmf-dist/tex/context/base/scrp-ini.mkiv | 16 +-
Master/texmf-dist/tex/context/base/sort-ini.lua | 320 +-
Master/texmf-dist/tex/context/base/sort-lan.lua | 402 +-
Master/texmf-dist/tex/context/base/sort-lan.mkii | 74 +-
Master/texmf-dist/tex/context/base/spac-ali.mkiv | 677 +
Master/texmf-dist/tex/context/base/spac-def.mkiv | 118 +
Master/texmf-dist/tex/context/base/spac-fnt.mkiv | 94 +
Master/texmf-dist/tex/context/base/spac-gen.mkii | 4652 ++
Master/texmf-dist/tex/context/base/spac-grd.mkii | 1074 +
Master/texmf-dist/tex/context/base/spac-grd.mkiv | 259 +
Master/texmf-dist/tex/context/base/spac-hor.lua | 32 +
Master/texmf-dist/tex/context/base/spac-hor.mkiv | 946 +
Master/texmf-dist/tex/context/base/spac-pag.mkiv | 199 +
Master/texmf-dist/tex/context/base/spac-par.mkiv | 192 +
Master/texmf-dist/tex/context/base/spac-ver.lua | 1185 +
Master/texmf-dist/tex/context/base/spac-ver.mkiv | 2078 +
Master/texmf-dist/tex/context/base/spec-dpm.mkii | 3 +-
Master/texmf-dist/tex/context/base/spec-dpx.mkii | 3 +-
Master/texmf-dist/tex/context/base/spec-fdf.mkii | 229 +-
Master/texmf-dist/tex/context/base/spec-tpd.mkii | 2 +-
Master/texmf-dist/tex/context/base/spec-tst.mkii | 102 +-
Master/texmf-dist/tex/context/base/strc-bkm.lua | 52 +-
Master/texmf-dist/tex/context/base/strc-bkm.mkiv | 5 +-
Master/texmf-dist/tex/context/base/strc-blk.lua | 17 +-
Master/texmf-dist/tex/context/base/strc-blk.mkiv | 18 +-
Master/texmf-dist/tex/context/base/strc-def.mkiv | 19 +-
Master/texmf-dist/tex/context/base/strc-des.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-des.mkiv | 390 +-
Master/texmf-dist/tex/context/base/strc-doc.lua | 163 +-
Master/texmf-dist/tex/context/base/strc-doc.mkiv | 84 +-
Master/texmf-dist/tex/context/base/strc-flt.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-flt.mkiv | 409 +-
Master/texmf-dist/tex/context/base/strc-ini.lua | 42 +-
Master/texmf-dist/tex/context/base/strc-ini.mkiv | 8 +-
Master/texmf-dist/tex/context/base/strc-itm.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-itm.mkii | 33 +-
Master/texmf-dist/tex/context/base/strc-itm.mkiv | 347 +-
Master/texmf-dist/tex/context/base/strc-lnt.mkiv | 54 +-
Master/texmf-dist/tex/context/base/strc-lst.lua | 255 +-
Master/texmf-dist/tex/context/base/strc-lst.mkiv | 91 +-
Master/texmf-dist/tex/context/base/strc-mar.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-mar.mkiv | 14 +-
Master/texmf-dist/tex/context/base/strc-mat.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-mat.mkiv | 962 +-
Master/texmf-dist/tex/context/base/strc-not.lua | 75 +-
Master/texmf-dist/tex/context/base/strc-not.mkii | 32 +
Master/texmf-dist/tex/context/base/strc-not.mkiv | 405 +-
Master/texmf-dist/tex/context/base/strc-num.lua | 98 +-
Master/texmf-dist/tex/context/base/strc-num.mkiv | 110 +-
Master/texmf-dist/tex/context/base/strc-pag.lua | 110 +-
Master/texmf-dist/tex/context/base/strc-pag.mkiv | 97 +-
Master/texmf-dist/tex/context/base/strc-prc.lua | 2 +-
Master/texmf-dist/tex/context/base/strc-prc.mkiv | 2 +-
Master/texmf-dist/tex/context/base/strc-ref.lua | 641 +-
Master/texmf-dist/tex/context/base/strc-ref.mkii | 3 +
Master/texmf-dist/tex/context/base/strc-ref.mkiv | 290 +-
Master/texmf-dist/tex/context/base/strc-reg.lua | 245 +-
Master/texmf-dist/tex/context/base/strc-reg.mkii | 3 +-
Master/texmf-dist/tex/context/base/strc-reg.mkiv | 282 +-
Master/texmf-dist/tex/context/base/strc-ren.mkiv | 95 +-
Master/texmf-dist/tex/context/base/strc-sbe.mkiv | 11 +-
Master/texmf-dist/tex/context/base/strc-sec.mkiv | 244 +-
Master/texmf-dist/tex/context/base/strc-syn.lua | 42 +-
Master/texmf-dist/tex/context/base/strc-syn.mkiv | 103 +-
Master/texmf-dist/tex/context/base/strc-xml.mkiv | 18 +-
Master/texmf-dist/tex/context/base/supp-box.tex | 7 +
Master/texmf-dist/tex/context/base/supp-dir.mkiv | 23 +
Master/texmf-dist/tex/context/base/supp-fil.lua | 201 +-
Master/texmf-dist/tex/context/base/supp-fil.mkii | 2 +
Master/texmf-dist/tex/context/base/supp-fil.mkiv | 199 +-
Master/texmf-dist/tex/context/base/supp-mat.mkii | 293 +
Master/texmf-dist/tex/context/base/supp-mat.mkiv | 293 +
Master/texmf-dist/tex/context/base/supp-mat.tex | 293 -
Master/texmf-dist/tex/context/base/supp-mis.mkii | 27 +-
Master/texmf-dist/tex/context/base/supp-mis.tex | 9 +-
Master/texmf-dist/tex/context/base/supp-mpe.tex | 9 +-
Master/texmf-dist/tex/context/base/supp-mps.mkii | 3 +-
Master/texmf-dist/tex/context/base/supp-num.tex | 23 +-
Master/texmf-dist/tex/context/base/supp-pdf.tex | 3 +-
Master/texmf-dist/tex/context/base/supp-ran.lua | 31 +-
Master/texmf-dist/tex/context/base/supp-vis.tex | 11 +-
Master/texmf-dist/tex/context/base/symb-ini.mkiv | 10 +-
Master/texmf-dist/tex/context/base/syst-aux.mkiv | 246 +-
Master/texmf-dist/tex/context/base/syst-con.lua | 2 +-
Master/texmf-dist/tex/context/base/syst-ext.mkii | 29 +-
Master/texmf-dist/tex/context/base/syst-gen.mkii | 10 +-
Master/texmf-dist/tex/context/base/syst-ini.tex | 17 +-
Master/texmf-dist/tex/context/base/syst-ltx.tex | 56 +
Master/texmf-dist/tex/context/base/syst-lua.lua | 46 +-
Master/texmf-dist/tex/context/base/tabl-com.mkii | 21 +
Master/texmf-dist/tex/context/base/tabl-com.mkiv | 21 +
Master/texmf-dist/tex/context/base/tabl-ltb.mkii | 2 +-
Master/texmf-dist/tex/context/base/tabl-ltb.mkiv | 30 +-
Master/texmf-dist/tex/context/base/tabl-ntb.mkii | 2 +
Master/texmf-dist/tex/context/base/tabl-ntb.mkiv | 100 +-
Master/texmf-dist/tex/context/base/tabl-tab.mkiv | 81 +-
Master/texmf-dist/tex/context/base/tabl-tbl.mkii | 3 +-
Master/texmf-dist/tex/context/base/tabl-tbl.mkiv | 108 +-
Master/texmf-dist/tex/context/base/tabl-tsp.mkiv | 6 +-
Master/texmf-dist/tex/context/base/task-ini.lua | 101 +-
Master/texmf-dist/tex/context/base/toks-ini.lua | 12 +-
Master/texmf-dist/tex/context/base/toks-ini.mkiv | 4 +-
Master/texmf-dist/tex/context/base/trac-deb.lua | 73 +-
Master/texmf-dist/tex/context/base/trac-deb.mkiv | 16 +-
Master/texmf-dist/tex/context/base/trac-inf.lua | 36 +-
Master/texmf-dist/tex/context/base/trac-lmx.lua | 263 +-
Master/texmf-dist/tex/context/base/trac-log.lua | 70 +-
Master/texmf-dist/tex/context/base/trac-tex.mkiv | 19 +
Master/texmf-dist/tex/context/base/trac-tim.lua | 101 +-
Master/texmf-dist/tex/context/base/trac-tra.lua | 180 +-
Master/texmf-dist/tex/context/base/type-buy.mkii | 571 +
Master/texmf-dist/tex/context/base/type-buy.mkiv | 82 +
Master/texmf-dist/tex/context/base/type-buy.tex | 791 -
Master/texmf-dist/tex/context/base/type-cbg.mkii | 352 +
Master/texmf-dist/tex/context/base/type-cbg.tex | 352 -
Master/texmf-dist/tex/context/base/type-cow.mkii | 85 +
Master/texmf-dist/tex/context/base/type-cow.mkiv | 85 +
Master/texmf-dist/tex/context/base/type-cow.tex | 85 -
Master/texmf-dist/tex/context/base/type-def.mkii | 86 +
Master/texmf-dist/tex/context/base/type-def.mkiv | 48 +
Master/texmf-dist/tex/context/base/type-def.tex | 128 -
Master/texmf-dist/tex/context/base/type-exp.mkii | 95 +
Master/texmf-dist/tex/context/base/type-exp.tex | 95 -
Master/texmf-dist/tex/context/base/type-fsf.mkii | 94 +
Master/texmf-dist/tex/context/base/type-fsf.tex | 94 -
Master/texmf-dist/tex/context/base/type-ghz.mkii | 409 +
Master/texmf-dist/tex/context/base/type-ghz.mkiv | 322 +
Master/texmf-dist/tex/context/base/type-ghz.tex | 409 -
Master/texmf-dist/tex/context/base/type-hgz.mkii | 1 +
Master/texmf-dist/tex/context/base/type-hgz.mkiv | 1 +
Master/texmf-dist/tex/context/base/type-hgz.tex | 322 -
.../tex/context/base/type-husayni-default.mkiv | 146 +
Master/texmf-dist/tex/context/base/type-ini.mkii | 19 +-
Master/texmf-dist/tex/context/base/type-ini.mkiv | 296 +-
Master/texmf-dist/tex/context/base/type-lua.mkiv | 88 +
Master/texmf-dist/tex/context/base/type-mac.mkii | 373 +
Master/texmf-dist/tex/context/base/type-mac.mkiv | 373 +
Master/texmf-dist/tex/context/base/type-mac.tex | 434 -
Master/texmf-dist/tex/context/base/type-msw.mkii | 1 +
Master/texmf-dist/tex/context/base/type-msw.mkiv | 1 +
Master/texmf-dist/tex/context/base/type-msw.tex | 69 -
Master/texmf-dist/tex/context/base/type-one.mkii | 3867 +-
Master/texmf-dist/tex/context/base/type-one.mkiv | 99 +-
Master/texmf-dist/tex/context/base/type-one.tex | 16 -
Master/texmf-dist/tex/context/base/type-otf.mkii | 2426 +-
Master/texmf-dist/tex/context/base/type-otf.mkiv | 2162 +-
Master/texmf-dist/tex/context/base/type-otf.tex | 155 -
Master/texmf-dist/tex/context/base/type-pre.mkii | 253 +
Master/texmf-dist/tex/context/base/type-pre.tex | 253 -
Master/texmf-dist/tex/context/base/type-run.mkiv | 4 +-
Master/texmf-dist/tex/context/base/type-set.mkii | 81 +
Master/texmf-dist/tex/context/base/type-set.mkiv | 77 +
Master/texmf-dist/tex/context/base/type-siz.mkii | 157 +
Master/texmf-dist/tex/context/base/type-siz.mkiv | 159 +
Master/texmf-dist/tex/context/base/type-siz.tex | 179 -
Master/texmf-dist/tex/context/base/type-tmf.mkii | 1147 -
Master/texmf-dist/tex/context/base/type-tmf.mkiv | 919 -
Master/texmf-dist/tex/context/base/type-tmf.tex | 16 -
Master/texmf-dist/tex/context/base/type-win.mkii | 69 +
Master/texmf-dist/tex/context/base/type-win.mkiv | 118 +
Master/texmf-dist/tex/context/base/type-win.tex | 120 -
Master/texmf-dist/tex/context/base/type-xtx.mkii | 563 +
Master/texmf-dist/tex/context/base/type-xtx.tex | 564 -
Master/texmf-dist/tex/context/base/typo-brk.lua | 119 +-
Master/texmf-dist/tex/context/base/typo-brk.mkiv | 46 +-
Master/texmf-dist/tex/context/base/typo-cap.lua | 14 +-
Master/texmf-dist/tex/context/base/typo-cap.mkiv | 22 +-
Master/texmf-dist/tex/context/base/typo-dig.lua | 106 +
Master/texmf-dist/tex/context/base/typo-dig.mkiv | 51 +
Master/texmf-dist/tex/context/base/typo-krn.lua | 84 +-
Master/texmf-dist/tex/context/base/typo-krn.mkiv | 60 +-
Master/texmf-dist/tex/context/base/typo-mir.lua | 63 +-
Master/texmf-dist/tex/context/base/typo-mir.mkiv | 14 +-
Master/texmf-dist/tex/context/base/typo-rep.lua | 135 +
Master/texmf-dist/tex/context/base/typo-rep.mkiv | 53 +
Master/texmf-dist/tex/context/base/typo-spa.lua | 27 +-
Master/texmf-dist/tex/context/base/typo-spa.mkiv | 12 +-
Master/texmf-dist/tex/context/base/unic-031.mkii | 10 -
Master/texmf-dist/tex/context/base/verb-eif.mkii | 2 +-
Master/texmf-dist/tex/context/base/verb-ini.mkii | 25 +-
Master/texmf-dist/tex/context/base/verb-js.mkii | 2 +-
Master/texmf-dist/tex/context/base/verb-jv.mkii | 2 +-
Master/texmf-dist/tex/context/base/verb-pas.mkii | 2 +-
Master/texmf-dist/tex/context/base/verb-raw.mkii | 6 +-
Master/texmf-dist/tex/context/base/verb-sql.mkii | 2 +-
Master/texmf-dist/tex/context/base/x-asciimath.lua | 267 +
.../texmf-dist/tex/context/base/x-asciimath.mkiv | 96 +
Master/texmf-dist/tex/context/base/x-calcmath.lua | 289 +-
Master/texmf-dist/tex/context/base/x-calcmath.mkiv | 2 -
Master/texmf-dist/tex/context/base/x-cals.lua | 209 +
Master/texmf-dist/tex/context/base/x-cals.mkiv | 207 +-
Master/texmf-dist/tex/context/base/x-chemml.mkiv | 2 +-
Master/texmf-dist/tex/context/base/x-contml.mkii | 491 +
Master/texmf-dist/tex/context/base/x-contml.tex | 493 -
Master/texmf-dist/tex/context/base/x-corres.mkii | 136 +
Master/texmf-dist/tex/context/base/x-corres.tex | 136 -
Master/texmf-dist/tex/context/base/x-ct.lua | 182 +
Master/texmf-dist/tex/context/base/x-ct.mkiv | 179 +-
Master/texmf-dist/tex/context/base/x-dir-05.mkii | 51 +
Master/texmf-dist/tex/context/base/x-dir-05.mkiv | 72 +
Master/texmf-dist/tex/context/base/x-fe.mkii | 143 +
Master/texmf-dist/tex/context/base/x-fe.tex | 143 -
Master/texmf-dist/tex/context/base/x-fig-03.tex | 10 +-
Master/texmf-dist/tex/context/base/x-fo.mkii | 4059 ++
Master/texmf-dist/tex/context/base/x-fo.tex | 4063 --
Master/texmf-dist/tex/context/base/x-foxet.mkii | 28 +
Master/texmf-dist/tex/context/base/x-foxet.mkiv | 29 +
Master/texmf-dist/tex/context/base/x-foxet.tex | 15 -
Master/texmf-dist/tex/context/base/x-ldx.tex | 20 +-
Master/texmf-dist/tex/context/base/x-mathml.lua | 331 +-
Master/texmf-dist/tex/context/base/x-mathml.mkiv | 77 +-
Master/texmf-dist/tex/context/base/x-pending.mkiv | 39 +
Master/texmf-dist/tex/context/base/x-set-11.mkii | 556 +-
Master/texmf-dist/tex/context/base/x-set-11.mkiv | 566 +-
Master/texmf-dist/tex/context/base/x-set-11.tex | 890 +-
Master/texmf-dist/tex/context/base/x-set-12.tex | 17 +-
Master/texmf-dist/tex/context/base/x-set-99.tex | 283 +
Master/texmf-dist/tex/context/base/x-xtag.mkiv | 23 +
Master/texmf-dist/tex/context/bib/bibl-apa-de.tex | 4 +-
Master/texmf-dist/tex/context/bib/t-bib.mkii | 5 -
Master/texmf-dist/tex/context/bib/t-bib.mkiv | 62 -
Master/texmf-dist/tex/context/bib/t-bib.tex | 1929 -
Master/texmf-dist/tex/context/bib/t-bibltx.tex | 75 -
Master/texmf-dist/tex/context/config/cont-cz.ini | 5 -
Master/texmf-dist/tex/context/config/cont-de.ini | 5 -
Master/texmf-dist/tex/context/config/cont-en.ini | 5 -
Master/texmf-dist/tex/context/config/cont-fmt.tex | 29 -
Master/texmf-dist/tex/context/config/cont-fr.ini | 5 -
Master/texmf-dist/tex/context/config/cont-it.ini | 5 -
Master/texmf-dist/tex/context/config/cont-nl.ini | 5 -
Master/texmf-dist/tex/context/config/cont-ro.ini | 5 -
Master/texmf-dist/tex/context/config/cont-uk.ini | 5 -
.../texmf-dist/tex/context/fonts/antykwa-math.lfg | 57 +
.../texmf-dist/tex/context/fonts/charter-math.lfg | 28 +
.../texmf-dist/tex/context/fonts/garamond-math.lfg | 28 +
Master/texmf-dist/tex/context/fonts/husayni.lfg | 178 +
.../texmf-dist/tex/context/fonts/hvmath-math.lfg | 24 +
.../texmf-dist/tex/context/fonts/informal-math.lfg | 22 +
Master/texmf-dist/tex/context/fonts/iwona-math.lfg | 57 +
Master/texmf-dist/tex/context/fonts/lm-math.lfg | 230 +
.../texmf-dist/tex/context/fonts/lucida-math.lfg | 320 +
.../tex/context/fonts/mathtimes-math.lfg | 24 +
Master/texmf-dist/tex/context/fonts/px-math.lfg | 24 +
.../texmf-dist/tex/context/fonts/symbol-math.lfg | 17 +
Master/texmf-dist/tex/context/fonts/tx-math.lfg | 24 +
.../texmf-dist/tex/context/fonts/utopia-math.lfg | 28 +
.../texmf-dist/tex/context/interface/cont-cs.xml | 71 +-
.../texmf-dist/tex/context/interface/cont-de.xml | 71 +-
.../texmf-dist/tex/context/interface/cont-en.xml | 59 +-
.../texmf-dist/tex/context/interface/cont-fr.xml | 67 +-
.../texmf-dist/tex/context/interface/cont-it.xml | 71 +-
.../texmf-dist/tex/context/interface/cont-nl.xml | 71 +-
.../texmf-dist/tex/context/interface/cont-pe.xml | 71 +-
.../texmf-dist/tex/context/interface/cont-ro.xml | 71 +-
.../texmf-dist/tex/context/interface/keys-cs.xml | 69 +-
.../texmf-dist/tex/context/interface/keys-de.xml | 69 +-
.../texmf-dist/tex/context/interface/keys-en.xml | 73 +-
.../texmf-dist/tex/context/interface/keys-fr.xml | 69 +-
.../texmf-dist/tex/context/interface/keys-it.xml | 69 +-
.../texmf-dist/tex/context/interface/keys-nl.xml | 73 +-
.../texmf-dist/tex/context/interface/keys-pe.xml | 69 +-
.../texmf-dist/tex/context/interface/keys-ro.xml | 69 +-
Master/texmf-dist/tex/context/interface/t-bib.xml | 411 -
Master/texmf-dist/tex/context/patterns/lang-ba.hyp | 36 -
Master/texmf-dist/tex/context/patterns/lang-ba.pat | 224 -
Master/texmf-dist/tex/context/patterns/lang-bg.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-bg.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ca.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ca.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ca.rme | 2 +-
Master/texmf-dist/tex/context/patterns/lang-cs.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-cs.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-cy.hyp | 33 +-
Master/texmf-dist/tex/context/patterns/lang-cy.pat | 35 +-
Master/texmf-dist/tex/context/patterns/lang-cy.rme | 64 +
Master/texmf-dist/tex/context/patterns/lang-da.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-da.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-de.hyp | 6 +-
Master/texmf-dist/tex/context/patterns/lang-de.pat | 14392 ++--
Master/texmf-dist/tex/context/patterns/lang-de.rme | 16 +-
.../texmf-dist/tex/context/patterns/lang-deo.hyp | 6 +-
.../texmf-dist/tex/context/patterns/lang-deo.pat | 14238 ++--
.../texmf-dist/tex/context/patterns/lang-deo.rme | 16 +-
Master/texmf-dist/tex/context/patterns/lang-es.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-es.pat | 1238 +-
Master/texmf-dist/tex/context/patterns/lang-es.rme | 96 +-
Master/texmf-dist/tex/context/patterns/lang-et.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-et.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-eu.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-eu.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-fi.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-fi.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-fr.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-fr.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-gb.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-gb.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-hr.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-hr.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-hu.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-hu.pat | 68283 ++++++++++++++++---
Master/texmf-dist/tex/context/patterns/lang-hu.rme | 69 +-
Master/texmf-dist/tex/context/patterns/lang-il.hyp | 8 -
Master/texmf-dist/tex/context/patterns/lang-il.pat | 1905 -
Master/texmf-dist/tex/context/patterns/lang-il.rme | 70 -
Master/texmf-dist/tex/context/patterns/lang-is.hyp | 32 +-
Master/texmf-dist/tex/context/patterns/lang-is.pat | 4219 +-
Master/texmf-dist/tex/context/patterns/lang-is.rme | 79 +
Master/texmf-dist/tex/context/patterns/lang-it.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-it.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-la.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-la.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-lt.hyp | 8 +
Master/texmf-dist/tex/context/patterns/lang-lt.pat | 1553 +
Master/texmf-dist/tex/context/patterns/lang-lt.rme | 47 +
Master/texmf-dist/tex/context/patterns/lang-mn.hyp | 8 +
Master/texmf-dist/tex/context/patterns/lang-mn.pat | 995 +
Master/texmf-dist/tex/context/patterns/lang-mn.rme | 86 +
Master/texmf-dist/tex/context/patterns/lang-nb.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-nb.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-nl.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-nl.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-nn.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-nn.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-no.hyp | 118 -
Master/texmf-dist/tex/context/patterns/lang-no.pat | 26818 --------
Master/texmf-dist/tex/context/patterns/lang-pl.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-pl.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-pt.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-pt.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ro.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ro.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ru.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-ru.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sk.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sk.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sl.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sl.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sr.hyp | 137 +
Master/texmf-dist/tex/context/patterns/lang-sr.pat | 2432 +
Master/texmf-dist/tex/context/patterns/lang-sr.rme | 80 +
Master/texmf-dist/tex/context/patterns/lang-sv.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-sv.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-tk.hyp | 8 +
Master/texmf-dist/tex/context/patterns/lang-tk.pat | 2378 +
Master/texmf-dist/tex/context/patterns/lang-tk.rme | 18 +
Master/texmf-dist/tex/context/patterns/lang-tr.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-tr.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-us.hyp | 2 +-
Master/texmf-dist/tex/context/patterns/lang-us.pat | 2 +-
Master/texmf-dist/tex/context/patterns/lang-zh.hyp | 8 +
Master/texmf-dist/tex/context/patterns/lang-zh.pat | 195 +
Master/texmf-dist/tex/context/patterns/lang-zh.rme | 88 +
Master/texmf-dist/tex/context/sample/demo-cld.cld | 74 -
Master/texmf-dist/tex/context/sample/sample.tex | 68 +-
.../texmf-dist/tex/context/test/chem-str-test.tex | 560 -
.../texmf-dist/tex/context/test/sort-lan-test.tex | 38 -
Master/texmf-dist/tex/context/test/x-cals-test.tex | 48 -
Master/texmf-dist/tex/context/test/x-cals-test.xml | 522 -
Master/texmf-dist/tex/context/test/x-cml-test.tex | 9 -
Master/texmf-dist/tex/context/test/x-cml-test.xml | 210 -
Master/texmf-dist/tex/context/test/x-ct-test.tex | 7 -
Master/texmf-dist/tex/context/test/x-ct-test.xml | 149 -
Master/texmf-dist/tex/context/test/x-mmp-test.tex | 12 -
Master/texmf-dist/tex/context/test/x-mmp-test.xml | 1270 -
835 files changed, 163885 insertions(+), 112686 deletions(-)
create mode 100644 Master/texmf-dist/tex/context/base/back-u3d.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/bibl-tra.lua
create mode 100644 Master/texmf-dist/tex/context/base/bibl-tra.mkii
create mode 100644 Master/texmf-dist/tex/context/base/bibl-tra.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/blob-ini.lua
create mode 100644 Master/texmf-dist/tex/context/base/blob-ini.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/bxml-apa.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/char-tex.lua
delete mode 100644 Master/texmf-dist/tex/context/base/colo-new.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/colo-new.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/colo-new.tex
create mode 100644 Master/texmf-dist/tex/context/base/colo-x11.tex
delete mode 100644 Master/texmf-dist/tex/context/base/cont-cz.tex
delete mode 100644 Master/texmf-dist/tex/context/base/cont-uk.tex
delete mode 100644 Master/texmf-dist/tex/context/base/core-bar.tex
delete mode 100644 Master/texmf-dist/tex/context/base/core-blk.tex
delete mode 100644 Master/texmf-dist/tex/context/base/core-box.tex
delete mode 100644 Master/texmf-dist/tex/context/base/core-grd.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/core-grd.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/core-spa.lua
delete mode 100644 Master/texmf-dist/tex/context/base/core-spa.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/core-spa.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/core-sys.lua
create mode 100644 Master/texmf-dist/tex/context/base/data-sch.lua
create mode 100644 Master/texmf-dist/tex/context/base/enco-l7x.mkii
create mode 100644 Master/texmf-dist/tex/context/base/font-agl.lua
create mode 100644 Master/texmf-dist/tex/context/base/font-enh.lua
create mode 100644 Master/texmf-dist/tex/context/base/font-gds.lua
create mode 100644 Master/texmf-dist/tex/context/base/font-gds.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/grph-fil.lua
create mode 100644 Master/texmf-dist/tex/context/base/grph-swf.lua
create mode 100644 Master/texmf-dist/tex/context/base/l-pdfview.lua
create mode 100644 Master/texmf-dist/tex/context/base/lang-wrd.lua
create mode 100644 Master/texmf-dist/tex/context/base/lang-wrd.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/lpdf-pdx.lua
create mode 100644 Master/texmf-dist/tex/context/base/lpdf-pdx.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/lpdf-swf.lua
create mode 100644 Master/texmf-dist/tex/context/base/lpdf-xmp.lua
create mode 100644 Master/texmf-dist/tex/context/base/lpdf-xmp.xml
create mode 100644 Master/texmf-dist/tex/context/base/lxml-aux.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-ctx.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-ctx.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/lxml-dir.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-inf.lua
delete mode 100644 Master/texmf-dist/tex/context/base/lxml-ini.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-lpt.lua
delete mode 100644 Master/texmf-dist/tex/context/base/lxml-pth.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-sor.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-sor.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/lxml-tex.lua
create mode 100644 Master/texmf-dist/tex/context/base/lxml-xml.lua
create mode 100644 Master/texmf-dist/tex/context/base/m-barcodes.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/m-chart.mkii
create mode 100644 Master/texmf-dist/tex/context/base/m-chart.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/m-directives.tex
create mode 100644 Master/texmf-dist/tex/context/base/m-obsolete.tex
delete mode 100644 Master/texmf-dist/tex/context/base/m-pstric.tex
create mode 100644 Master/texmf-dist/tex/context/base/m-pstricks.lua
create mode 100644 Master/texmf-dist/tex/context/base/m-pstricks.mkii
create mode 100644 Master/texmf-dist/tex/context/base/m-pstricks.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/m-pstricks.tex
create mode 100644 Master/texmf-dist/tex/context/base/m-punk.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/m-steps.mkii
create mode 100644 Master/texmf-dist/tex/context/base/m-steps.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/m-track.tex
create mode 100644 Master/texmf-dist/tex/context/base/m-trackers.tex
create mode 100644 Master/texmf-dist/tex/context/base/math-lan.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/mtx-context-common.tex
create mode 100644 Master/texmf-dist/tex/context/base/mult-clm.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-aux.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-dir.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-mig.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-mig.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/node-pag.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-pag.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/node-rul.lua
create mode 100644 Master/texmf-dist/tex/context/base/node-rul.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/node-typ.lua
create mode 100644 Master/texmf-dist/tex/context/base/page-flt.lua
create mode 100644 Master/texmf-dist/tex/context/base/page-flt.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/page-str.lua
create mode 100644 Master/texmf-dist/tex/context/base/pret-xml.lua
create mode 100644 Master/texmf-dist/tex/context/base/s-fnt-26.tex
create mode 100644 Master/texmf-dist/tex/context/base/s-inf-01.tex
create mode 100644 Master/texmf-dist/tex/context/base/s-inf-02.tex
create mode 100644 Master/texmf-dist/tex/context/base/s-mod.ctx
create mode 100644 Master/texmf-dist/tex/context/base/spac-ali.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-def.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-fnt.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-gen.mkii
create mode 100644 Master/texmf-dist/tex/context/base/spac-grd.mkii
create mode 100644 Master/texmf-dist/tex/context/base/spac-grd.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-hor.lua
create mode 100644 Master/texmf-dist/tex/context/base/spac-hor.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-pag.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-par.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/spac-ver.lua
create mode 100644 Master/texmf-dist/tex/context/base/spac-ver.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/supp-mat.mkii
create mode 100644 Master/texmf-dist/tex/context/base/supp-mat.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/supp-mat.tex
create mode 100644 Master/texmf-dist/tex/context/base/syst-ltx.tex
create mode 100644 Master/texmf-dist/tex/context/base/tabl-com.mkii
create mode 100644 Master/texmf-dist/tex/context/base/tabl-com.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/type-buy.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-buy.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-buy.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-cbg.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/type-cbg.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-cow.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-cow.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-cow.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-def.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-def.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-def.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-exp.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/type-exp.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-fsf.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/type-fsf.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-ghz.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-ghz.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-ghz.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-hgz.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-hgz.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-hgz.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-husayni-default.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/type-lua.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-mac.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-msw.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-msw.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-msw.tex
delete mode 100644 Master/texmf-dist/tex/context/base/type-one.tex
delete mode 100644 Master/texmf-dist/tex/context/base/type-otf.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-pre.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/type-pre.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-set.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-set.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-siz.tex
delete mode 100644 Master/texmf-dist/tex/context/base/type-tmf.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-win.mkii
create mode 100644 Master/texmf-dist/tex/context/base/type-win.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/type-win.tex
create mode 100644 Master/texmf-dist/tex/context/base/type-xtx.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/type-xtx.tex
create mode 100644 Master/texmf-dist/tex/context/base/typo-dig.lua
create mode 100644 Master/texmf-dist/tex/context/base/typo-dig.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/typo-rep.lua
create mode 100644 Master/texmf-dist/tex/context/base/typo-rep.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/x-asciimath.lua
create mode 100644 Master/texmf-dist/tex/context/base/x-asciimath.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/x-cals.lua
create mode 100644 Master/texmf-dist/tex/context/base/x-contml.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/x-contml.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-corres.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/x-corres.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-ct.lua
create mode 100644 Master/texmf-dist/tex/context/base/x-dir-05.mkii
create mode 100644 Master/texmf-dist/tex/context/base/x-dir-05.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/x-fe.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/x-fe.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-fo.mkii
delete mode 100644 Master/texmf-dist/tex/context/base/x-fo.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-foxet.mkii
create mode 100644 Master/texmf-dist/tex/context/base/x-foxet.mkiv
delete mode 100644 Master/texmf-dist/tex/context/base/x-foxet.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-pending.mkiv
create mode 100644 Master/texmf-dist/tex/context/base/x-set-99.tex
create mode 100644 Master/texmf-dist/tex/context/base/x-xtag.mkiv
delete mode 100644 Master/texmf-dist/tex/context/bib/t-bib.mkii
delete mode 100644 Master/texmf-dist/tex/context/bib/t-bib.mkiv
delete mode 100644 Master/texmf-dist/tex/context/bib/t-bib.tex
delete mode 100644 Master/texmf-dist/tex/context/bib/t-bibltx.tex
delete mode 100644 Master/texmf-dist/tex/context/config/cont-cz.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-de.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-en.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-fmt.tex
delete mode 100644 Master/texmf-dist/tex/context/config/cont-fr.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-it.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-nl.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-ro.ini
delete mode 100644 Master/texmf-dist/tex/context/config/cont-uk.ini
create mode 100644 Master/texmf-dist/tex/context/fonts/antykwa-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/charter-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/garamond-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/husayni.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/hvmath-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/informal-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/iwona-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/lm-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/lucida-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/mathtimes-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/px-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/symbol-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/tx-math.lfg
create mode 100644 Master/texmf-dist/tex/context/fonts/utopia-math.lfg
delete mode 100644 Master/texmf-dist/tex/context/interface/t-bib.xml
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-ba.hyp
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-ba.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-cy.rme
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-il.hyp
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-il.pat
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-il.rme
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-is.rme
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lt.hyp
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lt.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-lt.rme
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-mn.hyp
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-mn.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-mn.rme
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-no.hyp
delete mode 100644 Master/texmf-dist/tex/context/patterns/lang-no.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sr.hyp
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sr.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-sr.rme
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-tk.hyp
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-tk.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-tk.rme
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-zh.hyp
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-zh.pat
create mode 100644 Master/texmf-dist/tex/context/patterns/lang-zh.rme
delete mode 100644 Master/texmf-dist/tex/context/sample/demo-cld.cld
delete mode 100644 Master/texmf-dist/tex/context/test/chem-str-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/sort-lan-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/x-cals-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/x-cals-test.xml
delete mode 100644 Master/texmf-dist/tex/context/test/x-cml-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/x-cml-test.xml
delete mode 100644 Master/texmf-dist/tex/context/test/x-ct-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/x-ct-test.xml
delete mode 100644 Master/texmf-dist/tex/context/test/x-mmp-test.tex
delete mode 100644 Master/texmf-dist/tex/context/test/x-mmp-test.xml
(limited to 'Master/texmf-dist/tex/context')
diff --git a/Master/texmf-dist/tex/context/base/anch-bar.mkiv b/Master/texmf-dist/tex/context/base/anch-bar.mkiv
index d08573c0f60..1013e76096f 100644
--- a/Master/texmf-dist/tex/context/base/anch-bar.mkiv
+++ b/Master/texmf-dist/tex/context/base/anch-bar.mkiv
@@ -56,7 +56,7 @@
\newcount\currentsidebar
\newdimen\sidebardistance
-\def\setupsidebars
+\unexpanded\def\setupsidebars
{\dodoubleargument\dosetupsidebars}
\def\dosetupsidebars[#1][#2]%
@@ -77,7 +77,7 @@
\c!rulecolor=red,
\c!distance=.5\bodyfontsize]
-\def\definesidebar
+\unexpanded\def\definesidebar
{\dodoubleempty\dodefinesidebar}
\def\dodefinesidebar[#1][#2]%
@@ -87,7 +87,7 @@
\getparameters
[\??br#1][#2]}
-\def\startsidebar
+\unexpanded\def\startsidebar
{\dosingleempty\dostartsidebar}
\def\dostartsidebar[#1]%
@@ -115,34 +115,19 @@
% \def\dostopsidebar#1%
% {\removelastspace\tpos{side:#1}\carryoverpar\egroup}
-\def\stopsidebar
+\unexpanded\def\stopsidebar
{\removelastspace\tpos{side:\the\currentsidebar}\carryoverpar\egroup}
\startMPpositionmethod{mpos:bar}
- \startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}%
- StartPage ;
- path p ; p :=
- if \MPp\MPbself=\MPp\MPeself :
- (xpart ulcorner Field[Text][Text],\MPy\MPbself+\MPh\MPbself) --
- (xpart llcorner Field[Text][Text],\MPy\MPeself-\MPd\MPeself) ;
- elseif RealPageNumber=\MPp\MPbself :
- (xpart ulcorner Field[Text][Text],\MPy\MPbself+\MPh\MPbself) --
- (llcorner Field[Text][Text]) ;
- elseif RealPageNumber=\MPp\MPeself :
- (ulcorner Field[Text][Text]) --
- (xpart llcorner Field[Text][Text],\MPy\MPeself-\MPd\MPeself) ;
- else :
- (ulcorner Field[Text][Text]) --
- (llcorner Field[Text][Text]) ;
- fi ;
- p := p shifted (-llcorner Field[Text][Text]-(\MPvar{distance},0)) ;
- interim linecap := butt ;
- draw p
- withpen pencircle scaled \MPvar{linewidth}
- withcolor \MPvar{linecolor} ;
- StopPage ;
- \stopMPpositiongraphic
- \MPpositiongraphic{mpos:bar}{}%
+ \startMPpositiongraphic{mpos:bar}{linecolor,linewidth,distance}%
+ position_anchor_bar (
+ \MPp\MPbself, \MPp\MPeself,
+ \MPy\MPbself, \MPy\MPeself,
+ \MPh\MPbself, \MPd\MPeself,
+ \MPvar{distance}, \MPvar{linewidth}, \MPvar{linecolor}
+ ) ;
+ \stopMPpositiongraphic
+ \MPpositiongraphic{mpos:bar}{}%
\stopMPpositionmethod
%D We now reimplement the margin rules handler defined in
diff --git a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv
index c558bb04fa8..248b9ca5e31 100644
--- a/Master/texmf-dist/tex/context/base/anch-pgr.mkiv
+++ b/Master/texmf-dist/tex/context/base/anch-pgr.mkiv
@@ -76,7 +76,7 @@
\fi
\fi\fi}
-\def\placepositionanchors % todo : depth pagebox
+\unexpanded\def\placepositionanchors % todo : depth pagebox
{\ifpositioning
\setbox\scratchbox\vbox to \textheight
{\simpletopskipcorrection
@@ -145,7 +145,7 @@
% obsolete and wrong anyway
%
-% \long\def\defineMPpositiongraphic#1%
+% \long\unexpanded\def\defineMPpositiongraphic#1%
% {\long\setvalue{\MPoverlayposprefix#1}}
%D The rest of the definitions concerning such overlays may
@@ -180,14 +180,14 @@
\vfill}%
\fi}
-\def\startpositionoverlay#1%
+\unexpanded\def\startpositionoverlay#1%
{\iftrialtypesetting % we don't want redundant entries in the list
\@EA\gobbleuntil\@EA\stoppositionoverlay
\else
\def\currentpositionoverlay{#1}%
\fi}
-\def\stoppositionoverlay
+\unexpanded\def\stoppositionoverlay
{\let\currentpositionoverlay\empty}
\def\resetpositionoverlay#1%
@@ -741,15 +741,15 @@
lineradius=\textbackgroundparameter\c!radius}}%
\stoppositionoverlay}
-\def\stoptextbackground
+\unexpanded\def\stoptextbackground
{\dodostoptextbackground
\carryoverpar\egroup}
-\def\starttextbackgroundmanual
+\unexpanded\def\starttextbackgroundmanual
{\dostartattributes{\??td\currenttextbackground}\c!style\c!color\empty
\fpos\currentparbackground\ignorespaces}
-\def\stoptextbackgroundmanual
+\unexpanded\def\stoptextbackgroundmanual
{\tpos\currentparbackground
\dostopattributes}
@@ -797,7 +797,7 @@
%
\dostartattributes{\??td\currenttextbackground}\c!style\c!color\empty
\nowhitespace
-\nobreak % new per 23/04/2006 (else potential break when whitespace)
+ \nobreak % new per 23/04/2006 (else potential break when whitespace)
\seteffectivehsize
\doinhibitblank % \blank[\v!disable]% new
\par}
@@ -816,7 +816,7 @@
\nobreak \vskip-\lineheight \nobreak
\nowhitespace
\egroup
-\bgroup \forgeteverypar % NOT REALLY NEEDED, SAVES HASH/MEM
+ \bgroup \forgeteverypar % NOT REALLY NEEDED, SAVES HASH/MEM
\nobreak \noindent \strut \hfill \kern\zeropoint
\doassignsomeskip\textbackgroundparameter\c!bottomoffset\to\textbackgroundskip
\ifgridsnapping % experimental, pascal (todo: topoffset in same way)
@@ -828,7 +828,7 @@
\else
\tpos\currentparbackground
\fi
-\egroup
+ \egroup
\endgraf % new
\textbackgroundparameter\c!after}
@@ -900,12 +900,13 @@
\else
\MPy#1-\MPy#2-\MPy\textanchor+\MPy\textanchor+\MPh\textanchor
\fi
- \fi}%
+ \fi
+ \relax}%
\edef\textparwidth
{\the\dimexpr
\ifcase\scratchcounter
% one page
- \dimexpr\MPx#2-\MPx#1%
+ \MPx#2-\MPx#1%
\else
% two or more pages / maybe also hang
\ifx#3\relax
@@ -913,7 +914,8 @@
\else
\MPw\MPparanchor-\MPl\MPparanchor-\MPr\MPparanchor
\fi
- \fi}}
+ \fi
+ \relax}}
\def\mintextparheight{4\lineheight}
@@ -935,7 +937,7 @@
\fi
\fi}
-\def\definetextbackground
+\unexpanded\def\definetextbackground
{\dodoubleempty\dodefinetextbackground}
\def\dodefinetextbackground[#1][#2]% parent and ..parameter
@@ -948,13 +950,13 @@
\c!leftoffset,\c!rightoffset,\c!topoffset,\c!bottomoffset]%
\getparameters[\??td#1][#2]%
\doifvalue{\??td#1\c!state}\v!start\checktextbackgrounds
- \unexpanded\setvalue{#1}%
+ \setuvalue{#1}%
{\groupedcommand{\starttextbackground[#1]}{\stoptextbackground}}%
\setvalue{\e!start#1}{\starttextbackground[#1]}%
\setvalue{\e!stop #1}{\stoptextbackground}%
\fi}
-\def\setuptextbackground
+\unexpanded\def\setuptextbackground
{\dodoubleargument\dosetuptextbackground}
\def\dosetuptextbackground[#1][#2]%
@@ -1029,6 +1031,8 @@
linecolor=blue,
linewidth=1pt]
+% these might become macros in mp-page
+
\startuseMPgraphic{mpos:common:ec}
path pa ; pair ca ; color lc ; numeric lw ;
lw := \MPvar{linewidth} ;
@@ -1632,7 +1636,7 @@
\copyposition{e:#1}{e:#2}%
\dosetpositionaction{b:#2}{\dopositionaction{b:#1}}}
-\def\definepositionframed
+\unexpanded\def\definepositionframed
{\dodoubleargument\dodefinepositionframed}
\def\dodefinepositionframed[#1][#2]%
diff --git a/Master/texmf-dist/tex/context/base/anch-pos.lua b/Master/texmf-dist/tex/context/base/anch-pos.lua
index b16fac05c9c..8066af4ceba 100644
--- a/Master/texmf-dist/tex/context/base/anch-pos.lua
+++ b/Master/texmf-dist/tex/context/base/anch-pos.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['anch-pos'] = {
version = 1.001,
- comment = "companion to anch-pos.tex",
+ comment = "companion to anch-pos.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -12,7 +12,9 @@ can we store much more information in but it's also
more efficient.
--ldx]]--
-local texprint, concat, format = tex.print, table.concat, string.format
+local concat, format = table.concat, string.format
+local texprint, ctxcatcodes = tex.print, tex.ctxcatcodes
+local lpegmatch = lpeg.match
jobpositions = jobpositions or { }
jobpositions.collected = jobpositions.collected or { }
@@ -50,90 +52,115 @@ function jobpositions.doifelse(name)
commands.testcase(jobpositions.collected[name] or ptbs[name])
end
-function jobpositions.MPp(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[1]) or '0' ) end
-function jobpositions.MPx(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[2]) or '0pt') end
-function jobpositions.MPy(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[3]) or '0pt') end
-function jobpositions.MPw(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[4]) or '0pt') end
-function jobpositions.MPh(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[5]) or '0pt') end
-function jobpositions.MPd(id) local jpi = pcol[id] or ptbs[id] texprint((jpi and jpi[6]) or '0pt') end
-
-
- function jobpositions.MPx(id)
- local jpi = pcol[id] or ptbs[id]
- local x = jpi and jpi[2]
- if x then
- texprint(format('\\the\\dimexpr %s-%s\\relax',x,dx))
- else
- texprint('0pt')
- end
+function jobpositions.MPp(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[1]) or '0' ) end
+function jobpositions.MPx(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[2]) or '0pt') end
+function jobpositions.MPy(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[3]) or '0pt') end
+function jobpositions.MPw(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[4]) or '0pt') end
+function jobpositions.MPh(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[5]) or '0pt') end
+function jobpositions.MPd(id) local jpi = pcol[id] or ptbs[id] texprint(ctxcatcodes,(jpi and jpi[6]) or '0pt') end
+
+
+function jobpositions.MPx(id)
+ local jpi = pcol[id] or ptbs[id]
+ local x = jpi and jpi[2]
+ if x then
+ texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',x,dx)) -- no space after dimexpr !
+ else
+ texprint(ctxcatcodes,'0pt')
end
- function jobpositions.MPy(id)
- local jpi = pcol[id] or ptbs[id]
- local y = jpi and jpi[3]
- if y then
- texprint(format('\\the\\dimexpr %s-%s\\relax',y,dy))
- else
- texprint('0pt')
- end
+end
+
+function jobpositions.MPy(id)
+ local jpi = pcol[id] or ptbs[id]
+ local y = jpi and jpi[3]
+ if y then
+ texprint(ctxcatcodes,format('\\the\\dimexpr%s-%s\\relax',y,dy)) -- no space after dimexpr !
+ else
+ texprint(ctxcatcodes,'0pt')
end
+end
-- the following are only for MP so there we can leave out the pt
--- can be writes
+-- can be writes and no format needed any more
function jobpositions.MPxy(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(format('(%s-%s,%s-%s)',jpi[2],dx,jpi[3],dy))
+ texprint(ctxcatcodes,format('(%s-%s,%s-%s)',jpi[2],dx,jpi[3],dy))
+--~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'-',dy,')')
else
- texprint('(0,0)')
+ texprint(ctxcatcodes,'(0,0)')
end
end
+
function jobpositions.MPll(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(format('(%s-%s,%s-%s-%s)',jpi[2],dx,jpi[3],jpi[6],dy))
+ texprint(ctxcatcodes,format('(%s-%s,%s-%s-%s)',jpi[2],dx,jpi[3],jpi[6],dy))
+--~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'-',jpi[6],'-',dy,')')
else
- texprint('(0,0)')
+ texprint(ctxcatcodes,'(0,0)')
end
end
+
function jobpositions.MPlr(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(format('(%s+%s-%s,%s-%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[6],dy))
+ texprint(ctxcatcodes,format('(%s+%s-%s,%s-%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[6],dy))
+--~ texprint(ctxcatcodes,'(',jpi[2],'+',jpi[4],'-',dx,',',jpi[3],'-',jpi[6],'-',dy,')')
else
- texprint('(0,0)')
+ texprint(ctxcatcodes,'(0,0)')
end
end
+
function jobpositions.MPur(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(format('(%s+%s-%s,%s+%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[5],dy))
+ texprint(ctxcatcodes,format('(%s+%s-%s,%s+%s-%s)',jpi[2],jpi[4],dx,jpi[3],jpi[5],dy))
+--~ texprint(ctxcatcodes,'(',jpi[2],'+',jpi[4],'-',dx,',',jpi[3],'+',jpi[5],'-',dy,')')
else
- texprint('(0,0)')
+ texprint(ctxcatcodes,'(0,0)')
end
end
+
function jobpositions.MPul(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(format('(%s-%s,%s+%s-%s)',jpi[2],dx,jpi[3],jpi[5],dy))
+ texprint(ctxcatcodes,format('(%s-%s,%s+%s-%s)',jpi[2],dx,jpi[3],jpi[5],dy))
+--~ texprint(ctxcatcodes,'(',jpi[2],'-',dx,',',jpi[3],'+',jpi[5],'-',dy,')')
else
- texprint('(0,0)')
+ texprint(ctxcatcodes,'(0,0)')
end
end
+
function jobpositions.MPpos(id)
local jpi = pcol[id] or ptbs[id]
if jpi then
- texprint(concat(jpi,',',1,6))
+ texprint(ctxcatcodes,concat(jpi,',',1,6))
else
- texprint('0,0,0,0,0,0')
+ texprint(ctxcatcodes,'0,0,0,0,0,0')
end
end
+
+local splitter = lpeg.Ct(lpeg.splitat(","))
+
function jobpositions.MPplus(id,n,default)
local jpi = pcol[id] or ptbs[id]
- texprint((jpi and jpi[6+n]) or default)
+ if not jpi then
+ texprint(ctxcatcodes,default)
+ else
+ local split = jpi[0]
+ if not split then
+ split = lpegmatch(splitter,jpi[7])
+ jpi[0] = split
+ end
+ texprint(ctxcatcodes,split[n] or default)
+ end
end
+
function jobpositions.MPrest(id,default)
local jpi = pcol[id] or ptbs[id]
- texprint((jpi and jpi[7] and concat(jpi,",",7,#jpi)) or default)
+ -- texprint(ctxcatcodes,(jpi and jpi[7] and concat(jpi,",",7,#jpi)) or default)
+ texprint(ctxcatcodes,(jpi and jpi[7]) or default)
end
diff --git a/Master/texmf-dist/tex/context/base/anch-pos.mkiv b/Master/texmf-dist/tex/context/base/anch-pos.mkiv
index 0ddda9af40f..e454747daf2 100644
--- a/Master/texmf-dist/tex/context/base/anch-pos.mkiv
+++ b/Master/texmf-dist/tex/context/base/anch-pos.mkiv
@@ -205,18 +205,18 @@
% \the\dimexpr\noexpand\lastsavedpositionx\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax
% \the\dimexpr\noexpand\lastsavedpositiony\ifnum\positionanchormode=\plusone-\MPx\pageanchor\fi\relax
-\def\MPp #1{\ctxlua{jobpositions.MPp("#1")}}
-\def\MPx #1{\ctxlua{jobpositions.MPx("#1")}}
-\def\MPy #1{\ctxlua{jobpositions.MPy("#1")}}
-\def\MPw #1{\ctxlua{jobpositions.MPw("#1")}}
-\def\MPh #1{\ctxlua{jobpositions.MPh("#1")}}
-\def\MPd #1{\ctxlua{jobpositions.MPd("#1")}}
-\def\MPxy #1{\ctxlua{jobpositions.MPxy("#1")}}
-\def\MPll #1{\ctxlua{jobpositions.MPll("#1")}}
-\def\MPlr #1{\ctxlua{jobpositions.MPlr("#1")}}
-\def\MPur #1{\ctxlua{jobpositions.MPur("#1")}}
-\def\MPul #1{\ctxlua{jobpositions.MPul("#1")}}
-\def\MPpos #1{\ctxlua{jobpositions.MPpos("#1")}}
+\def\MPp #1{\ctxlua{jobpositions.MPp("#1")}}
+\def\MPx #1{\ctxlua{jobpositions.MPx("#1")}}
+\def\MPy #1{\ctxlua{jobpositions.MPy("#1")}}
+\def\MPw #1{\ctxlua{jobpositions.MPw("#1")}}
+\def\MPh #1{\ctxlua{jobpositions.MPh("#1")}}
+\def\MPd #1{\ctxlua{jobpositions.MPd("#1")}}
+\def\MPxy #1{\ctxlua{jobpositions.MPxy("#1")}}
+\def\MPll #1{\ctxlua{jobpositions.MPll("#1")}}
+\def\MPlr #1{\ctxlua{jobpositions.MPlr("#1")}}
+\def\MPur #1{\ctxlua{jobpositions.MPur("#1")}}
+\def\MPul #1{\ctxlua{jobpositions.MPul("#1")}}
+\def\MPpos#1{\ctxlua{jobpositions.MPpos("#1")}}
%D \macros
%D {MPplus, MPrest, MPv, MPvv}
diff --git a/Master/texmf-dist/tex/context/base/anch-snc.mkiv b/Master/texmf-dist/tex/context/base/anch-snc.mkiv
index 1f361011102..f976047c9b9 100644
--- a/Master/texmf-dist/tex/context/base/anch-snc.mkiv
+++ b/Master/texmf-dist/tex/context/base/anch-snc.mkiv
@@ -22,7 +22,7 @@
\ifx\s!preset \undefined \def\s!preset {preset} \fi
\ifx\s!syncpos\undefined \def\s!syncpos{syncpos} \fi
-\def\definesyncpositions[#1]%
+\unexpanded\def\definesyncpositions[#1]%
{\global\let\flushsyncpositions\doflushsyncpositions % only when used
\setcounter{\s!num:\s!syncpos:#1}{0}%
\doglobal\appendtoksonce\csname\s!reset :\s!syncpos:#1\endcsname\to\resetsyncpositions
diff --git a/Master/texmf-dist/tex/context/base/attr-ini.lua b/Master/texmf-dist/tex/context/base/attr-ini.lua
index 535488c35b1..81c2f4744ca 100644
--- a/Master/texmf-dist/tex/context/base/attr-ini.lua
+++ b/Master/texmf-dist/tex/context/base/attr-ini.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['attr-ini'] = {
version = 1.001,
- comment = "companion to attr-ini.tex",
+ comment = "companion to attr-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -15,8 +15,10 @@ local concat = table.concat
local texsprint = tex.sprint
local ctxcatcodes = tex.ctxcatcodes
+local unsetvalue = attributes.unsetvalue
--- todo: document this
+-- todo: document this but first reimplement this as it reflects the early
+-- days of luatex / mkiv and we have better ways now
-- nb: attributes: color etc is much slower than normal (marks + literals) but ...
-- nb. too many "0 g"s
@@ -60,7 +62,6 @@ colors.data = colors.data or { }
colors.values = colors.values or { }
colors.registered = colors.registered or { }
-colors.enabled = true
colors.weightgray = true
colors.attribute = attributes.private('color')
colors.selector = attributes.private('colormodel')
@@ -79,10 +80,13 @@ local templates = {
}
local models = {
- all = 1,
- gray = 2,
- rgb = 3,
- cmyk = 4,
+ [interfaces.variables.none] = unsetvalue,
+ black = unsetvalue,
+ bw = unsetvalue,
+ all = 1,
+ gray = 2,
+ rgb = 3,
+ cmyk = 4,
}
colors.model = "all"
@@ -94,8 +98,7 @@ local registered = colors.registered
local numbers = attributes.numbers
local list = attributes.list
-local min = math.min
-local max = math.max
+local min, max, floor = math.min, math.max, math.floor
local nodeinjections = backends.nodeinjections
local codeinjections = backends.codeinjections
@@ -121,10 +124,77 @@ local function cmyktogray(c,m,y,k)
return rgbtogray(cmyktorgb(c,m,y,k))
end
+-- http://en.wikipedia.org/wiki/HSI_color_space
+-- http://nl.wikipedia.org/wiki/HSV_(kleurruimte)
+
+
+local function hsvtorgb(h,s,v)
+ -- h = h % 360
+ local hd = h/60
+ local hf = floor(hd)
+ local hi = hf % 6
+ -- local f = hd - hi
+ local f = hd - hf
+ local p = v * (1 - s)
+ local q = v * (1 - f * s)
+ local t = v * (1 - (1 - f) * s)
+ if hi == 0 then
+ return v, t, p
+ elseif hi == 1 then
+ return q, v, p
+ elseif hi == 2 then
+ return p, v, t
+ elseif hi == 3 then
+ return p, q, v
+ elseif hi == 4 then
+ return t, p, v
+ elseif hi == 5 then
+ return v, p, q
+ else
+ print("error in hsv -> rgb",hi,h,s,v)
+ end
+end
+
+function rgbtohsv(r,g,b)
+ local offset, maximum, other_1, other_2
+ if r >= g and r >= b then
+ offset, maximum, other_1, other_2 = 0, r, g, b
+ elseif g >= r and g >= b then
+ offset, maximum, other_1, other_2 = 2, g, b, r
+ else
+ offset, maximum, other_1, other_2 = 4, b, r, g
+ end
+ if maximum == 0 then
+ return 0, 0, 0
+ end
+ local minimum = other_1 < other_2 and other_1 or other_2
+ if maximum == minimum then
+ return 0, 0, maximum
+ end
+ local delta = maximum - minimum
+ return (offset + (other_1-other_2)/delta)*60, delta/maximum, maximum
+end
+
+function graytorgb(s) -- unweighted
+ return 1-s, 1-s, 1-s
+end
+
+function hsvtogray(h,s,v)
+ return rgb_to_gray(hsv_to_rgb(h,s,v))
+end
+
+function grayto_hsv(s)
+ return 0, 0, s
+end
+
colors.rgbtocmyk = rgbtocmyk
colors.rgbtogray = rgbtogray
colors.cmyktorgb = cmyktorgb
colors.cmyktogray = cmyktogray
+colors.rgbtohsv = rgbtohsv
+colors.hsvtorgb = hsvtorgb
+colors.hsvtogray = hsvtogray
+colors.graytohsv = graytohsv
-- we can share some *data by using s, rgb and cmyk hashes, but
-- normally the amount of colors is not that large; storing the
@@ -192,16 +262,20 @@ local function reviver(data,n)
d = { gray, gray, gray, gray }
logs.report("attributes","unable to revive color %s",n or "?")
else
- local kind, gray, rgb, cmyk = v[1], graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9])
+ local kind = v[1]
if kind == 2 then
+ local gray= graycolor(v[2])
d = { gray, gray, gray, gray }
elseif kind == 3 then
+ local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9])
d = { rgb, gray, rgb, cmyk }
elseif kind == 4 then
+ local gray, rgb, cmyk = graycolor(v[2]), rgbcolor(v[3],v[4],v[5]), cmykcolor(v[6],v[7],v[8],v[9])
d = { cmyk, gray, rgb, cmyk }
elseif kind == 5 then
local spot = spotcolor(v[10],v[11],v[12],v[13])
- d = { spot, gray, rgb, cmyk }
+ -- d = { spot, gray, rgb, cmyk }
+ d = { spot, spot, spot, spot }
end
end
data[n] = d
@@ -226,7 +300,7 @@ function colors.register(name, colorspace, ...) -- passing 9 vars is faster (but
local stamp = format(templates[colorspace],...)
local color = registered[stamp]
if not color then
- color = #values+1
+ color = #values + 1
values[color] = colors[colorspace](...)
registered[stamp] = color
-- colors.reviver(color)
@@ -250,13 +324,16 @@ shipouts.handle_color = nodes.install_attribute_handler {
resolver = function() return colors.main end,
}
+function colors.enable()
+ tasks.enableaction("shipouts","shipouts.handle_color")
+end
+
-- transparencies
transparencies = transparencies or { }
transparencies.registered = transparencies.registered or { }
transparencies.data = transparencies.data or { }
transparencies.values = transparencies.values or { }
-transparencies.enabled = false
transparencies.triggering = true
transparencies.attribute = attributes.private('transparency')
@@ -336,24 +413,27 @@ shipouts.handle_transparency = nodes.install_attribute_handler {
processor = states.process,
}
---- overprint / knockout
+function transparencies.enable()
+ tasks.enableaction("shipouts","shipouts.handle_transparency")
+end
+
+--- colorintents: overprint / knockout
-overprints = overprints or { }
-overprints.data = overprints.data or { }
-overprints.enabled = false
-overprints.attribute = attributes.private('overprint')
+colorintents = colorintents or { }
+colorintents.data = colorintents.data or { }
+colorintents.attribute = attributes.private('colorintent')
-overprints.registered = {
+colorintents.registered = {
overprint = 1,
knockout = 2,
}
-local data, registered = overprints.data, overprints.registered
+local data, registered = colorintents.data, colorintents.registered
-local function extender(overprints,key)
+local function extender(colorintents,key)
if key == "none" then
local d = data[2]
- overprints.none = d
+ colorintents.none = d
return d
end
end
@@ -370,26 +450,29 @@ local function reviver(data,n)
end
end
-setmetatable(overprints, { __index = extender })
-setmetatable(overprints.data, { __index = reviver })
+setmetatable(colorintents, { __index = extender })
+setmetatable(colorintents.data, { __index = reviver })
-function overprints.register(stamp)
+function colorintents.register(stamp)
return registered[stamp] or registered.overprint
end
-shipouts.handle_overprint = nodes.install_attribute_handler {
- name = "overprint",
- namespace = overprints,
+shipouts.handle_colorintent = nodes.install_attribute_handler {
+ name = "colorintent",
+ namespace = colorintents,
initializer = states.initialize,
finalizer = states.finalize,
processor = states.process,
}
+function colorintents.enable()
+ tasks.enableaction("shipouts","shipouts.handle_colorintent")
+end
+
--- negative / positive
negatives = negatives or { }
negatives.data = negatives.data or { }
-negatives.enabled = false
negatives.attribute = attributes.private("negative")
negatives.registered = {
@@ -434,13 +517,16 @@ shipouts.handle_negative = nodes.install_attribute_handler {
processor = states.process,
}
+function negatives.enable()
+ tasks.enableaction("shipouts","shipouts.handle_negative")
+end
+
-- effects -- can be optimized (todo: metatables)
effects = effects or { }
effects.data = effects.data or { }
effects.values = effects.values or { }
effects.registered = effects.registered or { }
-effects.enabled = false
effects.stamp = "%s:%s:%s"
effects.attribute = attributes.private("effect")
@@ -463,7 +549,7 @@ end
local function reviver(data,n)
local e = values[n] -- we could nil values[n] now but hardly needed
- local d = effect(v[1],v[2],v[3])
+ local d = effect(e[1],e[2],e[3])
data[n] = d
return d
end
@@ -490,6 +576,10 @@ shipouts.handle_effect = nodes.install_attribute_handler {
processor = states.process,
}
+function effects.enable()
+ tasks.enableaction("shipouts","shipouts.handle_effect")
+end
+
-- layers (ugly code, due to no grouping and such); currently we use exclusive layers
-- but when we need it stacked layers might show up too; the next function based
-- approach can be replaced by static (metatable driven) resolvers
@@ -499,7 +589,6 @@ viewerlayers.data = viewerlayers.data or { }
viewerlayers.registered = viewerlayers.registered or { }
viewerlayers.values = viewerlayers.values or { }
viewerlayers.listwise = viewerlayers.listwise or { }
-viewerlayers.enabled = false
viewerlayers.attribute = attributes.private("viewerlayer")
storage.register("viewerlayers/registered", viewerlayers.registered, "viewerlayers.registered")
@@ -553,3 +642,7 @@ shipouts.handle_viewerlayer = nodes.install_attribute_handler {
finalizer = states.finalize,
processor = states.stacked,
}
+
+function viewerlayers.enable()
+ tasks.enableaction("shipouts","shipouts.handle_viewerlayer")
+end
diff --git a/Master/texmf-dist/tex/context/base/attr-ini.mkiv b/Master/texmf-dist/tex/context/base/attr-ini.mkiv
index b90d4976b00..87d06c48a44 100644
--- a/Master/texmf-dist/tex/context/base/attr-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/attr-ini.mkiv
@@ -20,6 +20,21 @@
\registerctxluafile{attr-ini}{1.001}
+%D This might move:
+
+\def\pushattribute#1%
+ {\global\advance\csname\??ae:\string#1\endcsname\plusone
+ \global\expandafter\mathchardef\csname\??ae:\string#1:\number\csname\??ae:\string#1\endcsname\endcsname\attribute#1}
+
+\def\popattribute#1%
+ {\attribute#1\csname\??ae:\string#1:\number\csname\??ae:\string#1\endcsname\endcsname
+ \global\advance\csname\??ae:\string#1\endcsname\minusone}
+
+\def\installattributestack#1%
+ {\expandafter\newcount\csname\??ae:\string#1\endcsname}
+
+%D For the moment we put this here (later it will move to where it's used):
+
\definesystemattribute[state]
\definesystemattribute[skip]
\definesystemattribute[penalty]
@@ -27,14 +42,16 @@
\definesystemattribute[color] \chardef\colorattribute \dogetattributeid{color}
\definesystemattribute[transparency] \chardef\transparencyattribute \dogetattributeid{transparency}
\definesystemattribute[background] \chardef\backgroundattribute \dogetattributeid{background}
-\definesystemattribute[overprint]
-\definesystemattribute[negative]
-\definesystemattribute[effect]
+\definesystemattribute[colorintent] \chardef\colorintentattribute \dogetattributeid{colorintent}
+\definesystemattribute[negative] \chardef\negativeattribute \dogetattributeid{negative}
+\definesystemattribute[effect] \chardef\effectattribute \dogetattributeid{effect}
\definesystemattribute[viewerlayer] \chardef\viewerlayerattribute \dogetattributeid{viewerlayer}
\definesystemattribute[layoutcomponent] \chardef\layoutcomponentattribute\dogetattributeid{layoutcomponent}
\definesystemattribute[reference] \chardef\referenceattribute \dogetattributeid{reference}
\definesystemattribute[destination] \chardef\destinationattribute \dogetattributeid{destination}
\definesystemattribute[graphicvadjust] \chardef\graphicvadjustattribute \dogetattributeid{graphicvadjust}
+\definesystemattribute[ruled] \chardef\ruledattribute \dogetattributeid{ruled}
+\definesystemattribute[shifted] \chardef\shiftedattribute \dogetattributeid{shifted}
% \definesystemattribute[ignore]
%
@@ -53,14 +70,14 @@
\newcount\currentcolormodel
-\def\setcolormodel#1%
+\def\dosetcolormodel#1%
{\currentcolormodel\ctxlua{tex.print(colors.setmodel('#1'))}%
- \dosetattribute{colormodel}{\the\currentcolormodel}}
+ \attribute\colormodelattribute\currentcolormodel}
-\setcolormodel{all}
+\dosetcolormodel{all}
\appendtoks
- \setcolormodel{all}% redundant?
+ \dosetcolormodel{all}% redundant?
\to \everyjob
\def\registerrgbcolor #1#2#3#4{\ctxlua{colors.register('#1','rgb' ,#2,#3,#4)}}
@@ -70,12 +87,12 @@
% transparency
\def\registertransparency#1#2#3%
- {\setevalue{(ts:#1)}{\dosetattribute{transparency}{\ctxlua{tex.print(transparencies.register(#2,#3))}}}}
+ {\setevalue{(ts:#1)}{\attribute\transparencyattribute\ctxlua{tex.write(transparencies.register(#2,#3))} }}
\def\sometransparencyswitch#1{\csname(ts:#1)\endcsname}
\def\sometransparencyswitch
- {\ctxlua{transparencies.enabled=true}%
+ {\ctxlua{transparencies.enable()}%
\gdef\sometransparencyswitch##1{\csname(ts:##1)\endcsname}%
\sometransparencyswitch}
@@ -84,24 +101,28 @@
% overprint
-\def\registeroverprint#1#2%
- {\setevalue{(os:#1)}{\dosetattribute{overprint}{\ctxlua{tex.print(overprints.register('#2'))}}}}
+\def\registercolorintent#1#2%
+ {\setevalue{(os:#1)}{\attribute\colorintentattribute\ctxlua{tex.write(colorintents.register('#2'))} }}
-\def\dotriggeroverprint
- {\ctxlua{overprints.enabled=true}%
- \gdef\dotriggeroverprint##1{\csname(os:##1)\endcsname}%
- \dotriggeroverprint}
+\def\dotriggercolorintent
+ {\ctxlua{colorintents.enable()}%
+ \gdef\dotriggercolorintent##1{\csname(os:##1)\endcsname}%
+ \dotriggercolorintent}
-\registeroverprint{knockout} {knockout}
-\registeroverprint{overprint}{overprint}
+\registercolorintent{knockout} {knockout}
+\registercolorintent{overprint}{overprint}
+
+\installattributestack\colorintentattribute
+
+\setevalue{(os:#\v!none}{\attribute\colorintentattribute\attributeunsetvalue} % does this work out ok?
% negative
\def\registernegative#1#2%
- {\setevalue{(ns:#1)}{\dosetattribute{negative}{\ctxlua{tex.print(negatives.register('#2'))}}}}
+ {\setevalue{(ns:#1)}{\attribute\negativeattribute\ctxlua{tex.write(negatives.register('#2'))} }}
\def\dotriggernegative
- {\ctxlua{negatives.enabled=true}%
+ {\ctxlua{negatives.enable()}%
\gdef\dotriggernegative##1{\csname(ns:##1)\endcsname}%
\dotriggernegative}
@@ -112,10 +133,10 @@
\def\registereffect#1#2#3% #2=stretch #3=rulethickness
{\setxvalue{(es:#1:#2:\number\dimexpr#3\relax)}%
- {\dosetattribute{effect}{\ctxlua{tex.print(effects.register('#1',#2,\number\dimexpr#3\relax))}}}}
+ {\attribute\effectattribute\ctxlua{tex.write(effects.register('#1',#2,\number\dimexpr#3\relax))} }}
\def\dotriggereffect
- {\ctxlua{effects.enabled=true}%
+ {\ctxlua{effects.enable()}%
\gdef\dotriggereffect##1##2##3%
{\ifcsname(es:##1:##2:\number\dimexpr##3\relax)\endcsname\else\registereffect{##1}{##2}{##3}\fi
\csname(es:##1:##2:\number\dimexpr##3\relax)\endcsname}%
@@ -129,20 +150,15 @@
% viewerlayers (will probably change a bit)
-% \def\registerviewerlayer#1#2% global !
-% {\setxvalue{(vl:#1)}{\dosetattribute{viewerlayer}{\ctxlua{tex.print(viewerlayers.register('#2'))}}}}
-%
-% \setevalue{(vl:)}{\doresetattribute{viewerlayer}}
-%
% needs to work over stopitemize grouping etc
\def\registerviewerlayer#1#2% global !
- {\setxvalue{(vl:#1)}{\global\dosetattribute{viewerlayer}{\ctxlua{tex.print(viewerlayers.register('#2'))}}}}
+ {\setxvalue{(vl:#1)}{\global\attribute\viewerlayerattribute\ctxlua{tex.write(viewerlayers.register('#2'))} }}
-\setevalue{(vl:)}{\global\doresetattribute{viewerlayer}}
+\setevalue{(vl:)}{\global\attribute\viewerlayerattribute\attributeunsetvalue}
\def\dotriggerviewerlayer
- {\ctxlua{viewerlayers.enabled=true}%
+ {\ctxlua{viewerlayers.enable()}%
\gdef\dotriggerviewerlayer##1{\csname(vl:##1)\endcsname}%
\dotriggerviewerlayer}
diff --git a/Master/texmf-dist/tex/context/base/back-ini.lua b/Master/texmf-dist/tex/context/base/back-ini.lua
index bad6b0282d5..12a487dd4dc 100644
--- a/Master/texmf-dist/tex/context/base/back-ini.lua
+++ b/Master/texmf-dist/tex/context/base/back-ini.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['back-ini'] = {
version = 1.001,
- comment = "companion to back-ini.tex",
+ comment = "companion to back-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -46,6 +46,7 @@ backends.codeinjections = {
registeredsymbol = nothing,
registercomment = nothing,
+ embedfile = nothing,
attachfile = nothing,
adddocumentinfo = nothing,
setupidentity = nothing,
@@ -55,7 +56,6 @@ backends.codeinjections = {
addtransparencygroup = nothing,
typesetfield = nothing,
- finishfields = nothing,
doiffieldelse = nothing,
doiffieldgroupelse = nothing,
definefield = nothing,
diff --git a/Master/texmf-dist/tex/context/base/back-ini.mkiv b/Master/texmf-dist/tex/context/base/back-ini.mkiv
index 07e9147f259..b7bbdb56f01 100644
--- a/Master/texmf-dist/tex/context/base/back-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/back-ini.mkiv
@@ -163,6 +163,6 @@
\edef\jobsuffix{#1}%
\setsystemmode\jobsuffix}
-\def\setupoutput[#1]{} % will be command line switch
+\unexpanded\def\setupoutput[#1]{} % will be command line switch
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/back-pdf.lua b/Master/texmf-dist/tex/context/base/back-pdf.lua
index 908801d8a95..54e22f1a2bd 100644
--- a/Master/texmf-dist/tex/context/base/back-pdf.lua
+++ b/Master/texmf-dist/tex/context/base/back-pdf.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['back-pdf'] = {
version = 1.001,
- comment = "companion to back-pdf.tex",
+ comment = "companion to back-pdf.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -21,8 +21,7 @@ local concat = table.concat
local round = math.round
local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues
local texsprint, texwrite = tex.sprint, tex.write
-
-ctxcatcodes = tex.ctxcatcodes
+local ctxcatcodes = tex.ctxcatcodes
local copy_node = node.copy
@@ -32,14 +31,18 @@ local registrations = backends.pdf.registrations
local pdfliteral, register = nodes.pdfliteral, nodes.register
-local pdfconstant = lpdf.constant
-local pdfdictionary = lpdf.dictionary
-local pdfarray = lpdf.array
-local pdfreference = lpdf.reference
-local pdfverbose = lpdf.verbose
+local pdfconstant = lpdf.constant
+local pdfstring = lpdf.string
+local pdfdictionary = lpdf.dictionary
+local pdfarray = lpdf.array
+local pdfreference = lpdf.reference
+local pdfverbose = lpdf.verbose
+local pdfflushobject = lpdf.flushobject
+local pdfreserveobject = lpdf.reserveobject
+local pdfannotation = nodes.pdfannotation
-local pdfreserveobj = pdf.reserveobj
-local pdfimmediateobj = pdf.immediateobj
+local pdfreserveobj = pdf.reserveobj
+local pdfimmediateobj = pdf.immediateobj
function nodeinjections.rgbcolor(r,g,b)
return register(pdfliteral(format("%s %s %s rg %s %s %s RG",r,g,b,r,g,b)))
@@ -55,7 +58,7 @@ end
function nodeinjections.spotcolor(n,f,d,p)
if type(p) == "string" then
- p = p:gsub(","," ") -- brr misuse of spot
+ p = gsub(p,","," ") -- brr misuse of spot
end
return register(pdfliteral(format("/%s cs /%s CS %s SCN %s scn",n,n,p,p)))
end
@@ -72,9 +75,9 @@ local effects = {
hidden = 3,
}
-function nodeinjections.effect(stretch,rulethickness,effect)
+function nodeinjections.effect(effect,stretch,rulethickness)
-- always, no zero test (removed)
- rulethickness = number.dimenfactors["bp"]*rulethickness
+ rulethickness = number.dimenfactors["bp"] * rulethickness
effect = effects[effect] or effects['normal']
return register(pdfliteral(format("%s Tc %s w %s Tr",stretch,rulethickness,effect))) -- watch order
end
@@ -131,7 +134,7 @@ function codeinjections.insertmovie(specification)
Movie = moviedict,
A = controldict,
}
- node.write(nodes.pdfannot(width,height,0,action()))
+ node.write(pdfannotation(width,height,0,action()))
end
function codeinjections.insertsound(specification)
@@ -151,7 +154,7 @@ function codeinjections.insertsound(specification)
Movie = sounddict,
A = controldict,
}
- node.write(nodes.pdfannot(0,0,0,action()))
+ node.write(pdfannotation(0,0,0,action()))
end
end
@@ -162,7 +165,7 @@ local pdf_indexed = pdfconstant("Indexed")
local pdf_device_n = pdfconstant("DeviceN")
local pdf_device_rgb = pdfconstant("DeviceRGB")
local pdf_device_cmyk = pdfconstant("DeviceCMYK")
-local pdf_device_gray = pdfconstant("Devicegray")
+local pdf_device_gray = pdfconstant("DeviceGray")
local pdf_extgstate = pdfconstant("ExtGState")
local pdf_rbg_range = pdfarray { 0, 1, 0, 1, 0, 1 }
@@ -303,6 +306,7 @@ local function indexcolorref(name) -- actually, names (parent) is the hash
end
function registrations.rgbspotcolor(name,noffractions,names,p,r,g,b)
+--~ print(name,noffractions,names,p,r,g,b)
if noffractions == 1 then
registersomespotcolor(name,noffractions,names,p,pdf_device_rgb,pdf_rbg_range,format(rgb_function,r,g,b))
else
diff --git a/Master/texmf-dist/tex/context/base/back-pdf.mkiv b/Master/texmf-dist/tex/context/base/back-pdf.mkiv
index 2d3ba85248b..a10afd5b901 100644
--- a/Master/texmf-dist/tex/context/base/back-pdf.mkiv
+++ b/Master/texmf-dist/tex/context/base/back-pdf.mkiv
@@ -29,7 +29,7 @@
\pdfpkresolution = 600
\pdfdecimaldigits = 10
\pdfinclusionerrorlevel = 0
-\pdfminorversion = 5
+\pdfminorversion = 6 % maybe even 7
%pdfuniqueresname = 1
%D This one can be consulted by users although the suffix is also
@@ -44,13 +44,13 @@
%D These are the only official methods to add stuff to the resources.
-\def\pdfbackendsetcatalog #1#2{\ctxlua{lpdf.addtocatalog ("#1",\!!bs#2\!!es)}} \newtoks\pdfcatalog
-\def\pdfbackendsetinfo #1#2{\ctxlua{lpdf.addtoinfo ("#1",\!!bs#2\!!es)}} \newtoks\pdfinfo
-\def\pdfbackendsetname #1#2{\ctxlua{lpdf.addtonames ("#1",\!!bs#2\!!es)}} \newtoks\pdfnames
+\def\pdfbackendsetcatalog #1#2{\ctxlua{lpdf.addtocatalog ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetinfo #1#2{\ctxlua{lpdf.addtoinfo ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetname #1#2{\ctxlua{lpdf.addtonames ("#1",\!!bs#2\!!es)}}
-\def\pdfbackendsetpageattribute #1#2{\ctxlua{lpdf.addtopageattributes ("#1",\!!bs#2\!!es)}} \newtoks\pdfpageresources
-\def\pdfbackendsetpagesattribute#1#2{\ctxlua{lpdf.addtopagesattributes("#1",\!!bs#2\!!es)}} \newtoks\pdfpageattr
-\def\pdfbackendsetpageresource #1#2{\ctxlua{lpdf.addtopageresources ("#1",\!!bs#2\!!es)}} \newtoks\pdfpagesattr
+\def\pdfbackendsetpageattribute #1#2{\ctxlua{lpdf.addtopageattributes ("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetpagesattribute#1#2{\ctxlua{lpdf.addtopagesattributes("#1",\!!bs#2\!!es)}}
+\def\pdfbackendsetpageresource #1#2{\ctxlua{lpdf.addtopageresources ("#1",\!!bs#2\!!es)}}
\def\pdfbackendsetextgstate #1#2{\ctxlua{lpdf.adddocumentextgstate ("#1",lpdf.verbose(\!!bs#2\!!es))}}
\def\pdfbackendsetcolorspace #1#2{\ctxlua{lpdf.adddocumentcolorspace("#1",lpdf.verbose(\!!bs#2\!!es))}}
@@ -59,27 +59,33 @@
\def\pdfbackendcurrentresources {\ctxlua{lpdf.collectedresources()}}
+%D Let's block these:
+
+\let\pdfcatalog \relax \newtoks\pdfcatalog
+\let\pdfinfo \relax \newtoks\pdfinfo
+\let\pdfnames \relax \newtoks\pdfnames
+\let\pdfpageresources\relax \newtoks\pdfpageresources
+\let\pdfpageattr \relax \newtoks\pdfpageattr
+\let\pdfpagesattr \relax \newtoks\pdfpagesattr
+
%D An example of usage is:
-\appendtoks % will change ...
- \pdfbackendsetinfo{ConTeXt.Version}{(\contextversion)}%
- \pdfbackendsetinfo{ConTeXt.Time} {(\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute)}%
- \pdfbackendsetinfo{ConTeXt.Jobname}{(\jobname)}%
- \pdfbackendsetinfo{ConTeXt.Url} {(www.pragma-ade.com)}%
+\appendtoks
+ \pdfbackendsetinfo{ConTeXt.Version}{\contextversion}%
+ \pdfbackendsetinfo{ConTeXt.Time} {\number\normalyear.\twodigits\normalmonth.\twodigits\normalday\space \twodigits\currenthour:\twodigits\currentminute}%
+ \pdfbackendsetinfo{ConTeXt.Jobname}{\jobname}%
+ \pdfbackendsetinfo{ConTeXt.Url} {www.pragma-ade.com}%
\to \everylastbackendshipout
%D Unfortunately this is still needed (also for \METAPOST\ to
%D \PDF\ converter):
-\def\doresetmapfilelist
- {\global\let\doresetmapfilelist\relax
- \pdfmapfile{original-empty.map}}
-
-\def\doloadmapfile #1#2{\pdfmapfile{#1#2}}
-\def\doloadmapline #1#2{\pdfmapline{#1#2}}
-
-\appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryxform
-\appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryximage
+% \def\doresetmapfilelist
+% {\global\let\doresetmapfilelist\relax
+% \pdfmapfile{original-empty.map}}
+%
+% \appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryxform
+% \appendtoksonce \loadallfontmapfiles \to \pdfbackendeveryximage
%D Transformations. Some day we will use primitives (once they're fixed).
@@ -101,7 +107,7 @@
\def\dostartmirroring{\pdfliteral{-1 0 0 1 0 0 cm}}
\def\dostopmirroring {\pdfliteral{-1 0 0 1 0 0 cm}}
-\def\dostartclipping#1#2#3% todo
+\def\dostartclipping#1#2#3% todo (still needed?)
{\PointsToBigPoints{#2}\width
\PointsToBigPoints{#3}\height
\grabMPclippath{#1}{1}\width\height{0 0 m \width\space 0 l \width \height l 0 \height l}%
@@ -115,7 +121,7 @@
\appendtoks \ctxlua{backends.codeinjections.finalizepage ()}\to \everybackendshipout % is immediate
\appendtoks \ctxlua{backends.codeinjections.finalizedocument()}\to \everylastbackendshipout % is immediate
-%D Temporary hack, will be removed or improved.
+%D Temporary hack, will be removed or improved or default.
\def\TransparencyHack{\ctxlua{backends.codeinjections.addtransparencygroup()}}
@@ -159,8 +165,11 @@
{\dogetobjectreferencepage{#1}{#2}#3%
\doPDFgetpagereference{\ifx#3\empty\realfolio\else#3\fi}#3}
+\let\lastpredefinedsymbol\empty % some day we can do more at the lua end
+
\def\predefinesymbol[#1]%
{\begingroup
+ \xdef\lastpredefinedsymbol{#1}%
\settightobject{SYM}{#1}\hbox{\symbol[#1]}% to be checked ... maybe only fitting
\dogetobjectreference{SYM}{#1}\lastref
\ctxlua{backends.codeinjections.registersymbol("#1",\lastref)}%
diff --git a/Master/texmf-dist/tex/context/base/back-u3d.mkiv b/Master/texmf-dist/tex/context/base/back-u3d.mkiv
new file mode 100644
index 00000000000..398159feb2c
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/back-u3d.mkiv
@@ -0,0 +1,156 @@
+%D \module
+%D [ file=back-u3d,
+%D version=2009.04.15,
+%D title=\CONTEXT\ Backend Macros,
+%D subtitle=U3D Experiment,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+% This is only a placeholder that demonstrates the usage of u3d
+% resources. The user interface is rather messy an might be
+% improved. The files and setup is derived from an example by
+% Michael Vidiassov.
+
+\endinput
+
+\starttext
+
+\startluaparameterset [u3d:myset:controls:1]
+ view = {
+ name = 'default',
+ bg = {1,1,1},
+ mag = 100,
+ coo = {0,0,0},
+ c2c = {0,0,1},
+ rot = {40,0,60},
+ roo = 6,
+ lights = 'CAD'
+ },
+ js = 'cloudq.js'
+\stopluaparameterset
+
+\startluaparameterset [u3d:myset:controls:2]
+ views = {
+ {
+ name = 'AnglePositioning',
+ bg = {1,1,1},
+ azimuth = 45,
+ altitude = 45,
+ roo = 50,
+ aac = 2.5,
+ lights = 'Artwork'
+ },
+ {
+ name = 'RotationPositioning',
+ bg = {1,1,1},
+ rot = {0,45,45},
+ roo = 50,
+ aac = 2.5,
+ lights = 'Artwork'
+ },
+ {
+ name = 'VectorPositioning',
+ bg = {1,0,0},
+ c2c = {1,1,math.sqrt(2)},
+ roo = 50,
+ aac = 2.5,
+ lights = 'CAD'
+ },
+ {
+ name = 'PositionPositioning',
+ bg = {1,0,0},
+ pos = {1+25,1+25,1+50/math.sqrt(2)},
+ aac = 2.5,
+ lights = 'CAD'
+ },
+ {
+ name = 'ortho',
+ bg = {1,1,1},
+ mag = 300,
+ lights = 'CAD',
+ crossection = {}
+ }
+ },
+ view = {
+ name = 'default',
+ bg = {1,1,1},
+ c2c = {-1,-1,0},
+ roo = 50,
+ aac = 2.5,
+ roll = 45,
+ lights = 'CAD',
+ crossection = {
+ normal = {-1,-1,-1},
+ transparent = true
+ },
+ nodes = {
+ {
+ name = 'xlabel',
+ visible = false
+ },
+ {
+ name = 'ylabel',
+ opacity = 0.5
+ },
+ {
+ name = 'zlabel',
+ rendermode = 'Wireframe'
+ }
+ }
+ }
+\stopluaparameterset
+
+\useexternalfigure
+ [cloudq]
+ [cloudq.u3d]
+ [width=0.7\textwidth,
+ height=.7\textwidth,
+ display=u3d:myset:display:1,
+ controls=u3d:myset:controls:1]
+
+\useexternalfigure
+ [axes]
+ [axes.u3d]
+ [width=0.7\textwidth,
+ height=.7\textwidth,
+ controls=u3d:myset:controls:1]
+
+\startluaparameterset[u3d:myset:display:2]
+ toolbar = true,
+ preview = 'cloudq.png'
+\stopluaparameterset
+\startluaparameterset[u3d:myset:display:3]
+ toolbar = true,
+ tree = false,
+ preview = 'area.png'
+\stopluaparameterset
+\startluaparameterset[u3d:myset:display:4]
+ toolbar = true,
+ tree = false,
+ view = {
+ name = 'view',
+ bg = {0.1,0.1,0.1},
+ c2c = {-1,-1,0},
+ roo = 50,
+ aac = 2.5,
+ roll = 45,
+ lights = 'Red'
+ }
+\stopluaparameterset
+\startluaparameterset[u3d:myset:display:5]
+ toolbar = true,
+ tree = false,
+ view = 'ortho'
+\stopluaparameterset
+
+\placefigure[here]{none}{\externalfigure[cloudq][display=u3d:myset:display:2]}
+\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:3]}
+\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:4]}
+\placefigure[here]{none}{\externalfigure[axes] [display=u3d:myset:display:5,width=0.5\textwidth,height=.5\textwidth]}
+
+\stoptext
diff --git a/Master/texmf-dist/tex/context/base/bibl-bib.lua b/Master/texmf-dist/tex/context/base/bibl-bib.lua
index 028202ec22f..3c0dad2fa4e 100644
--- a/Master/texmf-dist/tex/context/base/bibl-bib.lua
+++ b/Master/texmf-dist/tex/context/base/bibl-bib.lua
@@ -12,8 +12,18 @@ bibtex files and converts them to xml so that the we access the content
in a convenient way. Actually handling the data takes place elsewhere.
--ldx]]--
-local lower, format = string.lower, string.format
+local utf = unicode.utf8
+local lower, format, gsub, concat = string.lower, string.format, string.gsub, table.concat
local next = next
+local utfchar = utf.char
+local lpegmatch = lpeg.match
+local textoutf = characters and characters.tex.toutf
+local variables = interfaces and interfaces.variables
+
+local finalizers = xml.finalizers.tex
+local xmlfilter, xmltext = xml.filter, xml.text
+
+local trace_bibxml = false trackers.register("publications.bibxml", function(v) trace_bibtex = v end)
bibtex = bibtex or { }
@@ -21,10 +31,29 @@ bibtex.size = 0
bibtex.definitions = 0
bibtex.shortcuts = 0
+local defaultshortcuts = {
+ jan = "1",
+ feb = "2",
+ mar = "3",
+ apr = "4",
+ may = "5",
+ jun = "6",
+ jul = "7",
+ aug = "8",
+ sep = "9",
+ oct = "10",
+ nov = "11",
+ dec = "12",
+}
+
local shortcuts = { }
-local data = { }
+local data = { }
local entries
+-- Currently we expand shortcuts and for large ones (like the acknowledgements
+-- in tugboat.bib this is not that efficient. However, eventually strings get
+-- hashed again.
+
local function do_shortcut(tag,key,value)
bibtex.shortcuts = bibtex.shortcuts + 1
if lower(tag) == "@string" then
@@ -49,34 +78,33 @@ local function do_definition(tag,key,tab) -- maybe check entries here (saves mem
end
local function resolve(s)
- return shortcuts[s] or ""
-end
-
-local percent = lpeg.P("%")
-local start = lpeg.P("@")
-local comma = lpeg.P(",")
-local hash = lpeg.P("#")
-local escape = lpeg.P("\\")
-local single = lpeg.P("'")
-local double = lpeg.P('"')
-local left = lpeg.P('{')
-local right = lpeg.P('}')
+ return shortcuts[s] or defaultshortcuts[s] or s -- can be number
+end
+
+local P, R, S, C, Cc, Cs, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Cs, lpeg.Ct
+
+local percent = P("%")
+local start = P("@")
+local comma = P(",")
+local hash = P("#")
+local escape = P("\\")
+local single = P("'")
+local double = P('"')
+local left = P('{')
+local right = P('}')
local both = left + right
-local lineending = lpeg.S("\n\r")
-local space = lpeg.S(" \t\n\r\f")
+local lineending = S("\n\r")
+local space = S(" \t\n\r\f")
local spacing = space^0
-local equal = lpeg.P("=")
+local equal = P("=")
local collapsed = (space^1)/ " "
local function add(a,b) if b then return a..b else return a end end
-local keyword = lpeg.C((lpeg.R("az","AZ","09") + lpeg.S("@_:-"))^1) -- lpeg.C((1-space)^1)
+local keyword = C((lpeg.R("az","AZ","09") + S("@_:-"))^1) -- lpeg.C((1-space)^1)
local s_quoted = ((escape*single) + collapsed + (1-single))^0
local d_quoted = ((escape*double) + collapsed + (1-double))^0
-local balanced = lpeg.P {
- [1] = ((escape * (left+right)) + (1 - (left+right)) + lpeg.V(2))^0,
- [2] = left * lpeg.V(1) * right
-}
+local balanced = lpeg.patterns.balanced
local s_value = (single/"") * s_quoted * (single/"")
local d_value = (double/"") * d_quoted * (double/"")
@@ -84,7 +112,7 @@ local b_value = (left /"") * balanced * (right /"")
local r_value = keyword/resolve
local somevalue = s_value + d_value + b_value + r_value
-local value = lpeg.Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0))
+local value = Cs((somevalue * ((spacing * hash * spacing)/"" * somevalue)^0))
local assignment = spacing * keyword * spacing * equal * spacing * value * spacing
local shortcut = keyword * spacing * left * spacing * (assignment * comma^0)^0 * spacing * right
@@ -101,14 +129,21 @@ function bibtex.convert(session,content)
data, shortcuts, entries = session.data, session.shortcuts, session.entries
-- session.size = session.size + #content
bibtex.size = bibtex.size + #content
- grammar:match(content or "")
+ session.size = session.size + #content
+ lpegmatch(grammar,content or "")
statistics.stoptiming(bibtex)
end
function bibtex.load(session,filename)
local filename = resolvers.find_file(filename,"bib")
if filename ~= "" then
- bibtex.convert(session,io.loaddata(filename) or "")
+ local data = io.loaddata(filename) or ""
+ if data == "" then
+ logs.report("publications","empty file '%s', no conversion to xml",filename)
+ elseif trace_bibxml then
+ logs.report("publications","converting file '%s' to xml",filename)
+ end
+ bibtex.convert(session,data)
end
end
@@ -119,37 +154,88 @@ function bibtex.new()
xml = xml.convert("\n"),
size = 0,
entries = nil,
+ loaded = false,
}
end
local escaped_pattern = xml.escaped_pattern
-function bibtex.toxml(session)
+local ihatethis = {
+ f = "\\f",
+ n = "\\n",
+ r = "\\r",
+ s = "\\s",
+ t = "\\t",
+ v = "\\v",
+ z = "\\z",
+}
+
+local command = P("\\")/"" * Cc("\\bibtexcommand{") * (R("az","AZ")^1) * Cc("}")
+local any = P(1)
+local done = P(-1)
+local one_l = P("{") / ""
+local one_r = P("}") / ""
+local two_l = P("{{") / ""
+local two_r = P("}}") / ""
+
+local filter = Cs(
+ two_l * (command + any - two_r - done)^0 * two_r * done +
+ one_l * (command + any - one_r - done)^0 * one_r * done +
+ (command + any )^0
+)
+
+function bibtex.toxml(session,options)
+ if session.loaded then
+ return
+ else
+ session.loaded = true
+ end
-- we can always speed this up if needed
-- format slows down things a bit but who cares
statistics.starttiming(bibtex)
local result = { }
+ local options = aux.settings_to_hash(options)
+ local convert = options.convert -- todo: interface
+ local strip = options.strip -- todo: interface
local entries = session.entries
result[#result+1] = format("")
result[#result+1] = format("")
for id, categories in next, session.data do
- result[#result+1] = format(" ",id)
+ id = lower(gsub(id,"^@",""))
for name, entry in next, categories do
if not entries or entries[name] then
- result[#result+1] = format(" ",name)
+ result[#result+1] = format("",lower(name),id)
for key, value in next, entry do
- value = escaped_pattern:match(value)
+ value = gsub(value,"\\(.)",ihatethis)
+ value = lpegmatch(escaped_pattern,value)
+
if value ~= "" then
- result[#result+1] = format(" %s",key,value)
+ if convert then
+ value = textoutf(value,true)
+ end
+ if strip then
+ -- as there is no proper namespace in bibtex we need this
+ -- kind of hackery ... bibtex databases are quite unportable
+ value = lpegmatch(filter,value) or value
+ end
+ result[#result+1] = format(" %s",key,value)
end
end
- result[#result+1] = format(" ")
+ result[#result+1] = format("")
end
end
- result[#result+1] = format(" ")
end
result[#result+1] = format("")
- session.xml = xml.convert(table.concat(result,"\n"))
+ result = concat(result,"\n")
+ -- alternatively we could use lxml.convert
+ session.xml = xml.convert(result, {
+ resolve_entities = true,
+ resolve_predefined_entities = true, -- in case we have escaped entities
+ -- unify_predefined_entities = true, -- & -> &
+ utfize_entities = true,
+ } )
+ session.data = nil
+ session.shortcuts = nil
statistics.stoptiming(bibtex)
end
@@ -204,30 +290,473 @@ end)
--~ print(table.serialize(session.shortcuts))
--~ print(xml.serialize(session.xml))
--- this will move:
+if not characters then dofile(resolvers.find_file("char-def.lua")) end
+
+local chardata = characters.data
+local concat = table.concat
+
+local P, Ct, lpegmatch = lpeg.P, lpeg.Ct, lpeg.match
+
+local space, comma = P(" "), P(",")
+
+local andsplitter = Ct(lpeg.splitat(space^1 * "and" * space^1))
+local commasplitter = Ct(lpeg.splitat(space^0 * comma * space^0))
+local spacesplitter = Ct(lpeg.splitat(space^1))
+local firstcharacter = lpeg.patterns.utf8byte
+
+function is_upper(str)
+ local first = lpegmatch(firstcharacter,str)
+ local okay = chardata[first]
+ return okay and okay.category == "lu"
+end
+
+local function splitauthors(str)
+ local authors = lpegmatch(andsplitter,str)
+ for i=1,#authors do
+ local firstnames, vons, surnames, initials, juniors, words
+ local author = authors[i]
+ local split = lpegmatch(commasplitter,author)
+ local n = #split
+ if n == 1 then
+ --~ First von Last
+ words = lpegmatch(spacesplitter,author)
+ firstnames, vons, surnames = { }, { }, { }
+ local i, n = 1, #words
+ while i <= n do
+ local w = words[i]
+ if is_upper(w) then
+ firstnames[#firstnames+1], i = w, i + 1
+ else
+ break
+ end
+ end
+ while i <= n do
+ local w = words[i]
+ if is_upper(w) then
+ break
+ else
+ vons[#vons+1], i = w, i + 1
+ end
+ end
+ while i <= n do
+ surnames[#surnames+1], i = words[i], i + 1
+ end
+ elseif n == 2 then
+ --~ von Last, First
+ words = lpegmatch(spacesplitter,split[2])
+ surnames = lpegmatch(spacesplitter,split[1])
+ firstnames, vons = { }, { }
+ local i, n = 1, #words
+ while i <= n do
+ local w = words[i]
+ if is_upper(w) then
+ firstnames[#firstnames+1], i = w, i + 1
+ else
+ break
+ end
+ end
+ while i <= n do
+ vons[#vons+1], i = words[i], i + 1
+ end
+ else
+ --~ von Last, Jr ,First
+ firstnames = lpegmatch(spacesplitter,split[1])
+ juniors = lpegmatch(spacesplitter,split[2])
+ surnames = lpegmatch(spacesplitter,split[3])
+ if n > 3 then
+ -- error
+ end
+ end
+ if #surnames == 0 then
+ surnames[1] = firstnames[#firstnames]
+ firstnames[#firstnames] = nil
+ end
+ if firstnames then
+ initials = { }
+ for i=1,#firstnames do
+ initials[i] = utfchar(lpegmatch(firstcharacter,firstnames[i]))
+ end
+ end
+ authors[i] = {
+ original = author,
+ firstnames = firstnames,
+ vons = vons,
+ surnames = surnames,
+ initials = initials,
+ juniors = juniors,
+ }
+ end
+ authors.original = str
+ return authors
+end
+
+local function the_initials(initials,symbol)
+ local t, symbol = { }, symbol or "."
+ for i=1,#initials do
+ t[i] = initials[i] .. symbol
+ end
+ return t
+end
+
+-- authors
+
+bibtex.authors = bibtex.authors or { }
+
+local authors = bibtex.authors
+
+local defaultsettings = {
+ firstnamesep = " ",
+ vonsep = " ",
+ surnamesep = " ",
+ juniorsep = " ",
+ surnamejuniorsep = ", ",
+ juniorjuniorsep = ", ",
+ surnamefirstnamesep = ", ",
+ surnameinitialsep = ", ",
+ namesep = ", ",
+ lastnamesep = " and ",
+ finalnamesep = " and ",
+}
+
+function authors.normal(author,settings)
+ local firstnames, vons, surnames, juniors = author.firstnames, author.vons, author.surnames, author.juniors
+ local result, settings = { }, settings or defaultsettings
+ if firstnames and #firstnames > 0 then
+ result[#result+1] = concat(firstnames," ")
+ result[#result+1] = settings.firstnamesep or defaultsettings.firstnamesep
+ end
+ if vons and #vons > 0 then
+ result[#result+1] = concat(vons," ")
+ result[#result+1] = settings.vonsep or defaultsettings.vonsep
+ end
+ if surnames then
+ result[#result+1] = concat(surnames," ")
+ end
+ if juniors and #juniors > 0 then
+ result[#result+1] = concat(juniors," ")
+ result[#result+1] = settings.surnamesep or defaultsettings.surnamesep
+ end
+ return concat(result)
+end
+
+function authors.normalshort(author,settings)
+ local firstnames, vons, surnames, juniors = author.firstnames, author.vons, author.surnames, author.juniors
+ local result, settings = { }, settings or defaultsettings
+ if firstnames and #firstnames > 0 then
+ result[#result+1] = concat(firstnames," ")
+ result[#result+1] = settings.firstnamesep or defaultsettings.firstnamesep
+ end
+ if vons and #vons > 0 then
+ result[#result+1] = concat(vons," ")
+ result[#result+1] = settings.vonsep or defaultsettings.vonsep
+ end
+ if surnames then
+ result[#result+1] = concat(surnames," ")
+ end
+ if juniors and #juniors > 0 then
+ result[#result+1] = concat(juniors," ")
+ result[#result+1] = settings.surnamejuniorsep or defaultsettings.surnamejuniorsep
+ end
+ return concat(result)
+end
+
+function authors.inverted(author,settings)
+ local firstnames, vons, surnames, juniors = author.firstnames, author.vons, author.surnames, author.juniors
+ local result, settings = { }, settings or defaultsettings
+ if vons and #vons > 0 then
+ result[#result+1] = concat(vons," ")
+ result[#result+1] = settings.vonsep or defaultsettings.vonsep
+ end
+ if surnames then
+ result[#result+1] = concat(surnames," ")
+ end
+ if juniors and #juniors > 0 then
+ result[#result+1] = settings.juniorjuniorsep or defaultsettings.juniorjuniorsep
+ result[#result+1] = concat(juniors," ")
+ end
+ if firstnames and #firstnames > 0 then
+ result[#result+1] = settings.surnamefirstnamesep or defaultsettings.surnamefirstnamesep
+ result[#result+1] = concat(firstnames," ")
+ end
+ return concat(result)
+end
+
+function authors.invertedshort(author,settings)
+ local vons, surnames, initials, juniors = author.vons, author.surnames, author.initials, author.juniors
+ local result, settings = { }, settings or defaultsettings
+ if vons and #vons > 0 then
+ result[#result+1] = concat(vons," ")
+ result[#result+1] = settings.vonsep or defaultsettings.vonsep
+ end
+ if surnames then
+ result[#result+1] = concat(surnames," ")
+ end
+ if juniors and #juniors > 0 then
+ result[#result+1] = settings.juniorjuniorsep or defaultsettings.juniorjuniorsep
+ result[#result+1] = concat(juniors," ")
+ end
+ if initials and #initials > 0 then
+ result[#result+1] = settings.surnameinitialsep or defaultsettings.surnameinitialsep
+ result[#result+1] = concat(the_initials(initials)," ")
+ end
+ return concat(result)
+end
+
+local lastconcatsize = 1
+
+local function bibtexconcat(t,settings)
+ local namesep = settings.namesep or defaultsettings.namesep or ", "
+ local lastnamesep = settings.lastnamesep or defaultsettings.lastnamesep or namesep
+ local finalnamesep = settings.finalnamesep or defaultsettings.finalnamesep or lastnamesep
+ local lastconcatsize = #t
+ if lastconcatsize > 2 then
+ local s = { }
+ for i=1,lastconcatsize-2 do
+ s[i] = t[i] .. namesep
+ end
+ s[lastconcatsize-1], s[lastconcatsize] = t[lastconcatsize-1] .. finalnamesep, t[lastconcatsize]
+ return concat(s)
+ elseif lastconcatsize > 1 then
+ return concat(t,lastnamesep)
+ elseif lastconcatsize > 0 then
+ return t[1]
+ else
+ return ""
+ end
+end
+
+function authors.concat(author,combiner,what,settings)
+ if type(combiner) == "string" then
+ combiner = authors[combiner or "normal"] or authors.normal
+ end
+ local split = splitauthors(author)
+ local setting = settings[what]
+ local etallimit, etaldisplay, etaltext = 1000, 1000, ""
+ if setting then
+ etallimit = settings.etallimit or 1000
+ etaldisplay = settings.etaldisplay or etallimit
+ etalltext = settings.etaltext or ""
+ end
+ local max = #split
+ if max > etallimit and etaldisplay < max then
+ max = etaldisplay
+ end
+ for i=1,max do
+ split[i] = combiner(split[i],settings)
+ end
+ local result = bibtexconcat(split,settings)
+ if max < #split then
+ return result
+ else
+ return result .. etaltext
+ end
+end
+
+function authors.short(author,year)
+ local result = { }
+ if author then
+ local authors = splitauthors(author)
+ for a=1,#authors do
+ local aa = authors[a]
+ local initials = aa.initials
+ for i=1,#initials do
+ result[#result+1] = initials[i]
+ end
+ local surnames = aa.surnames
+ for s=1,#surnames do
+ result[#result+1] = utfchar(lpegmatch(firstcharacter,surnames[s]))
+ end
+ end
+ end
+ if year then
+ result[#result+1] = year
+ end
+ return concat(result)
+end
+
+-- We can consider creating a hashtable key -> entry but I wonder if
+-- pays off.
+
+local function collectauthoryears(id,list)
+ list = aux.settings_to_hash(list)
+ id = lxml.get_id(id)
+ local found = { }
+ for e in xml.collected(id,"/bibtex/entry") do
+ if list[e.at.tag] then
+ local year = xmlfilter(e,"xml:///field[@name='year']/text()")
+ local author = xmlfilter(e,"xml:///field[@name='author']/text()")
+ if author and year then
+ local a = found[author]
+ if not a then
+ a = { }
+ found[author] = a
+ end
+ local y = a[year]
+ if not y then
+ y = { }
+ a[year] = y
+ end
+ y[#y+1] = e
+ end
+ end
+ end
+ -- found = { author = { year_1 = { e1, e2, e3 } } }
+ local done = { }
+ for author, years in next, found do
+ local yrs = { }
+ for year, entries in next, years do
+ if subyears then
+ -- -- add letters to all entries of an author and if so shouldn't
+ -- -- we tag all years of an author as soon as we do this?
+ -- if #entries > 1 then
+ -- for i=1,#years do
+ -- local entry = years[i]
+ -- -- years[i] = year .. string.char(i + string.byte("0") - 1)
+ -- end
+ -- end
+ else
+ yrs[#yrs+1] = year
+ end
+ end
+ done[author] = yrs
+ end
+ return done
+end
+
+local method, settings = "normal", { }
+
+function authors.setsettings(s)
+ settings = s or settings
+end
if commands then
+ local texsprint = tex and tex.sprint
+ local ctxcatcodes = tex and tex.ctxcatcodes
+
local sessions = { }
function commands.definebibtexsession(name)
sessions[name] = bibtex.new()
end
- function commands.preparebibtexsession(name)
- bibtex.toxml(sessions[name])
- lxml.register("bibtex:"..name,sessions[name].xml)
+
+ function commands.preparebibtexsession(name,xmlname,options)
+ bibtex.toxml(sessions[name],options)
+ lxml.register(xmlname,sessions[name].xml)
end
+
function commands.registerbibtexfile(name,filename)
bibtex.load(sessions[name],filename)
end
+
function commands.registerbibtexentry(name,entry)
local session = sessions[name]
local entries = session.entries
if not entries then
- session.entries = { [entry] = true }
+ session.entries = { [entry] = true } -- here we can keep more info
else
entries[entry] = true
end
end
+ -- commands.bibtexconcat = bibtexconcat
+
+ -- finalizers can be rather dumb as we have just text and no embedded xml
+
+ function finalizers.bibtexconcat(collected,method,what)
+ if collected then
+ local author = collected[1].dt[1] or ""
+ if author ~= "" then
+ texsprint(ctxcatcodes,authors.concat(author,method,what,settings))
+ end
+ end
+ end
+
+ function finalizers.bibtexshort(collected)
+ if collected then
+ local c = collected[1]
+ local year = xmlfilter(c,"xml://field[@name='year']/text()")
+ local author = xmlfilter(c,"xml://field[@name='author']/text()")
+ texsprint(ctxcatcodes,authors.short(author,year))
+ end
+ end
+
+ -- experiment:
+
+ --~ -- alternative approach: keep data at the tex end
+
+ --~ local function xbibtexconcat(t,sep,finalsep,lastsep)
+ --~ local n = #t
+ --~ if n > 0 then
+ --~ context(t[1])
+ --~ if n > 1 then
+ --~ if n > 2 then
+ --~ for i=2,n-1 do
+ --~ context.bibtexpublicationsparameter("sep")
+ --~ context(t[i])
+ --~ end
+ --~ context.bibtexpublicationsparameter("finalsep")
+ --~ else
+ --~ context.bibtexpublicationsparameter("lastsep")
+ --~ end
+ --~ context(t[n])
+ --~ end
+ --~ end
+ --~ end
+
+ -- todo : sort
+
+ -- todo: choose between bibtex or commands namespace
+
+ function bibtex.authorref(id,list)
+ local result = collectauthoryears(id,list,method,what)
+ for author, years in next, result do
+ texsprint(ctxcatcodes,authors.concat(author,method,what,settings))
+ end
+ end
+
+ function bibtex.authoryearref(id,list)
+ local result = collectauthoryears(id,list,method,what)
+ for author, years in next, result do
+ texsprint(ctxcatcodes,authors.concat(author,method,what,settings)," (",concat(years,", "),")")
+ end
+ end
+
+ function bibtex.authoryearsref(id,list)
+ local result = collectauthoryears(id,list,method,what)
+ for author, years in next, result do
+ texsprint(ctxcatcodes,"(",authors.concat(author,method,what,settings),", ",concat(years,", "),")")
+ end
+ end
+
+ function bibtex.singular_or_plural(singular,plural)
+ if lastconcatsize and lastconcatsize > 1 then
+ texsprint(ctxcatcodes,plural)
+ else
+ texsprint(ctxcatcodes,singular)
+ end
+ end
end
+
+
+--~ local function test(sample)
+--~ local authors = splitauthors(sample)
+--~ print(table.serialize(authors))
+--~ for i=1,#authors do
+--~ local author = authors[i]
+--~ print(normalauthor (author,settings))
+--~ print(normalshortauthor (author,settings))
+--~ print(invertedauthor (author,settings))
+--~ print(invertedshortauthor(author,settings))
+--~ end
+--~ print(concatauthors(sample,settings,normalauthor))
+--~ print(concatauthors(sample,settings,normalshortauthor))
+--~ print(concatauthors(sample,settings,invertedauthor))
+--~ print(concatauthors(sample,settings,invertedshortauthor))
+--~ end
+
+--~ local sample_a = "Hagen, Hans and Hoekwater, Taco Whoever T. Ex. and Henkel Hut, Hartmut Harald von der"
+--~ local sample_b = "Hans Hagen and Taco Whoever T. Ex. Hoekwater and Hartmut Harald von der Henkel Hut"
+
+--~ test(sample_a)
+--~ test(sample_b)
diff --git a/Master/texmf-dist/tex/context/base/bibl-bib.mkiv b/Master/texmf-dist/tex/context/base/bibl-bib.mkiv
index 51db67ed7da..10abe5cb8a7 100644
--- a/Master/texmf-dist/tex/context/base/bibl-bib.mkiv
+++ b/Master/texmf-dist/tex/context/base/bibl-bib.mkiv
@@ -11,19 +11,952 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\writestatus{loading}{ConTeXt Bibliography Support / BibTeX}
+\writestatus{loading}{ConTeXt Bibliography Support / Experimental BibTeX}
\registerctxluafile{bibl-bib}{1.001}
\unprotect
-\def\definebibtexsession [#1]{\ctxlua{commands.definebibtexsession("#1")}}
-\def\preparebibtexsession [#1]{\ctxlua{commands.preparebibtexsession("#1")}}
+% todo: et al limiters
+% todo: split: citationvariant and publicationvariant
+
+%D This interface is under development. As I don't use \BIBTEX\ myself I need
+%D some motivation to spend time on it, and an occasional question on the
+%D list can be a reason. A few examples. As \BIBTEX\ databases can be poluted
+%D by local commands, we need to catch:
+%D
+%D \startbuffer
+%D \defbibtexcommand\MF {MF}
+%D \defbibtexcommand\MP {MP}
+%D \defbibtexcommand\TUB {TUGboat}
+%D \defbibtexcommand\Mc {Mac}
+%D \defbibtexcommand\sltt{\tt}
+%D \defbibtexcommand\<#1>{\type{#1}}
+%D \defbibtexcommand\acro#1{#1}
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D Let's define a session and load a few databases. We convert to \UTF\ and
+%D strip commands.
+%D
+%D \startbuffer
+%D \definebibtexsession [somebibtex]
+%D \registerbibtexfile [somebibtex] [tugboat.bib]
+%D \registerbibtexfile [somebibtex] [komoedie.bib]
+%D \preparebibtexsession [somebibtex] [convert,strip]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D This loads an mapping (work in progress):
+%D
+%D \startbuffer
+%D \def\currentbibtexformat{apa} \input bxml-\currentbibtexformat.mkiv
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D There are several ways to handle the \XML. It helps if you're a bit
+%D familiar with \XML\ processing in \MKIV.
+%D
+%D Here we regular setups. Three elements are mapped but only one
+%D is actually used and applied to root element \type {/bibtex}.
+%D
+%D \startbuffer
+%D \startxmlsetups bibtex
+%D \xmlregistereddocumentsetups{#1}{}
+%D \xmlsetsetup{#1}{bibtex|entry|field}{bibtex:*}
+%D \xmlmain{#1}
+%D \stopxmlsetups
+%D
+%D \startxmlsetups bibtex:bibtex
+%D \xmlfilter{#1}{
+%D /entry[@category='article']
+%D /field[@name='author' and (find(text(),'Hagen') or find(text(),'Hoekwater'))]
+%D /../command(bibtex:format)
+%D }
+%D \stopxmlsetups
+%D
+%D \applytobibtexsession[somebibtex][bibtex]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D A simpler setup is given next. Here we just apply a setup to the root
+%D element directly:
+%D
+%D \startbuffer
+%D \startxmlsetups bibtex:list
+%D \xmlfilter{#1}{/bibtex/entry/command(bibtex:format)}
+%D \stopxmlsetups
+%D
+%D \applytobibtexsession[somebibtex][bibtex:list]
+%D \stopbuffer
+%D
+%D \typebuffer
+%D
+%D A slightly more complex expression:
+%D
+%D \startbuffer
+%D \startxmlsetups bibtex:filter
+%D \xmlfilter{#1}{
+%D /bibtex
+%D /entry[@category='article']
+%D /field[@name='author' and (find(text(),'Hagen') or find(text(),'Hoekwater'))]
+%D /../command(bibtex:format)
+%D }
+%D \stopxmlsetups
+%D
+%D \applytobibtexsession[somebibtex][bibtex:filter]
+%D \stopbuffer
+%D
+%D \typebuffer
+
+\newtoks \everydefinebibtexsession
+\newtoks \everypreparebibtexsession
+\newtoks \everysetupbibtexsession
+\setfalse \tracebibtexformat
+
+\unexpanded\def\definebibtexsession {\dosingleargument\dodefinebibtexsession}
+\def\preparebibtexsession {\dodoubleempty \dopreparebibtexsession}
+\unexpanded\def\setupbibtexsession {\dodoubleargument\dosetupbibtexsession}
+
+\def\dodefinebibtexsession [#1]{\edef\currentbibtexsession{#1}%
+ \ctxlua{commands.definebibtexsession("#1")}%
+ \the\everydefinebibtexsession}
+
+\def\dopreparebibtexsession[#1][#2]{\edef\currentbibtexsession{#1}%
+ \ctxlua{commands.preparebibtexsession("#1","bibtex:#1","#2")}%
+ \the\everypreparebibtexsession}
+
+\def\dosetupbibtexsession [#1][#2]{\edef\currentbibtexsession{#1}%
+ \getparameters[\??pb#1][#2]%
+ \the\everysetupbibtexsession}
+
\def\registerbibtexfile {\dodoubleargument\doregisterbibtexfile}
-\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}} % also the fast one
\def\registerbibtexentry {\dodoubleargument\doregisterbibtexentry}
-\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}} % also the fast one
\def\applytobibtexsession {\dodoubleargument\doapplytobibtexsession}
+
+\def\doregisterbibtexfile [#1][#2]{\ctxlua{commands.registerbibtexfile("#1","#2")}}
+\def\doregisterbibtexentry [#1][#2]{\ctxlua{commands.registerbibtexentry("#1","#2")}}
\def\doapplytobibtexsession[#1][#2]{\xmlprocessregistered{bibtex:#1}{#2}{#2}}
+\unexpanded\def\bibtexcommand#1%
+ {\ifcsname\??pb:c:#1\endcsname \else
+ \fakebibtexcommand{#1}%
+ \fi
+ \csname\??pb:c:#1\endcsname}
+
+\def\fakebibtexcommand#1%
+ {\ifcsname#1\endcsname
+ \writestatus{bibtex}{unknown command: #1, using built-in context variant}%
+ \setugvalue{\??pb:c:#1}{\dosomebibtexcommand{#1}}%
+ \else
+ \writestatus{bibtex}{unknown command: #1}%
+ \setugvalue{\??pb:c:#1}{\dofakebibtexcommand{#1}}%
+ \fi}
+
+\let\dosomebibtexcommand \getvalue
+\def\dofakebibtexcommand#1{{\tttf#1}}
+
+\def\defbibtexcommand#1%
+ {\setuvalue{\strippedcsname#1}}
+
+\def\bibxmldoifelse#1{\xmldoifelse\currentbibxmlnode{/field[@name='#1']}}
+\def\bibxmldoif #1{\xmldoif \currentbibxmlnode{/field[@name='#1']}}
+\def\bibxmldoifnot #1{\xmldoifnot \currentbibxmlnode{/field[@name='#1']}}
+\def\bibxmlflush #1{\xmlcontext \currentbibxmlnode{/field[@name='#1']}}
+\def\bibxmlsetup {\xmlsetup \currentbibxmlnode} % {#1}
+
+\def\currentbibtexformat{apa} % ho wto interface this, maybe split loading and key
+\def\currentbibxmlnode {unset}
+\def\currentbibxmltag {unset}
+
+\startxmlsetups bibtex
+ \xmlregistereddocumentsetups{#1}{}
+ \xmlsetsetup{#1}{bibtex|entry|field}{bibtex:*}
+ \xmlmain{#1}
+\stopxmlsetups
+
+\startxmlsetups bibtex:format
+ \bibtexpublicationsparameter\c!before\relax % prevents lookahead
+ \edef\currentbibxmlnode {#1}
+ \edef\currentbibxmltag {\xmlatt{#1}{tag}}
+ \edef\currentbibxmlcategory{\xmlatt{#1}{category}}
+ \ifconditional\tracebibtexformat
+ \tracedbibxmlintro\currentbibxmltag
+ \tracedbibxmlintro\currentbibxmlcategory
+ \fi
+ \ignorespaces
+ \xmlcommand{#1}{.}{bibtex:\currentbibtexformat:\currentbibxmlcategory}
+ \removeunwantedspaces
+ \bibtexpublicationsparameter\c!after\relax % prevents lookahead
+\stopxmlsetups
+
+\startxmlsetups bibtex:list
+ \xmlfilter{#1}{/bibtex/entry/command(bibtex:format)}
+\stopxmlsetups
+
+\startxmlsetups bibtex:bibtex
+ \xmlfilter{#1}{/entry/command(bibtex:format)}
+\stopxmlsetups
+
+% formatters
+
+\let\normalbibxmlflush\bibxmlflush
+
+\definecolor[bibtextracecolor:field] [darkred]
+\definecolor[bibtextracecolor:crossref][darkblue]
+\definecolor[bibtextracecolor:key] [darkgreen]
+
+\def\tracedbibxmlintro #1{{\tttf#1 -> }}
+\def\tracedbibxmlflush #1{\color[bibtextracecolor:field] {\tttf[#1]}}
+\def\tracedbibxmltexts #1{\color[bibtextracecolor:field] {\tttf<#1>}}
+\def\tracedbibxmlcrossref#1{\color[bibtextracecolor:crossref]{\tttf#1}}
+\def\tracedbibxmlkey #1{\color[bibtextracecolor:key] {\tttf#1}}
+
+\def\tracedbibxmltext
+ {\ifconditional\tracebibtexformat
+ \expandafter\tracedbibxmltexts % plural
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+\def\bibxmlflush
+ {\ifconditional\tracebibtexformat
+ \expandafter\tracedbibxmlflush
+ \else
+ \expandafter\normalbibxmlflush
+ \fi}
+
+\startxmlsetups bibtex:format:crossref
+ \ifconditional\tracebibtexformat
+ \tracedbibxmlcrossref{\xmlfirst\currentbibxmlnode{/field[@name='crossref']/lower()}}
+ \else
+ \cite[\xmlfirst\currentbibxmlnode{/field[@name='crossref']/lower()}]
+ \fi
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:key
+ \ifconditional\tracebibtexformat
+ \tracedbibxmlkey{\normalbibxmlflush{key}}
+ \else
+ \bibxmlflush{key}
+ \fi
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:common:author
+ \ifconditional\tracebibtexformat
+ \bibxmlflush\currentbibtexvariant
+ \else
+ \xmlfilter{#1}{/field[@name='\currentbibtexvariant']/bibtexconcat('\currentbibtexvariant')}
+ \fi
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:author
+ \begingroup
+ \def\currentbibtexvariant{author}
+ \xmlsetup{#1}{bibtex:format:common:author}
+ \endgroup
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:artauthor
+ \begingroup
+ \def\currentbibtexvariant{artauthor}
+ \xmlsetup{#1}{bibtex:format:common:author}
+ \endgroup
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:editor
+ \begingroup
+ \def\currentbibtexvariant{editor}
+ \xmlsetup{#1}{bibtex:format:common:author}
+ \endgroup
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:doi
+% \bibdoifelse{\@@pb@doi}{#1\expanded{\bibgotoDOI{\@@pb@thekey}{\@@pb@doi}}#2}{#3}
+ *doi*
+\stopxmlsetups
+
+
+\startxmlsetups bibtex:format:doi
+% \bibdoifelse{\@@pb@biburl}{#1\expanded{\bibgotoURL{\@@pb@thekey}{\@@pb@biburl}}#2}{#3}
+ *url*
+\stopxmlsetups
+
+\startxmlsetups bibtex:format:month
+% {\bibdoifelse\@@pb@month
+% {#1\doifnumberelse\@@pb@month
+% {\doifconversiondefinedelse\@@pbmonthconversion
+% {\convertnumber\@@pbmonthconversion\@@pb@month}{\@@pb@month}}%
+% {\@@pb@month}#2}%
+% {#3}
+ *month*
+\stopxmlsetups
+
+% lists
+
+\def\bibtexlistprocessor
+ {\ctxlua{bibtex.hacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}}
+
+\appendtoks
+ \definelist[\currentbibtexsession]%
+ \setuplist[\currentbibtexsession][\c!state=\v!start,\c!width=]%
+ \installstructurelistprocessor{\currentbibtexsession:userdata}{\bibtexlistprocessor}%
+\to \everydefinebibtexsession
+
+% \def\installbibtexsorter#1#2%
+% {\setvalue{\??pb:\c!sort:#1}{#2}}
+
+% \installbibtexsorter\v!no {no}
+% \installbibtexsorter\v!author {au}
+% \installbibtexsorter\v!title {ti}
+% \installbibtexsorter\v!short {ab}
+% \installbibtexsorter\empty {no}
+% \installbibtexsorter\s!default{no}
+
+% \setupbibtex
+% [\c!sorttype=\v!cite,
+% \c!sort=no]
+
+% \long\unexpanded\def\startpublication#1\stoppublication
+% {\blank
+% todo
+% \blank}
+
+% \let\stoppublication\relax
+
+\unexpanded\def\bibtexspace {\removeunwantedspaces\space}
+\unexpanded\def\bibtexperiod {\removeunwantedspaces.\space}
+\unexpanded\def\bibtexcomma {\removeunwantedspaces,\space}
+\unexpanded\def\bibtexlparent {\removeunwantedspaces\space(}
+\unexpanded\def\bibtexrparent {\removeunwantedspaces)\space}
+\unexpanded\def\bibtexlbracket{\removeunwantedspaces\space[}
+\unexpanded\def\bibtexrbracket{\removeunwantedspaces]\space}
+
+% interfacing
+
+% todo : lang en language
+% todo : directions
+
+
+% variables
+
+\newcount\bibtexblock \bibtexblock\plusone
+
+\newtoks \everysetupbibtexpublications
+\newtoks \everysetupbibtexcitations
+\newcount\bibtexcounter
+
+\def\bibtexrefprefix{\number\bibtexblock:}
+
+\let\currentbibtexsession\s!default
+\let\currentbibtexvariant\s!default
+
+% parameters: session+variant variant session shared
+
+\def\bibtexpublicationsparameter#1%
+ {\csname
+ \ifcsname\??pb\currentbibtexsession:\currentbibtexvariant#1\endcsname
+ \??pb\currentbibtexsession:\currentbibtexvariant#1%
+ \else\ifcsname\??pb:\currentbibtexvariant#1\endcsname
+ \??pb:\currentbibtexvariant#1%
+ \else\ifcsname\??pb\currentbibtexsession#1\endcsname
+ \??pb\currentbibtexsession#1%
+ \else\ifcsname\??pb#1\endcsname
+ \??pb#1%
+ \else
+ \s!empty
+ \fi\fi\fi\fi
+ \endcsname}
+
+\def\bibtexcitationparameter#1%
+ {\csname
+ \ifcsname\??pv\currentbibtexsession:\currentbibtexvariant#1\endcsname
+ \??pv\currentbibtexsession:\currentbibtexvariant#1%
+ \else\ifcsname\??pv:\currentbibtexvariant#1\endcsname
+ \??pv:\currentbibtexvariant#1%
+ \else\ifcsname\??pv\currentbibtexsession#1\endcsname
+ \??pv\currentbibtexsession#1%
+ \else\ifcsname\??pv#1\endcsname
+ \??pv#1%
+ \else
+ \s!empty
+ \fi\fi\fi\fi
+ \endcsname}
+
+% setup commands
+
+\unexpanded\def\setupbibtexpublications
+ {\let\currentpublicationclass\??pb
+ \let\everysetupbibtexwhatever\everysetupbibtexpublications
+ \dodoubleargument\dosetupbibtexwhatever}
+
+\unexpanded\def\setupbibtexcitations
+ {\let\currentpublicationclass\??pv
+ \let\everysetupbibtexwhatever\everysetupbibtexcitations
+ \dodoubleargument\dosetupbibtexwhatever}
+
+\unexpanded\def\setupbibtexpublicationvariants
+ {\let\currentpublicationclass\??pb
+ \let\everysetupbibtexwhatever\everysetupbibtexpublications
+ \dotripleargument\dosetupbibtexwhatevervariant}
+
+\unexpanded\def\setupbibtexcitationvariants
+ {\let\currentpublicationclass\??pv
+ \let\everysetupbibtexwhatever\everysetupbibtexcitations
+ \dotripleargument\dosetupbibtexwhatevervariant}
+
+\def\dosetupbibtexwhatever[#1][#2]% [sessionlist] [setup]
+ {\ifsecondargument
+ % sessions setups
+ \def\dobtxcommand##1{\getparameters[\currentpublicationclass##1][#2]}%
+ \processcommalist[#1]\dobtxcommand
+ \else
+ % setups
+ \getparameters[\currentpublicationclass][#1]%
+ \the\everysetupbibtexwhatever
+ \fi}
+
+\def\dosetupbibtexwhatevervariant[#1][#2][#3]% [sessionlist] [variantlist] [setup]
+ {\ifthirdargument
+ % sessions variants setups
+ \def\dobtxcommand##1%
+ {\def\dodobtxcommand####1{\getparameters[\currentpublicationclass##1:####1][#3]}%
+ \processcommalist[#2]\dodobtxcommand}%
+ \processcommalist[#1]\docbtxommand
+ \else\ifsecondargument
+ % variants setups
+ \def\dobtxcommand##1{\getparameters[\currentpublicationclass:##1][#2]}%
+ \processcommalist[#1]\dobtxcommand
+ \else
+ % setups
+ \getparameters[\currentpublicationclass][#1]%
+ \the\everysetupbibtexwhatever
+ \fi\fi}
+
+% some initializations
+
+\setupbibtexcitationvariants
+ [author,authoryear,authoryears]
+ [\c!namesep={, }]
+
+% loading alternatives (apa etc)
+
+\def\doloadbibtexpublicationalternative
+ {\ifproductionrun
+ \edef\bibtexpublicationsalternative{\@@pbalternative}% parent
+ \ifx\bibtexpublicationsalternative\empty \else
+ \processcommacommand[\bibtexpublicationsalternative]\dodoloadbibtexpublicationalternative
+ \let\@@pbalternative\empty
+ \fi
+ \fi}
+
+\def\dodoloadbibtexpublicationalternative#1%
+ {\doonlyonce{#1}
+ {\readsysfile{bxml-#1.mkiv}
+ {\showmessage\m!publications{6}{bxml-#1}}
+ {\showmessage\m!publications{1}{bxml-#1}}}}
+
+\appendtoks
+ \doloadbibtexpublicationalternative
+\to \everysetupbibtexpublications
+
+\appendtoks
+ \doloadbibtexpublicationalternative
+\to \everyjob
+
+% whatever, should be key
+
+\def\bibtexleftnumber#1{#1\hfill~}
+
+% testing
+
+% \showmessage\m!publications{5}{#1 is unknown}\secondoftwoarguments}
+
+\let\doifbibreferencefoundelse\secondofthreearguments
+
+% lists
+
+\newtoks\everysetupbibtexlistplacement
+
+% this will change as we need it too often .. we will use context.thebibtexnamesep
+
+\appendtoks
+ \ctxlua {bibtex.authors.setsettings {
+ namesep = \!!bs\bibtexpublicationsparameter\c!namesep\!!es,
+ lastnamesep = \!!bs\bibtexpublicationsparameter\c!lastnamesep\!!es,
+ finalnamesep = \!!bs\bibtexpublicationsparameter\c!finalnamesep\!!es,
+ firstnamesep = \!!bs\bibtexpublicationsparameter\c!firstnamesep\!!es,
+ juniorsep = \!!bs\bibtexpublicationsparameter\c!juniorsep\!!es,
+ vonsep = \!!bs\bibtexpublicationsparameter\c!vonsep\!!es,
+ surnamesep = \!!bs\bibtexpublicationsparameter\c!surnamesep\!!es,
+ namesep = \!!bs\bibtexpublicationsparameter\c!namesep\!!es,
+ lastnamesep = \!!bs\bibtexpublicationsparameter\c!lastnamesep\!!es,
+ finalnamesep = \!!bs\bibtexpublicationsparameter\c!finalnamesep\!!es,
+ author = {
+ etallimit = \!!bs\bibtexpublicationsparameter\c!authoretallimit\!!es,
+ etaldisplay = \!!bs\bibtexpublicationsparameter\c!authoretaldisplay\!!es,
+ etaltext = \!!bs\bibtexpublicationsparameter\c!authoretaltext\!!es,
+ },
+ editor = {
+ etallimit = \!!bs\bibtexpublicationsparameter\c!editoretallimit\!!es,
+ etaldisplay = \!!bs\bibtexpublicationsparameter\c!editoretaldisplay\!!es,
+ etaltext = \!!bs\bibtexpublicationsparameter\c!editoretaltext\!!es,
+ },
+ artauthor = {
+ etallimit = \!!bs\bibtexpublicationsparameter\c!artauthoretallimit\!!es,
+ etaldisplay = \!!bs\bibtexpublicationsparameter\c!artauthoretaldisplay\!!es,
+ etaltext = \!!bs\bibtexpublicationsparameter\c!artauthoretaltext\!!es,
+ },
+ } }%
+\to \everysetupbibtexlistplacement
+
+\def\completebibtexpublications{\dodoubleempty\docompletebibtexpublications}
+\unexpanded\def\placebibtexpublications {\dodoubleempty\doplacebibtexpublications}
+
+\def\docompletebibtexpublications[#1][#2]% title might become obsolete, just headtext
+ {\begingroup
+ \edef\currentbibtexsession{#1}%
+ \let\currentlist\currentbibtexsession
+ \setuplist[\currentbibtexsession][\c!criterium=\v!previous,#2]
+ \doifelsenothing{\namedlistparameter\currentbibtexsession\c!title}
+ {\systemsuppliedchapter[\currentbibtexsession]{\headtext{\currentbibtexsession}}}
+ {\normalexpanded{\systemsuppliedchapter[\currentbibtexsession]{\namedlistparameter\currentbibtexsession\c!title}}}%
+ \dodoplacebibtexpublications}
+
+\def\doplacebibtexpublications[#1][#2]%
+ {\begingroup
+ \edef\currentbibtexsession{#1}%
+ \let\currentlist\currentbibtexsession
+ \setuplist[\currentbibtexsession][\c!criterium=\v!previous,#2]%
+ \dodoplacebibtexpublications}
+
+\def\dodoplacebibtexpublications
+ {\determinelistcharacteristics[\currentbibtexsession]%
+ \the\everysetupbibtexlistplacement
+ \forgetall
+ \typesetbibtexlist
+ \endgroup
+ \global\advance\bibtexblock\plusone}
+
+\setvalue{\??pb:\c!numbering:\v!short}#1% todo var s -> short tag
+ {\bibtexlistnumberbox{\bibtexpublicationsparameter\c!numbercommand{\bibtexgetshort\currentpublicationtag}}}
+
+\setvalue{\??pb:\c!numbering:\v!bib}#1% todo var n -> number
+ {\bibtexlistnumberbox{\bibtexpublicationsparameter\c!numbercommand{\bibtexgetnumber\currentpublicationtag}}}
+
+\setvalue{\??pb:\c!numbering:\s!unknown}#1%
+ {\bibtexlistnumberbox{\bibtexpublicationsparameter\c!numbercommand{#1}}}
+
+\def\@@pblimitednumber % name
+ {\csname\??pb:\c!numbering:%
+ \ifcsname\??pb:\c!numbering:\currentbibtexnumbering\endcsname
+ \currentbibtexnumbering
+ \else
+ \s!unknown
+ \fi
+ \endcsname}
+
+\appendtoks
+ \edef\currentbibtexnumbering{\bibtexpublicationsparameter\c!numbering}%
+ \ifx\currentbibtexnumbering\v!no
+ \setuplist[\currentbibtexsession][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented]%
+ \else
+ \setuplist[\currentbibtexsession][\c!numbercommand=\@@pblimitednumber]%
+ \fi
+\to \everysetupbibtexlistplacement
+
+\newdimen\bibtexnumberwidth
+
+\def\bibtexlistnumberbox{\hbox \ifcase\bibtexnumberwidth\else to \bibtexnumberwidth\fi}
+
+\appendtoks
+ \doifelse{\bibtexpublicationsparameter\c!autohang}\v!yes
+ {\ifx\currentbibtexnumbering\v!short
+ \setbox\scratchbox\hbox{\bibtexpublicationsparameter\c!numbercommand{\bibtexpublicationsparameter\c!samplesize}}%
+ \else
+ \setbox\scratchbox\hbox{\bibtexpublicationsparameter\c!numbercommand{\ctxlua{tex.write(structure.lists.size())}}}%
+ \fi
+ \bibtexnumberwidth\wd\scratchbox
+ \setuplist[\currentbibtexsession][\c!distance=\zeropoint]}
+ {\doifelsenothing{\bibtexpublicationsparameter\c!width}
+ {\bibtexnumberwidth\zeropoint}
+ {\bibtexnumberwidth\bibtexpublicationsparameter\c!width}}%
+ \setuplist[\currentbibtexsession][\c!width=\bibtexnumberwidth]%
+\to \everysetupbibtexlistplacement
+
+\appendtoks
+ \let\maybeyear\gobbleoneargument
+ \let\noopsort \gobbleoneargument
+\to \everysetupbibtexlistplacement
+
+\appendtoks
+ \doifelse{\bibtexpublicationsparameter\c!maybeyear}\v!off
+ {\let\maybeyear\gobbleoneargument}
+ {\let\maybeyear\firstofoneargument}%
+\to \everysetupbibtexlistplacement
+
+\appendtoks
+ \doifnot{\bibtexpublicationsparameter\c!option}\v!continue
+ {\global\bibtexcounter\zerocount}%
+\to \everysetupbibtexlistplacement
+
+\appendtoks
+ \edef\currentbibtexcriterium{\namedlistparameter\currentbibtexsession\c!criterium}%
+\to \everysetupbibtexlistplacement
+
+\def\typesetbibtexlist
+ {\dobeginoflist
+ \doif{\namedlistparameter\currentbibtexsession\c!criterium}\v!cite
+ {\setuplist[\currentbibtexsession][\c!criterium=\v!here]}%
+ \doifelse{\bibtexpublicationsparameter\c!method}\v!local
+ {\ctxlua{bibtex.hacks.reset(1)}}% function can take method
+ {\ctxlua{bibtex.hacks.reset(2)}}%
+ \placestructurelist
+ {\currentbibtexsession}
+ {\currentbibtexcriterium}
+ {\namedlistparameter\currentbibtexsession\c!number}%
+ \ctxlua{bibtex.hacks.flush("\bibtexpublicationsparameter\c!sorttype")}%
+ \doendoflist}
+
+\unexpanded\def\typesetbibtexpublication#1%
+ {\edef\currentbibtexsessiontag{#1}%
+ \ifx\currentbibtexsessiontag\empty
+ % can't really happen
+ \else\ifx\currentbibtexcriterium\v!all
+ \doplacepublicationindeed
+ \else
+ \ctxlua{bibtex.hacks.doifalreadyplaced("\currentbibtexsessiontag")}
+ \donothing
+ \dotypesetbibtexpublication
+ \fi\fi}
+
+\def\dotypesetbibtexpublication
+ {\doifbibreferencefoundelse\currentbibtexsessiontag
+ {\global\advance\bibtexcounter\plusone
+ \ctxlua{bibtex.hacks.registerplaced("\currentbibtexsessiontag")}%
+ \dodolistelement{\currentbibtexsession}{}{\number\bibtexcounter}{\thebibtexpublicationlistelement}{}{}}
+ {}} % invalid
+
+\def\thebibtexpublicationlistelement
+ {\strut
+ \expanded{\reference[\bibtexrefprefix\currentbibtexsessiontag]{\number\bibtexcounter}}%
+ \dotypesetabibtexpublication\currentbibtexsessiontag
+ \strut}
+
+\def\dotypesetabibtexpublication#1%
+ {\begingroup
+ \ignorespaces
+ \xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/command(bibtex:format)}%
+ \removeunwantedspaces
+% \ignorespaces
+% \bibalternative{\bibgetvart{#1}}%
+% \removeunwantedspaces
+ \endgroup}
+
+\def\doprocessbibtexentry#1{\typesetbibtexpublication{#1}}
+
+% citations
+
+\unexpanded\def\bibtexcitation[#1]%
+ {\edef\currentbibtexsession{#1}%
+ \strictdoifnextoptionalelse\dobibtexcitation\dobibtexref}
+
+\def\dobibtexref#1%
+ {\dodobibtexcitation[#1][]}
+
+\def\dobibtexcitation[#1]%
+ {\strictdoifnextoptionalelse{\dodobibtexcitation[#1]}{\dodobibtexcitation[#1][]}}
+
+\def\dodobibtexcitation[#1][#2]%
+ {\dontleavehmode
+ \begingroup
+ \doifelsenothing{#2}\secondargumentfalse\secondargumenttrue
+ \ifsecondargument
+ \dowhateverbibtexcitation{#1}{#2}%
+ \else
+ \donumberedbibtexcitation{#1}%
+ \fi
+ \endgroup}
+
+\def\dowhatevercitation#1#2%
+ {\processcommalist[#2]\dobibtexcitationindeed
+ \setupinteraction[\c!style=]% use flag instead
+ \doifassignmentelse{#1}
+ {\getparameters[\??pb\??pb][\c!alternative=,\c!extras=,#1]%
+ \edef\currentbibtexvariant{\@@pb@@pbalternative}%
+ \ifx\currentbibtexvariant\empty
+ \edef\currentbibtexvariant{\bibtexpublicationparameter\c!refcommand}%
+ \fi
+ \ifx\@@pb@@pbextras\empty
+ \setupcite[\currentbibtexvariant][#1]%
+ \else
+ \edef\@@pb@@pbextras{{\@@pb@@pbextras\ifdefined\@@pb@@pbright\@@pb@@pbright\else\bibtexpublicationparameter\c!right\fi}}%
+ \expanded{\setupcite[\currentbibtexvariant][#1,\c!right=\@@pb@@pbextras]}%
+ \fi}%
+ {\def\currentbibtexvariant{#1}}%
+ \getvalue{bibtex\currentbibtexvariant ref}[#2]}
+
+\def\donumberedbibtexcitation#1%
+ {\processcommalist[#1]\dobibtexcitationindeed
+ \setupinteraction[\c!style=]%
+ \edef\currentbibtexvariant{\bibtexcitationparameter\c!refcommand}%
+ \getvalue{bibtex\currentbibtexvariant ref}[#1]}
+
+\def\dobibtexcitationindeed#1%
+ {\iftrialtypesetting \else
+ \expanded{\writedatatolist[\currentbibtexsession][bibref=#1]}%
+ \fi}
+
+\def\nobibtexcitation[#1]%
+ {\processcommalist[#1]\dobibtexcitationindeed}
+
+\def\bibtexnumref[#1]%
+ {\dontleavehmode
+ \begingroup
+ \bibtexcitationparameter\v!left
+ \penalty\!!tenthousand
+ \ctxlua{bibtex.hacks.resolve("","\number\bibtexblock","#1")}%
+ \bibtexcitationparameter\v!right
+ \endgroup}
+
+\def\dowithbibtexnumrefconnector#1#2%
+ {\ifnum#1>\plusone
+ \ifnum#2>\plusone
+ \ifnum#2=#1\relax
+ \bibtexpublicationsparameter\c!lastpubsep
+ \else
+ \bibtexpublicationsparameter\c!pubsep
+ \fi
+ \fi
+ \fi}
+
+\def\dowithbibtexnumref#1#2#3#4#5% n, i, prefix block ref
+ {\dowithbibtexnumrefconnector{#1}{#2}%
+ \def\bibtexrefprefix{#4:}%
+ \inbiblink[#5]}
+
+\def\dowithbibtexnumrefrange#1#2#3#4#5#6#7% n, i, prefix block ref
+ {\dowithbibtexnumrefconnector{#1}{#2}%
+ \def\bibtexrefprefix{#4:}%
+ \inbiblink[#5]%
+ \endash
+ \def\bibtexrefprefix{#6:}%
+ \inbiblink[#7]}
+
+\def\nobibtexnumref#1%
+ {[#1]}
+
+% hm
+
+% \def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument}
+
+% \letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument
+% \letvalue{\??pb:\c!numbercommand:\v!no }\gobbleoneargument
+% \setvalue{\??pb:\c!numbercommand:\v!short}{\bibtexgetshort\currentpublicationtag\gobbleoneargument}
+% \setvalue{\??pb:\c!numbercommand:\v!bib }{\bibtexgetnumber\currentpublicationtag\gobbleoneargument}
+
+% \def\bibalternative#1{\csname\??pv\@@currentalternative#1\endcsname}
+
+% basic setup
+
+% parent -> publicationlist
+%
+% \setuplist
+% [\currentbibtexsession]
+% [\c!samplesize={AA99},
+% \c!alternative=a,
+% \c!interaction=,
+% \c!pagenumber=\v!no,
+% #1,
+% \c!command=]
+
+% \setuppublicationlist
+% [\c!title=,
+% \c!command=\dospecialbibinsert,
+% \c!maybeyear=\v!on]
+
+\setupbibtexpublications
+ [\c!monthconversion=,
+ \c!alternative=apa,
+ \c!method=\v!global,
+ \c!refcommand=num,
+ \c!numbercommand=\bibtexleftnumber]
+
+\setupbibtexcitations % command ?
+ [\c!refcommand=num]
+
+% helpers
+
+\def\doifbibtexinteractionelse
+ {\iflocation
+ \edef\temp{\bibtexcitationparameter\c!interaction}%
+ \ifx\temp\v!stop
+ \@EA@EA@EA\secondoftwoarguments
+ \else
+ \@EA@EA@EA\firstoftwoarguments
+ \fi
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
+% variants
+
+% todo: lastsep here
+
+\newconditional\firstbibtexrefsep
+
+\def\bibtexresetrefsep
+ {\settrue\firstbibtexrefsep}
+
+\def\bibtexinsertrefsep
+ {\ifconditional\firstbibtexrefsep
+ \setfalse\firstbibtexrefsep
+ \else
+ \bibtexcitationparameter\c!pubsep
+ \fi}
+
+\def\inbibtexlink#1#2%
+ {\doifreferencefoundelse{\bibtexrefprefix#1}
+ {\goto{#2}[\bibtexrefprefix#1]}
+ {!#1!\unknownreference{#1}}}
+
+\def\dobibtexgotolink#1#2%
+ {\doifreferencefoundelse{\bibtexrefprefix#1}
+ {\goto{#2}[\bibtexrefprefix#1]}
+ {!#1!\unknownreference{#1}}}
+
+\def\dobibattexlink#1#2%
+ {\doifreferencefoundelse{\bibtexrefprefix#1}
+ {\at{#2}[\bibtexrefprefix#1]}
+ {!#1!\unknownreference{#1}}}
+
+\def\dobibtexurllink#1#2%
+ {\expanded{\useURL[bibtex:url:#1][#2]}%
+ \doifbibtexinteractionelse
+ {\goto{\url[bibtex:url:#1]}[url(bibtex:url:#1)]}
+ {\url[bibtex:url:#1]}}
+
+% todo: style, color
+
+\unexpanded\def\bibtexdataref {\dodoubleargument\dobibtexdataref}
+\unexpanded\def\bibtextyperef {\dodoubleargument\dobibtextyperef}
+\unexpanded\def\bibtexkeyref {\dodoubleargument\dobibtexkeyref}
+\unexpanded\def\bibtexserialref {\dodoubleargument\dobibtexserialref}
+\unexpanded\def\bibtexurlref {\dodoubleargument\dobibtexurlref}
+\unexpanded\def\bibtexdoiref {\dodoubleargument\dobibtexdoiref}
+\unexpanded\def\bibtexpageref {\dodoubleargument\dobibtexpageref}
+\unexpanded\def\bibtexnoneref {\dodoubleargument\dobibtexnoneref}
+\unexpanded\def\bibtexshortref {\dodoubleargument\dobibtexshortref}
+\unexpanded\def\bibtexyearref {\dodoubleargument\dobibtexyearref}
+\unexpanded\def\bibtexauthorref {\dodoubleargument\dobibtexauthorref}
+\unexpanded\def\bibtexauthoryearref {\dodoubleargument\dobibtexauthoryearref}
+\unexpanded\def\bibtexauthoryearsref{\dodoubleargument\dobibtexauthoryearsref}
+
+\def\dobibtexdataref {\doprocessbibtexref\dodobibtexdataref {ref}} % [#1][#2]
+\def\dobibtextyperef {\doprocessbibtexref\dodobibtextyperef {type}} % [#1][#2]
+\def\dobibtexkeyref {\doprocessbibtexref\dodobibtexkeyref {key}} % [#1][#2]
+\def\dobibtexserialref {\doprocessbibtexref\dodobibtexserialref {serial}} % [#1][#2]
+\def\dobibtexurlref {\doprocessbibtexref\dodobibtexurlref {url}} % [#1][#2]
+\def\dobibtexdoiref {\doprocessbibtexref\dodobibtexdoiref {doi}} % [#1][#2]
+\def\dobibtexpageref {\doprocessbibtexref\dodobibtexpageref {page}} % [#1][#2]
+\def\dobibtexnoneref {\doprocessbibtexref\dodobibtexnoneref {none}} % [#1][#2]
+\def\dobibtexshortref {\doprocessbibtexref\dodobibtexshortref {short}} % [#1][#2]
+\def\dobibtexyearref {\doprocessbibtexref\dodobibtexyearref {year}} % [#1][#2]
+\def\dobibtexauthorref {\doprocessbibtexref\dodobibtexauthorref {author}} % [#1][#2]
+\def\dobibtexauthoryearref {\doprocessbibtexref\dodobibtexauthoryearref {authoryear}} % [#1][#2]
+\def\dobibtexauthoryearsref{\doprocessbibtexref\dodobibtexauthoryearsref{authoryears}} % [#1][#2]
+
+\def\doprocessbibtexref#1#2[#3][#4]%
+ {\edef\currentbibtexsession{#3}%
+ \edef\currentbibtexvariant{#2}%
+ \def\dodoprocessbibtexref##1%
+ {% test for existence
+ \edef\currentbibtextag{##1}%
+ \bibtexinsertrefsep
+ #1{##1}}%
+ \bibtexresetrefsep
+ \bibtexcitationparameter\v!left
+ \processcommalist[#4]\dodoprocessbibtexref\relax
+ \bibtexcitationparameter\v!right}
+
+\def\dodobibtexdataref#1%
+ {\dotypesetabibtexpublication{#1}}
+
+\def\dodobibtextyperef#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/attribute('category')}}%
+ \bibtexrefcontent}
+
+\def\dodobibtexkeyref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='key']/context()}}%
+ \dobibtexgotolink{#1}{\bibtexrefcontent}}
+
+\def\dodobibtexserialref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/match()}}%
+ \dobibtexgotolink{#1}{\bibtexrefcontent}}
+
+\def\dodobibtexurlref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/field[@name='url']/context()}}%
+ \dobibtexurllink{#1}{\bibtexrefcontent}}
+
+\def\dodobibtexdoiref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/field[@name='doi']/context()}}%
+ \dobibtexurllink{#1}{http://dx.doi.org/\bibtexrefcontent}}
+
+\def\dodobibtexpageref#1%
+ {\dobibtexatlink{#1}{}} % second argument can become 'page'
+
+\def\dodobibtexnoneref#1%
+ {}
+
+\def\dodobibtexshortref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/bibtexshort()}}%
+ \dobibtexgotolink{#1}{\bibtexrefcontent}}
+
+\def\dodobibtexyearref#1%
+ {\edef\bibtexrefcontent{\xmlfilter{bibtex:\currentbibtexsession}{/bibtex/entry[@tag='#1']/field[@name='year']/context()}}%
+ \bibtexrefcontent}
+
+% \def\bibmaybeinteractive#1#2%
+% {\doifelsevalue{@@pv\@@currentalternative\c!compress}
+% {\ifbibinteractionelse{\gotobiblink{#2}[#1]}{#2}}
+% {#2}}
+
+% \def\bibauthornumref[#1]%
+% {\getcommalistsize[#1]%
+% \global\bibitemcounter\commalistsize
+% \bibresetrefsep
+% \processcommalist[#1]\dobibauthornumref }
+%
+% \def\dobibauthornumref#1%
+% {\bibinsertrefsep
+% \doifbibreferencefoundelse{#1}
+% {\begingroup
+% \bibgetvara{#1}%
+% \bibalternative\c!inbetween
+% \setuppublications[\c!refcommand=num]%
+% \cite[#1]%
+% \endgroup}
+% {\unknownreference{#1}}}
+
+% compress years
+% andtext namesep
+% otherstext authoretallimit
+
+% we will use context.* instead at the lua end because it saves us passing settings
+
+% \def\thebibtexpubsep {\bibtexpublicationsparameter\c!pubsep}
+% \def\thebibtexlastpubsep {\bibtexpublicationsparameter\c!lastpubsep}
+% \def\thebibtexfinalpubseparator{\bibtexpublicationsparameter\c!lastpubsep}
+
+\def\dodobibtexauthorref #1{\ctxlua{bibtex.authorref ("bibtex:\currentbibtexsession","#1","normal","author")}}
+\def\dodobibtexauthoryearref #1{\ctxlua{bibtex.authoryearref ("bibtex:\currentbibtexsession","#1","normal","author")}}
+\def\dodobibtexauthoryearsref#1{\ctxlua{bibtex.authoryearsref("bibtex:\currentbibtexsession","#1","normal","author")}}
+
+\unexpanded\def\bibtexsingularplural#1#2{\ctxlua{bibtex.singular_or_plural(\!!bs#1\!!es,\!!bs#2\!!es)}}
+
\protect \endinput
+
diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.lua b/Master/texmf-dist/tex/context/base/bibl-tra.lua
new file mode 100644
index 00000000000..44223102859
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/bibl-tra.lua
@@ -0,0 +1,194 @@
+if not modules then modules = { } end modules ['bibl-bib'] = {
+ version = 1.001,
+ comment = "this module is the basis for the lxml-* ones",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+bibtex = bibtex or { }
+bibtex.hacks = bibtex.hacks or { }
+
+local match, gmatch, format, concat, sort = string.match, string.gmatch, string.format, table.concat, table.sort
+local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+local variables, constants = interfaces.variables, interfaces.constants
+
+local trace_bibtex = false trackers.register("publications.bibtex", function(v) trace_bibtex = v end)
+
+local hacks = bibtex.hacks
+
+local list, done, alldone, used, registered, ordered = { }, { }, { }, { }, { }, { }
+local mode = 0
+
+local template = string.striplong([[
+ \citation{*}
+ \bibstyle{cont-%s}
+ \bibdata{%s}
+]])
+
+function hacks.process(settings)
+ local style = settings.style or ""
+ local database = settings.database or ""
+ local jobname = tex.jobname
+ if database ~= "" then
+ interfaces.showmessage("publications",3)
+ io.savedata(file.addsuffix(jobname,"aux"),format(template,style,database))
+ if trace_bibtex then
+ logs.report("publications","processing bibtex file '%s'",jobname)
+ end
+ os.execute(format("bibtex %s",jobname))
+ -- purge 'm
+ end
+end
+
+function hacks.register(str)
+ if trace_bibtex then
+ logs.report("publications","registering bibtex entry '%s'",str)
+ end
+ registered[#registered+1] = str
+ ordered[str] = #registered
+end
+
+function hacks.reset(m)
+ mode, list, done = m, { }, { }
+end
+
+function hacks.add(str,listindex)
+ if not str or mode == 0 then
+ -- skip
+ elseif mode == 1 then
+ -- all locals but no duplicates
+ local sc = structure.sections.currentid()
+ if done[str] ~= sc then
+ done[str], alldone[str] = sc, true
+ list[#list+1] = { str, listindex }
+ end
+ elseif mode == 2 then
+ -- all locals but no preceding
+ local sc = structure.sections.currentid()
+ if not alldone[str] and done[str] ~= sc then
+ done[str], alldone[str] = sc, true
+ list[#list+1] = { str, listindex }
+ end
+ end
+end
+
+local function compare(a,b)
+ local aa, bb = a[1], b[1]
+ if aa and bb then
+ return ordered[aa] < ordered[bb]
+ else
+ return true
+ end
+end
+
+function hacks.flush(sortvariant)
+ if sortvariant == "" or sortvariant == variables.cite or sortvariant == "default" then
+ -- order is cite order i.e. same as list
+ else
+ sort(list,compare)
+ end
+ for i=1,#list do
+ context.doprocessbibtexentry(list[i][1])
+ end
+end
+
+function hacks.registerplaced(str)
+ used[str] = true
+end
+
+function hacks.doifalreadyplaced(str)
+ commands.testcase(used[str])
+end
+
+-- we ask for :tag but when we can't find it we go back
+-- to look for previous definitions, and when not found again
+-- we look forward
+
+local function compare(a,b)
+ return a[3] < b[3]
+end
+
+function hacks.resolve(prefix,block,reference) -- maybe already feed it split
+ local subset = jobreferences.collected[prefix or ""] or jobreferences.collected[""]
+ if subset then
+ local result, done = { }, { }
+ block = tonumber(block)
+ for rest in gmatch(reference,"([^,%s]+)") do
+ local blk, tag, found = block, nil, nil
+ if block then
+ tag = blk .. ":" .. rest
+ found = subset[tag]
+ if not found then
+ for i=block-1,1,-1 do
+ tag = i .. ":" .. rest
+ found = subset[tag]
+ if found then
+ blk = i
+ break
+ end
+ end
+ end
+ end
+ if not found then
+ blk = "*"
+ tag = blk .. ":" .. rest
+ found = subset[tag]
+ end
+ if found then
+ local current = found.entries and found.entries.text
+ if current and not done[current] then
+ result[#result+1] = { blk, rest, current }
+ done[current] = true
+ end
+ end
+ end
+ -- todo: ranges so the interface will change
+ sort(result,compare)
+ local first, last, firsti, lasti, firstr, lastr
+ local collected = { }
+ for i=1,#result do
+ local r = result[i]
+ local current = r[3]
+ if not first then
+ first, last, firsti, lasti, firstr, lastr = current, current, i, i, r, r
+ elseif current == last + 1 then
+ last, lasti, lastr = current, i, r
+ else
+ if last > first + 1 then
+ collected[#collected+1] = { firstr[1], firstr[2], lastr[1], lastr[2] }
+ else
+ collected[#collected+1] = { firstr[1], firstr[2] }
+ if last > first then
+ collected[#collected+1] = { lastr[1], lastr[2] }
+ end
+ end
+ first, last, firsti, lasti, firstr, lastr = current, current, i, i, r, r
+ end
+ end
+ if first then
+ if last > first + 1 then
+ collected[#collected+1] = { firstr[1], firstr[2], lastr[1], lastr[2] }
+ else
+ collected[#collected+1] = { firstr[1], firstr[2] }
+ if last > first then
+ collected[#collected+1] = { lastr[1], lastr[2] }
+ end
+ end
+ end
+ if #collected > 0 then
+ for i=1,#collected do
+ local c = collected[i]
+ if c[3] then
+ context.dowithbibtexnumrefrange(#collected,i,prefix,c[1],c[2],c[3],c[4])
+ else
+ context.dowithbibtexnumref(#collected,i,prefix,c[1],c[2])
+ end
+ end
+ else
+ context.nobibtexnumref("error 1")
+ end
+ else
+ context.nobibtexnumref("error 2")
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkii b/Master/texmf-dist/tex/context/base/bibl-tra.mkii
new file mode 100644
index 00000000000..087781db9b1
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkii
@@ -0,0 +1,1778 @@
+%D \module
+%D [ file=bibl-tra,
+%D version=2009.08.13,
+%D title=\CONTEXT\ Publication Module,
+%D subtitle=Publications,
+%D author=Taco Hoekwater,
+%D date=\currentdate,
+%D copyright=Public Domain]
+%C
+%C Donated to the public domain.
+
+%D This used to be module \type {t-bib} but due to the number of differences
+%D in handling structure between \MKII\ and \MKIV\ we now have \BIBTEX\ support
+%D in the kernel. The only patches concerns some namespace issues. Also,
+%D constants and variables are now predefined. When the \MKIV\ code is well
+%D tested I might backport a couple of adaptions to this \MKII\ variant.
+
+\writestatus{loading}{ConTeXt Bibliography Support / BibTeX}
+
+\definefilesynonym[bib][obsolete]
+
+% here starts t-bib.tex
+
+%D The original was developed independantly by Taco Hoekwater while still working for Kluwer
+%D Academic publishers (it still used the dutch interface then). Development continued after
+%D he left Kluwer, and in Januari 2005, the then already internationalized file was merged
+%D with the core distribution by Hans Hagen. The current version is once again by Taco.
+%D
+%D More documentation and additional resources can be found on the contextgarden:
+%D \hyphenatedurl{http://wiki.contextgarden.net//Bibliography}.
+
+%D \subject{DONE (dd/mm/yyyy)}
+%D
+%D \startitemize
+%D \item add author definition (and associated system variable) (26/05/2005)
+%D \item add finalnamesep support for Oxford comma (17/09/2005)
+%D \item add \type{\insert...} for: doi, eprint, howpublished (19/09/2005)
+%D \item allow a defaulted \type{\setupcite} (19/11/2005)
+%D \item renamed citation type 'number' to 'serial' (19/11/2005)
+%D \item better definition of \type{\inverted...author} (19/11/2005)
+%D \item don't reset [numbercommand] in \type {\setuppublication} by default (20/11/2005)
+%D \item don't disable other \type {\setuppublication} keys if alternative is present (20/11/2005)
+%D \item drop \type{\sanitizeaccents} (20/11/2005)
+%D \item added \type{\nocite} and \type{\cite[none]} (21/11/2005)
+%D \item added headtext for it (23/11/2005)
+%D \item make \type{\cite[url]} and \type{\cite[doi]} interactive (23/11/2005)
+%D \item make right-aligned labels in the list work even when autohang=no
+%D \item use 'et al.' instead of 'et.al.'. Pointed out by Peter M�nster (30/12/2005)
+%D \item added headtext for cz (31/12/2005)
+%D \item Keep whitespace after \type{\cite} with single argument (31/12/2005)
+%D \item Fix broken \type{\cite{}} support (31/12/2005)
+%D \item Use \type{\readfile} inside \type{\usepublications} instead of \type{\readsysfile} (12/01/2006)
+%D \item Use \type{\currentbibyear} and \type{\currentbibauthor} instead of \type{\YR} and \type{\AU} (05/02/2006)
+%D \item Fix compressed version of authoryear style (05/02/2006)
+%D \item Rename the clashing data fields \type{\url} and \type{\type} to \type{\biburl} and \type{\bibtype} (05/02/2006)
+%D \item Added two french bibl files from Renaud Aubin (06/02/2006)
+%D \item Five new bib class and eight extra bib fields, for IEEEtran (07/02/2006)
+%D \item French keyword translation, provided by Renaud (08/02/2006)
+%D \item fix underscores in undefined keys (22/02/2006)
+%D \item Destroy interactivity in labels of the publication list (13/03/2006)
+%D \item fix multi-cite list compression (11/4/2006)
+%D \item fix \type{\getcitedata} (11/4/2006)
+%D \item magic for chapter bibs (18-25/4/2006)
+%D \item language setting (25/4/2006)
+%D \item use \type{\hyphenatedurl} for \type{\inserturl} (25/4/2006)
+%D \item Add \type{\docitation} to \type{\nocite}(26/4/2006)
+%D \item patents can have numbers, added to bst files (26/4/2006)
+%D \item \type{\docitation} needs a \type{\iftrialtypesetting} (27/4/2006)
+%D \item \type{\filllocalpublist}'s loop is bound by definedness, not resolvedness (27/4/2006)
+%D \item \type{\setuppublications[monthconversion=]} added (15/5/2006)
+%D \item use \type{\undefinedreference} instead of bare question marks (15/5/2006)
+%D \item add grouping around \type{\placepublications} commands (16/5/2006)
+%D \item fix a bug in \type{\cite{- }} (17/5/2006)
+%D \item support \type{\cite[authornum]} (18/5/2006)
+%D \item make \type{\cite} unexpandable (20/6/2006)
+%D \item allow hyperlinks in author\&year combo's
+%D (cite list compression has to be off) (20/6/2006)
+%D \item fix duplicate labels for per-chapter style (20/6/2006)
+%D \item allow \type{\setupcite[interaction=(start|stop)]}
+%D \item fix the item number in the publication list with 'numbering=yes' (22/6/2006)
+%D \item make the default criterium for \type{\placepublications} be \type{previous} (23/6/2006)
+%D \item fix \type{\normalauthor} and \type{\normalshortauthor} spacing (29/6/2006)
+%D \item do not typeset empty arguments to \type{\typesetapublication} (29/6/2006)
+%D \item add \type{symbol=none} to \type{\setuplist} in unnumbered
+%D mode to prevent typesetting of bare numbers (29/6/2006)
+%D \item remove two incorrect spaces from bibl-num.tex (1/7/2006)
+%D \item reset font styles within \type{\cite}, so that font switches
+%D in \type{left} stay in effect (12/7/2006)
+%D \item guard added against loading bbl files multiple times (13/7/2006)
+%D \item fix \type{\cite[num]} with compression is on. (14/7/2006)
+%D \item test \type{\iflocation} before deciding to use the
+%D interactive version of cite (18/7/2006)
+%D \item support \type{\setupcite[authoretallimit=1]} (18/7/2006)
+%D \item support use of \type{\cite} within titles and captions by
+%D saveguarding the list item extraction and reference placement
+%D code (19/7/2006)
+%D \item support \type{\setuppublicationlist[title=\chapter]} (4/8/2006)
+%D \item use the expansion of \type{\headtext{pubs}} (4/8/2006)
+%D \item hook added for repeated authors in publication list
+%D \type{\setuppublicationlist[artauthorcommand=\mythreeargscommand]}
+%D (4/8/2006)
+%D \item make the bracketed arguments of \type{\artauthor}, \type{\author}
+%D and \type{\editor} (bbl commands) optional (4/8/2006)
+%D \item the constants \type{sorttype}, \type{compress} and
+%D \type{autohang} have moved to the core (8/8/2006)
+%D \item bibtex is now registered as a program to be run by texexec (8/8/2006)
+%D \item fix a bug in \type{\setupcite[authoretallimit=1]} (9/8/2006)
+%D \item fix a bug inside citations that prevented lastpubsep from ever being
+%D used due to a volatile \type{\commalistsize} (25/8/2006).
+%D \item added the possibility of \type{\placepublications[option=continue]}
+%D (6/9/2006)
+%D \item Mojca translated Master's Thesis to Masterarbeit (bibl-apa-de.tex)
+%D (12/9/2006)
+%D \item Added \type{\setuppublicationlist[maybeyear=off]} by request from
+%D Thomas Schmitz (15/9/2006)
+%D \item Removed some spurious spaces pointed out by willi egger (19/9/2006)
+%D \item Add configuration of bibtex executable name (4/11/2006)
+%D \item Fix numbering=short and numbering=bib (spotted by Matthias W�chter) (4/11/2006)
+%D \item third attempt to get a correct release (5/11/2006)
+%D \item fix a few missing dots in bibl-num.tex (7/12/2006)
+%D \item Patch for DOI's by Tobias Burnus (17/4/2007)
+%D \item Patch for \type{\insertbiburl} and \type{\insertdoi} for Tobias Burnus (18/4/2007)
+%D \item Added a missing \type{\relax} in \type{\dospecialbibinsert},
+%D that made the space before the {\it et al.} text disappear. (18/4/2007)
+%D \item Attempt to fix percent signs in bbl files. As a side-effect,
+%D this prohibits comments in \tex{startpublication} blocks! (17/4/2008)
+%D \item Patch from Matthias W\"achter that allows arbitrary .bst
+%D files to be used with \tex{setupbibtex} (25/9/2008)
+%D \item Extended for the new multilingual setups for the Oct 2008 current of ConTeXt (23/10/2008)
+%D \item Multilingual setups needed another fix (27/10/2008)
+%D \item Two fixes for bibl-apa by Michael Green (27/10/2008)
+%D \item Catalan translation of 'References' (10/11/2008)
+%D \item 'chapter' -> 'chapitre' in bibl-apa-fr (27/11/2008)
+%D \item Run bibtex via os.execute in mkiv modee (01/12/2008)
+%D \item Small correction in bibl-apa's placement of volume
+%D information in articles (05/01/2009)
+%D \item Handle multi-author (more than two) cases in \type{\cite}
+%D (02/03/2009)
+%D \item Suppress a syntax error in \type{cont-xp} mode. The output is
+%D probably not right, though (02/03/2009)
+%D \item Added a \tex{loadmarkfile} at the end, and two new files
+%D from Hans. The \type{t-bib.mkiv} is needed to make the module
+%D work with the new structure code (17/04/2009)
+%D \item Added a patch to \type{t-bib.mkiv} from Hans to make the
+%D cross referencing between multiple citations an
+%D bibliographies work (27/04/2009)
+%D \item Remove a superfluous \type{\unprotect} in t-bib.mkiv (11/05/2009).
+%D \item Patch of incollection in bibl-ams.tex from Xan (08/06/2009).
+%D \item Patch of unpublished in bibl-ams.tex from Xan (22/07/2009).
+%D \item Modified \type{\bibdogetupsometextprefix} so it works for undefined
+%D language labels, from Hans (13/08/2009).
+%D \item Removed some \MKIV\ hacks as well as some things that are in the
+%D core like variables, constants and messages (HH:22/08/2009).
+%D \item Added \type{bib} in front of \type {insert} macros and initialize
+%D then later on (HH:22/08/2009).
+%D \item Removed test for type {\currentlocationreference} plus associated
+%D code (HH:22/08/2009).
+%D \stopitemize
+%D
+%D \subject{WISHLIST}
+%D
+%D \startitemize
+%D \item link back from publication list to citation
+%D \item export \type {\citation{}}
+%D \item support mlbibtex
+%D \item don't load the whole lot, but filter entries instead
+%D \stopitemize
+
+\unprotect
+
+%D Variables, constants and messages are removed as they are now in the
+%D multilingual interface modules.
+
+\def\biblistname{pubs} % for compatibility
+
+%D how to load the references. There is some new stuff here
+%D to support Idris' (incorrect :-)) use of projects
+
+% \let\preloadbiblist\relax
+%
+% \ifx\currentcomponent\v!text
+% % single file
+% \edef\temp{\the\everystarttext}%
+% \ifx\temp\empty
+% % post-starttext
+% \def\preloadbiblist{\dousepublications\jobname }%
+% \else
+% % pre-starttext
+% \appendtoks \dousepublications\jobname \to \everystarttext
+% \fi
+% %
+% \else \ifx\currentcomponent\v!project
+% % a project file, have to set up the partial products!
+% \def\startproduct #1 %
+% {\doateverystarttext
+% \dousepublications{#1}%
+% \donextlevel\v!product\currentproduct
+% \doexecutefileonce\doexecutefileonce
+% \donotexecutefile\doexecutefile#1\\}%
+% %
+% \else \ifx\currentcomponent\v!product
+% % a product file
+% \def\preloadbiblist{\dousepublications\jobname }%
+% %
+% \else
+% % a component? not sure what to do
+% \def\preloadbiblist{\dousepublications\jobname }%
+% %
+% \fi \fi \fi
+
+\def\preloadbiblist
+ {\globallet\preloadbiblist\relax
+ \dousepublications\jobname}
+
+\definelist[pubs]
+\setuplist[pubs][\c!width=]
+
+%D \macros{bibdoif,bibdoifnot,bibdoifelse}
+%D
+%D Here are a few small helpers that are used a lot
+%D in all the typesetting commands
+%D (\type{\insert...}) we will encounter later.
+
+\long\def\bibdoifelse#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\long\def\bibdoifnot#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\bibdoif#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+%D Bibtex settings separated out
+
+%D No point in writing the aux file if there is no database...
+
+\def\setupbibtex{\dosingleempty\dosetupbibtex}
+
+\def\dosetupbibtex[#1]%
+ {\let\@@pbdatabase\empty
+ \getparameters[\??pb][\c!sort=\s!default,#1]%
+ \expanded{\processaction[\@@pbsort]}
+ [ \v!no=>\def\bibstyle{cont-no},
+ \v!author=>\def\bibstyle{cont-au},
+ \v!title=>\def\bibstyle{cont-ti},
+ \v!short=>\def\bibstyle{cont-ab},
+ \s!default=>\def\bibstyle{cont-no},
+ \s!unknown=>\def\bibstyle{\@@pbsort}]%
+ \ifx\@@pbdatabase\empty\else \writeauxfile \fi}
+
+\dosetupbibtex[bibtex=bibtex]
+
+%D \macros{writeauxfile}
+%D
+%D Unfortunately, \BIBTEX\ is not the best configurable program
+%D around. The names of the commands it parses as well as the \type{.aux}
+%D extension to the file name are both hardwired.
+%D
+%D This means \CONTEXT\ has to write a \LATEX-style auxiliary file, yuk!
+%D The good news is that it can be rather short. We'll just ask
+%D \BIBTEX\ to output the entire database(s) into the \type{bbl} file.
+%D
+%D The \type{\bibstyle} command controls how the \type{bbl} file will
+%D be sorted. The possibilities are:
+%D
+%D \startitemize[packed]
+%D \item by author (+year, title): cont-au.bst
+%D \item by title (+author, year): cont-ti.bst
+%D \item by short key as in abbrev.bst: cont-ab.bst
+%D \item not sorted at all: cont-no.bst
+%D \stopitemize
+
+\def\writeauxfile
+ {\doifmode{*\v!first}
+ {\openout \scratchwrite \jobname.aux
+ \write \scratchwrite {\string\citation{*}}%
+ \write \scratchwrite {\string\bibstyle{\bibstyle}}%
+ \write \scratchwrite {\string\bibdata{\@@pbdatabase}}%
+ \closeout\scratchwrite
+ \showmessage\m!publications{3}{}%
+ \expanded{\installprogram{\@@pbbibtex\space\jobname}}}}
+
+%D \macros{ifsortbycite,iftypesetall,ifautohang,ifbibcitecompress}
+%D
+%D The module needs some new \type{\if} statements.
+
+%D Default sort order of the reference list is by citation.
+
+\newif\ifsortbycite \sortbycitetrue
+
+%D By default, only referenced publications are typeset
+
+\newif\iftypesetall \typesetallfalse
+
+%D Hanging indentation of the publication list
+%D will not adjust itself according to the width of the label.
+
+\newif\ifautohang \autohangfalse
+
+%D Cite lists are compressed, if possible.
+
+\newif\ifbibcitecompress \bibcitecompresstrue
+
+\def\setuppublications
+ {\dosingleargument\dosetuppublications}
+
+\def\bibleftnumber#1%
+ {#1\hfill~}
+
+\def\dosetuppublications[#1]%
+ {\getparameters
+ [\??pb]
+ [\c!alternative=,#1]%
+ \doifsomething\@@pbalternative
+ {\readsysfile
+ {bibl-\@@pbalternative.tex}
+ {\showmessage\m!publications{6}{bibl-\@@pbalternative}\let\@@pbalternative\empty}
+ {\showmessage\m!publications{1}{bibl-\@@pbalternative}\let\@@pbalternative\empty}}%
+ \getparameters
+ [\??pb]
+ [#1]%
+ \processaction
+ [\@@pbcriterium]
+ [ \v!all=>\typesetalltrue,
+ \s!unknown=>\typesetallfalse]%
+ \processaction
+ [\@@pbautohang]
+ [ \v!yes=>\autohangtrue,
+ \s!unknown=>\autohangfalse]%
+ \processaction
+ [\@@pbsorttype]
+ [ \v!cite=>\sortbycitetrue,
+ \v!bbl=>\sortbycitefalse,
+ \s!default=>\sortbycitetrue,
+ \s!unknown=>\sortbycitefalse]%
+ \processaction
+ [\@@pbnumbering]
+ [ \v!yes=>\let\@@pbinumbercommand\firstofoneargument,
+ \v!no=>\let\@@pbinumbercommand\gobbleoneargument,
+ \v!short=>\def\@@pbinumbercommand##1{\getvalue{pbds-\@@pbk}},
+ \v!bib=>\def\@@pbinumbercommand##1{\getvalue{pbdn-\@@pbk}},
+ \s!unknown=>\let\@@pbinumbercommand\firstofoneargument]%
+ \processaction
+ [\@@pbrefcommand]
+ [\s!default=>\edef\@@citedefault{\@@pbrefcommand},
+ \s!unknown=>\edef\@@citedefault{\@@pbrefcommand}]}
+
+% initialize
+
+\def\@@pbrefcommand{num}
+\def\@@pbnumbercommand{\bibleftnumber}
+
+%D \macros{usepublications}
+%D
+%D We need \type{\usereferences} so that it is possible to
+%D refer to page and/or appearance number for publications
+%D in the other document.
+
+\def\usepublications[#1]%
+ {\usereferences[#1]\processcommalist[#1]\dousepublications}
+
+\def\dousepublications#1%
+ {\doonlyonce
+ {#1.\f!bibextension}
+ {\readfile{#1.\f!bibextension}
+ {\showmessage\m!publications{4}{#1.\f!bibextension}}
+ {\showmessage\m!publications{2}{#1.\f!bibextension}}}}
+
+%D \macros{setuppublicationlist}
+%D
+%D This will be the first command in (\BIBTEX-generated) \type{bbl}
+%D files. `samplesize' is a sample value (in case of \BIBTEX-generated
+%D files, this will be the longest `short' key). `totalnumber'
+%D is the total number of entries that will follow in this
+%D file.
+
+%D Both values are only needed for the label calculation
+%D if `autohang' is `true', so by default the command is
+%D not even needed, and therefore I saw no need to give
+%D it it's own system variable and it just re-uses \type{pb}.
+
+\def\setuppublicationlist
+ {\dosingleempty\dosetuppublicationlist}
+
+\def\dosetuppublicationlist[#1]%
+ {\getparameters[\??pv data][#1]%
+ \setuplist
+ [pubs]
+ [\c!samplesize={AA99},\c!totalnumber={99},
+ \c!alternative=a,\c!interaction=,\c!pagenumber=\v!no,#1]}
+
+\def\setuppublicationlayout[#1]#2%
+ {\setvalue{\??pv data#1}{#2\unskip}}
+
+%D \macros{bibalternative}
+%D
+%D A nice little shorthand that will be used so we don't have to
+%D key in the weird \type{\@@pv} parameter names all the time.
+
+\def\bibalternative#1%
+ {\getvalue{\??pv\@@currentalternative#1}}
+
+%D \macros{simplebibdef,bibcommandlist}
+%D
+%D \type{\simplebibdef} defines \type{bib@#1}, which in turn will
+%D use one argument that is stored in \type{@@pb@#1}.
+%D
+%D \type{\simplebibdef} also defines \type{insert#1}, which can be
+%D used in the argument of \type{\setuppublicationlayout} to fetch
+%D one of the \type{@@pb@} data entries. \type{insert#1} then has
+%D three arguments: \type{#1} are commands to be executed before the
+%D data, \type{#2} are commands to be executed after the data, and
+%D \type{#3} are commands to be executed if the data is not found.
+
+%D \type{\bibcommandlist} is the list of commands that is affected
+%D by this approach. Later on, it will be used to do a series
+%D of assignments from \type{#1} to \type{bib@#1}: e.g
+%D \type{\title} becomes \type{\bib@title} when used within
+%D a publication.
+
+\newtoks\initializebibdefinitions % we need to prevent clashes (HH)
+
+% \def\simplebibdef#1% hh: funny expansion ?
+% {\@EA\long\@EA\def\csname bib@#1\endcsname##1%
+% {\setvalue{\??pb @#1}{##1}%
+% \ignorespaces}%
+% \@EA\def\csname insert#1\endcsname##1##2##3%
+% {\@EA\bibdoifelse
+% \@EA{\csname @@pb@#1\endcsname}%
+% {##1\csname @@pb@#1\endcsname##2}%
+% {##3}%
+% }}
+
+\def\simplebibdef#1% hh: funny expansion ?
+ {\@EA\long\@EA\def\csname bib@#1\endcsname##1%
+ {\setvalue{\??pb @#1}{##1}\ignorespaces}%
+ \expandafter \appendtoks
+ \expandafter\let\csname insert#1\expandafter\endcsname\csname bibinsert#1\endcsname
+ \to \initializebibdefinitions
+ \@EA\unexpanded\@EA\def\csname bibinsert#1\endcsname##1##2##3%
+ {\@EA\bibdoifelse\@EA{\csname\??pb @#1\endcsname}{##1\csname\??pb @#1\endcsname##2}{##3}}}
+
+\def\bibcommandlist
+ {abstract, annotate, arttitle, assignee, bibnumber, bibtype, biburl, chapter, city,
+ comment, country, day, dayfiled, doi, edition, eprint, howpublished, isbn, issn,
+ issue, journal, keyword, keywords, lastchecked, month, monthfiled, names, nationality,
+ note, notes, organization, pages, pubname, pubyear, revision, series, size, thekey,
+ title, volume, yearfiled}
+
+\processcommacommand[\bibcommandlist]\simplebibdef
+
+\def\bibinsertdoi#1#2#3%
+ {{\bibdoifelse{\@@pb@doi}%
+ {\edef\ascii{\@EA\detokenize\@EA{\@@pb@doi}}%
+ #1\expanded{\gotoDOI{\@@pb@thekey}{\ascii}}#2}{#3}}}
+
+\def\bibinsertbiburl#1#2#3%
+ {{\bibdoifelse{\@@pb@biburl}%
+ {\edef\ascii{\@EA\detokenize\@EA{\@@pb@biburl}}%
+ #1\expanded{\gotoURL{\@@pb@thekey}{\ascii}}#2}{#3}}}
+
+\def\bibinsertmonth#1#2#3%
+ {\bibdoifelse{\@@pb@month}%
+ {#1\doifnumberelse{\@@pb@month}%
+ {\doifconversiondefinedelse\@@pbmonthconversion
+ {\convertnumber\@@pbmonthconversion{\@@pb@month}}{\@@pb@month}}%
+ {\@@pb@month}#2}{#3}}
+
+\appendtoks
+ \let\inserturl \bibinsertbiburl % for backward compat.
+ \let\inserttype\bibinsertbibtype % for backward compat.
+\to\initializebibdefinitions
+
+\def\newbibfield[#1]%
+ {\simplebibdef{#1}%
+ \edef\bibcommandlist{\bibcommandlist,#1}}
+
+%D \macros{bib@crossref}
+%D
+%D \type{\crossref} is used in database files to point to another
+%D entry. Because of this special situation, it has to be defined
+%D separately. Since this command will not be seen until at
+%D \type{\placepublications}, it may force extra runs. The same is
+%D true for \type{\cite} commands inside of publications.
+
+\def\bib@crossref#1%
+ {\setvalue{\??pb @crossref}{#1}\ignorespaces}
+
+\def\bibinsertcrossref#1#2#3%
+ {\bibdoifelse{\@@pb@crossref}
+ {#1\@EA\cite\@EA[\@@pb@crossref]#2}
+ {#3}}
+
+\appendtoks\let\insertcrossref\bibinsertcrossref\to\initializebibdefinitions
+
+%D \macros{complexbibdef,specialbibinsert}
+%D
+%D The commands \type{\artauthor}, \type{\author} and
+%D \type{\editor} are more complex than the other commands.
+%D Their argument lists have this form:
+%D
+%D \type{\author[junior]{firstnames}[inits]{von}{surname}}
+%D
+%D (bracketed stuff is optional)
+%D
+%D And not only that, but there also might be more than one of each of
+%D these commands. This is why a special command is needed to insert
+%D them, as well as one extra counter for each command.
+
+%D All of these \type{\@EA}'s and \type{\csnames} make this code
+%D look far more complex than it really is. For example, the argument
+%D \type{author} defines the macro \type{\bib@author} to do two
+%D things: increment the counter \type{\author@num} (let's say to 2)
+%D and next store it's arguments in the macro \type{\@@pb@author2}.
+%D And it defines \type{\insertauthors} to expand into
+%D \starttyping
+%D \specialbibinsert{author}{\author@num}{}{}{}
+%D \stoptyping
+
+\def\docomplexbibdef#1%
+ {\def\currentype{#1}%
+ \dosingleempty\dodocomplexbibdef}
+
+\def\dodocomplexbibdef[#1]#2%
+ {\def\firstarg{#1}\def\secondarg{#2}%
+ \dosingleempty\dododocomplexbibdef}
+
+\def\dododocomplexbibdef[#1]#2#3%
+ {\@EA\increment\csname \currentype @num\endcsname
+ \setevalue{\??pb @\currentype\csname \currentype @num\endcsname}%
+ {{\secondarg}{#2}{#3}{#1}{\firstarg}}\ignorespaces}%
+
+% \def\complexbibdef#1%
+% {\@EA\newcounter\csname #1@num\endcsname
+% \@EA\def\csname bib@#1\endcsname{\docomplexbibdef{#1}}%
+% \@EA\def\csname insert#1s\endcsname##1##2##3%
+% {\specialbibinsert{#1}{\csname #1@num\endcsname}{##1}{\unskip ##2}{##3}}}
+
+\def\complexbibdef#1%
+ {\@EA\newcounter\csname #1@num\endcsname
+ \@EA\def\csname bib@#1\endcsname{\docomplexbibdef{#1}}%
+ \expandafter \appendtoks
+ \expandafter\let\csname insert#1s\expandafter\endcsname\csname bibinsert#1s\endcsname
+ \to \initializebibdefinitions
+ \@EA\def\csname bibinsert#1s\endcsname##1##2##3{\specialbibinsert{#1}{\csname #1@num\endcsname}{##1}{\unskip ##2}{##3}}}
+
+\processcommalist[author,artauthor,editor]\complexbibdef
+
+%D Another level of indirection is needed to control the
+%D typesetting of all of these arguments.
+
+%D Btw, there is a conflict between `author' and the predefined interface
+%D variable `auteur'. The old version is overruled `auteur' is
+%D overruled by the systemconstant definition at the top of this file!
+
+\newcount\etallimitcounter
+\newcount\etaldisplaycounter
+\newcount\todocounter
+
+\def\specialbibinsert#1#2#3#4#5%
+ {\bgroup
+ \ifnum#2>\zerocount
+ \etallimitcounter =0\bibalternative{#1etallimit}\relax
+ \etaldisplaycounter=0\bibalternative{#1etaldisplay}\relax
+ \ifnum #2>\etallimitcounter
+ \todocounter\etaldisplaycounter
+ % just in case ...
+ \ifnum\todocounter>\etallimitcounter
+ \todocounter\etallimitcounter
+ \fi
+ \else
+ \todocounter#2\relax
+ \fi
+ \ifnum\todocounter>\zerocount
+ % find the current author list
+ \let\templist\empty
+ \dorecurse{#2}
+ {\toks0=\@EA\@EA\@EA{\csname @@pb@#1\recurselevel\endcsname}%
+ \ifx\templist\empty \edef\templist{\the\toks0}%
+ \else \edef\templist{\templist,\the\toks0}\fi }%
+ \doifdefinedelse
+ {\??pv data#1\c!command}
+ {\doifemptyelsevalue
+ {\??pv data#1\c!command}
+ {#3\dospecialbibinsert{#1}{\todocounter}{\templist}#4}%
+ {#3\getvalue{\??pv data#1\c!command}{#1}{\todocounter}{\templist}#4}}%
+ {#3\dospecialbibinsert{#1}{\todocounter}{\templist}#4}%
+ \else
+ #5%
+ \fi
+ \else
+ #5%
+ \fi
+ \egroup}
+
+%D This macro does the hard work of inserting a list of people in the
+%D output, with proper regard of all the inbetween strings that can
+%D arise depending on length of the list of people.
+
+%D \#1 = type
+%D \#2 = number of items to be typeset
+%D \#3 = commacommand containing authors
+
+\def\dospecialbibinsert#1#2#3%
+ {\getcommacommandsize[#3]%
+ \scratchcounter 0
+ \def\processauthoritem##1%
+ {\advance\scratchcounter1
+ \ifnum \numexpr\scratchcounter-1\relax<#2\relax
+ \getvalue{\??pv data#1}##1%
+ \ifnum \scratchcounter=#2\relax
+ \ifnum\etallimitcounter<\commalistsize\relax \bibalternative{#1etaltext}\fi
+ \else \ifnum\numexpr\scratchcounter+1 = #2\relax
+ \ifnum \commalistsize > \plustwo \bibalternative\c!finalnamesep
+ \else \bibalternative\c!lastnamesep \fi
+ \else
+ \bibalternative\c!namesep
+ \fi \fi
+ \fi}%
+ \processcommacommand[#3]\processauthoritem }
+
+%D \macros{invertedauthor,normalauthor,invertedshortauthor,normalshortauthor}
+%D
+%D Just some commands that can be used in \type{\setuppublicationparameters}
+%D If you want to write an extension to the styles, you might
+%D as well define some of these commands yourself.
+%D
+%D The argument liust has been reordered here, and the meanings
+%D are:
+%D
+%D {\obeylines\parskip0pt
+%D \type{#1} firstnames
+%D \type{#2} von
+%D \type{#3} surname
+%D \type{#4} inits
+%D \type{#5} junior
+%D }
+%D
+
+\def\normalauthor#1#2#3#4#5%
+ {\bibdoif{#1}{#1\bibalternative\c!firstnamesep}%
+ \bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}}
+
+\def\normalshortauthor#1#2#3#4#5%
+ {\bibdoif{#4}{#4\bibalternative\c!firstnamesep}%
+ \bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}}
+
+\def\invertedauthor#1#2#3#4#5%
+ {\bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!juniorsep #5}%
+ \bibdoif{#1}{\bibalternative\c!surnamesep #1\unskip}}
+
+\def\invertedshortauthor#1#2#3#4#5%
+ {\bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!juniorsep #5}%
+ \bibdoif{#4}{\bibalternative\c!surnamesep #4\unskip}}
+
+%D \macros{clearbibitem,clearbibitemtwo,bibitemdefs}
+%D
+%D These are used in \type{\typesetapublication} to do
+%D initializations and cleanups.
+
+\def\clearbibitem#1{\setvalue{\??pb @#1}{}}%
+
+\def\clearbibitemtwo#1%
+ {\letvalue{#1@num}\!!zerocount
+ \scratchcounter\plusone
+ \doloop
+ {\doifdefinedelse{\??pb @#1\the\scratchcounter}
+ {\letvalue{\??pb @#1\the\scratchcounter}\empty
+ \advance\scratchcounter\plusone}%
+ {\exitloop}}}
+
+\def\bibitemdefs#1%
+ {\@EA\let\@EA\tempa \csname bib@#1\endcsname
+ \@EA\let\csname #1\endcsname \tempa }
+
+%D \macros{startpublication}
+%D
+%D We are coming to the end of this module, to the macros that
+%D do typesetting and read the \type{bbl} file.
+
+\newcounter\bibcounter
+
+%D Just a \type{\dosingleempty} is the most friendly
+%D of doing this: there need not even be an argument
+%D to \type{\startpublication}. Of course, then there
+%D is no key either, and it had better be an
+%D article (otherwise the layout will be all screwed up).
+%D
+%D Now prohibits comments, so % can be used for urls
+
+\def\startpublication
+ {\edef\bibmodsavedpercent{\the\catcode`\%}%
+ \catcode`\%=12
+ \dosingleempty\dostartpublication}
+
+\def\stoppublication
+ {} % the \catcode of % is reset below
+
+%D Only specifying the key in the argument is also
+%D legal. In storing this stuff into macros, some trickery with
+%D token registers is needed to fix the expansion problems. Even so,
+%D this appears to not always be 100\% safe, so people are
+%D urgently advised to use \ETEX\ instead of traditional \TEX.
+%D
+%D In \ETEX, all expansion problems are conviniently solved by
+%D the primitive \type{\protected}. To put that another way:
+%D
+%D It's not a bug in this module if it does not appear in \ETEX!
+
+\long\def\dostartpublication[#1]#2\stoppublication%
+ {\increment\bibcounter
+ \bgroup
+ \doifassignmentelse{#1}%
+ {\getparameters[\??pb][k=,t=article,n=,s=,a=,y=,o=,u=,#1]}%
+ {\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}%
+ \@EA\toks\@EA2\@EA{\@@pba}%
+ \@EA\toks\@EA4\@EA{\@@pbs}%
+ \toks0={\ignorespaces #2}%
+ \setxvalue{pbdk-\@@pbk}{\@@pbk}
+ \setxvalue{pbda-\@@pbk}{\the\toks2}
+ \setxvalue{pbdy-\@@pbk}{\@@pby}
+ \setxvalue{pbds-\@@pbk}{\the\toks4}
+ \setxvalue{pbdn-\@@pbk}{\@@pbn}
+ \setxvalue{pbdt-\@@pbk}{\@@pbt}
+ \setxvalue{pbdo-\@@pbk}{\@@pbo}
+ \setxvalue{pbdu-\@@pbk}{\@@pbu}
+ \setxvalue{pbdd-\@@pbk}{\the\toks0}
+ \xdef\allrefs{\allrefs,\@@pbk}%
+ \egroup
+ \catcode`\%=\bibmodsavedpercent\relax }
+
+% intialization of the order-list:
+
+\let\allrefs\empty
+
+%D The next macro is needed because the number command of the
+%D publist sometimes needs to fetch something from the current
+%D item (like the 'short' key). For this, the ID of the current
+%D item is passed in the implict parameter \type{\@@pbk}
+
+\def\makepbkvalue#1{\def\@@pbk{#1}}
+
+\newif\ifinpublist
+
+% from Hans
+
+\def\ignoresectionconversion
+ {\let\@@sectionconversion\secondoftwoarguments}
+
+\let\normaldosetfilterlevel\dosetfilterlevel
+
+\def\patcheddosetfilterlevel#1#2% beware: this one is \let
+ {\bgroup
+ \ignoresectionconversion
+ \edef\askedlevel{#1}%
+ \edef\askedfilter{#2}%
+% \message{ASKD: \meaning\askedlevel}%
+% \message{PREV: \meaning\v!previous}%
+ \ifx\askedlevel\v!current
+ \dosetcurrentlevel\askedlevel
+ \else\ifx\askedlevel\v!previous
+ \dosetpreviouslevel\askedlevel
+ \else\ifx\askedlevel\v!all
+ \global\chardef\alltoclevels\plusone
+ \else\ifx\askedlevel\v!text
+ \global\chardef\alltoclevels\plusone
+ \else
+ \edef\byaskedlevel{\csname\??by\askedlevel\endcsname}%
+ \ifx\byaskedlevel\v!text
+ \dosettextlevel\askedlevel
+ \else
+ \dosetotherlevel\askedlevel
+ \fi
+ \fi\fi\fi\fi
+ % experiment
+ \ifx\askedfilter\empty \else
+ \xdef\currentlevel{\currentlevel\sectionseparator\askedfilter}%
+ \fi
+ \egroup}
+
+\def\filllocalpublist%
+ {\doifdefinedelse{\alltoclevels}
+ {\let\dosetfilterlevel\patcheddosetfilterlevel
+ \dosettoclevel\??li{pubs}%
+ \let\dosetfilterlevel\normaldosetfilterlevel }%
+ {\dosettoclevel\??li{pubs}}%
+ \global\let\glocalpublist\empty
+ \doloop
+ {\doifdefinedelse
+ {\r!cross cite-\jobname-\recurselevel}
+ {\doifreferencefoundelse
+ {cite-\jobname-\recurselevel}
+ {\@EA\doifreglevelelse\@EA[\currentlocationreference]
+ {\@EA\doglobal\@EA\addtocommalist\@EA
+ {\currenttextreference}\glocalpublist}{}}
+ {}}%
+ {\exitloop}}%
+ \let\localpublist\glocalpublist}
+
+\def\typesetpubslist
+ {\dobeginoflist
+% \the\initializebibdefinitions
+ \edef\askedlevel{\csname \??li pubs\c!criterium\endcsname}%
+ \ifx\askedlevel\v!all
+ \def\bibrefprefix{}%
+ \else %
+ \preparebibrefprefix
+ \fi
+ \ifsortbycite
+ \filllocalpublist
+ \iftypesetall
+ \let\localallrefs\allrefs
+ \processcommacommand[\localpublist]\typesetapublication
+ \def\removefromallrefs##1%
+ {\removefromcommalist{##1}\localallrefs }%
+ \processcommacommand[\localpublist]\removefromallrefs
+ \processcommacommand[\localallrefs]\typesetapublication
+ \else
+ \processcommacommand[\localpublist]\typesetapublication
+ \fi
+ \else
+ \iftypesetall
+ \processcommacommand[\allrefs]\typesetapublication
+ \else
+ %
+ \filllocalpublist
+ \processcommacommand[\allrefs]\maybetypesetapublication
+ \fi
+ \fi
+ \doendoflist}
+
+\newif\ifinpublist
+
+\def\maybetypesetapublication#1%
+ {\global\inpublistfalse
+ \def\test{#1}%
+ \def\runtest##1%
+ {\def\tempa{##1}\ifx \test\tempa \global\inpublisttrue \fi}%
+ \processcommacommand[\localpublist]\runtest
+ \ifinpublist \typesetapublication{#1}\fi}
+
+\def\initializepubslist
+ {\edef\@@pbnumbering{\@@pbnumbering}%
+ \ifautohang
+ \ifx\@@pbnumbering\v!short
+ \setbox\scratchbox\hbox{\@@pbnumbercommand{\getvalue{\??li pubs\c!samplesize}}}%
+ \else\iftypesetall
+ \setbox\scratchbox\hbox{\@@pbnumbercommand{\getvalue{\??li pubs\c!totalnumber}}}%
+ \else
+ \setbox\scratchbox\hbox{\@@pbnumbercommand{\numreferred}}%
+ \fi\fi
+ \edef\samplewidth{\the\wd\scratchbox}%
+ \setuplist[pubs][\c!width=\samplewidth,\c!distance=0pt]%
+ \ifx\@@pbnumbering\v!short
+ \def\@@pblimitednumber##1{\hbox to \samplewidth
+ {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}%
+ \else \ifx \@@pbnumbering\v!bib
+ \def\@@pblimitednumber##1{\hbox to \samplewidth
+ {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}%
+ \else
+ \def\@@pblimitednumber##1{\hbox to \samplewidth{\@@pbnumbercommand{##1}}}%
+ \fi \fi
+ \else
+ \ifx\@@pbnumbering\v!short
+ \doifemptyelse
+ {\getvalue{\??li pubs\c!width}}
+ {\def\@@pblimitednumber##1{\hbox
+ {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}}%
+ {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}%
+ {\@@pbnumbercommand{\getvalue{pbds-\@@pbk}}}}}%
+ \else \ifx \@@pbnumbering\v!bib
+ \doifemptyelse
+ {\getvalue{\??li pubs\c!width}}
+ {\def\@@pblimitednumber##1{\hbox
+ {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}}%
+ {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}%
+ {\@@pbnumbercommand{\getvalue{pbdn-\@@pbk}}}}}%
+ \else
+ \doifemptyelse
+ {\getvalue{\??li pubs\c!width}}
+ {\def\@@pblimitednumber##1{\hbox{\@@pbnumbercommand{##1}}}}%
+ {\def\@@pblimitednumber##1{\hbox to \getvalue{\??li pubs\c!width}{\@@pbnumbercommand{##1}}}}%
+ \fi
+ \fi
+ \fi
+ \ifx\@@pbnumbering\v!no
+ \setuplist[pubs][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented]%
+ \else
+ \setuplist[pubs][\c!numbercommand=\@@pblimitednumber]%
+ \fi
+ \doifelsevalue
+ {\??pv data\c!maybeyear}{\v!off}{\def\maybeyear##1{}}{\def\maybeyear##1{##1}}%
+ \forgetall} % bugfix 2005/03/18
+
+\def\outdented#1% move to supp-box ?
+ {\hskip -\hangindent #1}
+
+%D The full list of publications
+
+\def\completepublications
+ {\dosingleempty\docompletepublications}
+
+\def\bibdogetupsometextprefix#1#2#3%
+ {\ifcsname#2#1#3\endcsname
+ \csname#2#1#3\endcsname
+ \else\ifcsname\??la#1\c!default\endcsname
+ \@EA\ifx\csname\??la#1\c!default\endcsname\empty
+ \ifcsname#2#3\endcsname
+ \csname#2#3\endcsname
+ \else\ifcsname#2\s!en#3\endcsname
+ \csname#2\s!en#3\endcsname
+ \fi\fi
+ \else
+ \expandafter\bibdogetupsometextprefix
+ \csname\??la#1\c!default\endcsname{#2}{#3}%
+ \fi
+ \else
+ \ifcsname#2#3\endcsname
+ \csname#2#3\endcsname
+ \else\ifcsname#2\s!en#3\endcsname
+ \csname#2\s!en#3\endcsname
+ \fi\fi
+ \fi\fi}
+
+\def\docompletepublications[#1]%
+ {\begingroup
+ \setuplist[pubs][\c!criterium=\v!previous,#1]
+ \begingroup
+ \let\handletextprefix\firstoftwoarguments
+ \edef\headtextpubs{\bibdogetupsometextprefix\headlanguage\c!title{pubs}}%
+ \doifdefinedelse
+ {\??pv data\v!title}
+ {\doifemptyelsevalue
+ {\??pv data\v!title}
+ {\expanded{\systemsuppliedtitle[pubs]{\headtextpubs}}}%
+ {\expanded{\getvalue{\??pv data\v!title}{\headtextpubs}}}%
+ }%
+ {\expanded{\systemsuppliedtitle[pubs]{\headtextpubs}}}%
+ \endgroup
+ \dodoplacepublications }
+
+%D And the portion with the entries only.
+
+\def\placepublications
+ {\dosingleempty\doplacepublications}
+
+\def\doplacepublications[#1]%
+ {%\getparameters[\??pv data][#1]
+ \begingroup
+ \setuplist[pubs][\c!criterium=\v!previous,#1]%
+ \dodoplacepublications }%
+
+\def\dodoplacepublications%
+ {\initializepubslist
+ \doifelsevalue
+ {\??li pubs\c!option}{\v!continue}%
+ {}%
+ {\global\let\bibcounter\!!zerocount }%
+ \inpublisttrue
+ \typesetpubslist
+ \inpublistfalse
+ \endgroup}
+
+%D \subsubject{What's in a publication}
+
+\unexpanded\def\typesetapublication#1%
+ {\doifsomething{#1}
+ {\doglobal\increment\bibcounter
+ \bgroup
+ \the\initializebibdefinitions
+ \makepbkvalue{#1}%
+ \ifgridsnapping
+ \snaptogrid\vbox{\dodolistelement{pubs}{}{\bibcounter}%
+ {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}%
+ \strut \dotypesetapublication{#1}\strut }{}{}}%
+ \else
+ \dodolistelement{pubs}{}{\bibcounter}%
+ {\expanded{\reference[\bibrefprefix#1]{\bibcounter}}%
+ \strut \dotypesetapublication{#1}\strut }{}{}%
+ \fi
+ \egroup}}
+
+\def\dotypesetapublication#1%
+ {\bgroup
+ \def\@@currentalternative{data}%
+ \processcommacommand[\bibcommandlist,crossref]\clearbibitem
+ \processcommalist [artauthor,author,editor]\clearbibitemtwo
+ \processcommacommand[\bibcommandlist]\bibitemdefs
+ \processcommalist [artauthor,author,editor,crossref]\bibitemdefs
+ \let\biblanguage\empty
+ \getvalue{pbdd-#1}%
+ \ifcsname pbdt-#1\endcsname \bibalternative{\getvalue{pbdt-#1}}\fi
+ \egroup }
+
+%D An afterthought:
+
+\def\maybeyear#1{}
+
+%D An another:
+
+\def\noopsort#1{}
+
+%D This is the result of bibtex's `language' field.
+
+\def\setbiblanguage#1#2{\setvalue{\??pb @lang@#1}{#2}}
+
+\def\lang#1%
+ {\def\biblanguage{#1}%
+ \ifcsname \??pb @lang@#1\endcsname
+ \expanded{\language[\getvalue{\??pb @lang@#1}]}%
+ \fi \ignorespaces}
+
+%D \subject{Citations}
+%D
+%D \macros{cite,bibref}
+%D
+%D The indirection with \type{\dobibref} allows \LATEX\ style
+%D \type{\cite} commands with a braced argument (these might appear
+%D in included data from the \type{.bib} file).
+
+% \unexpanded\def\cite
+% {\doifnextcharelse{[}
+% {\dodocite}
+% {\dobibref}}
+% \def\dobibref#1%
+% {\docite[#1][]}
+% \def\dodocite[#1]%
+% {\startstrictinspectnextcharacter
+% \dodoubleempty\dododocite[#1]}
+% \def\dododocite[#1][#2]{%
+% \stopstrictinspectnextcharacter
+% \docite[#1][#2]}
+
+\unexpanded\def\cite
+ {\strictdoifnextoptionalelse\dodocite\dobibref}
+
+\def\dobibref#1%
+ {\docite[#1][]}
+
+\def\dodocite[#1]%
+ {\strictdoifnextoptionalelse{\docite[#1]}{\docite[#1][]}}
+
+\def\docite[#1][#2]%
+ {\begingroup
+ \setupinteraction[\c!style=]%
+ \edef\temp{#2}%
+ \ifx\empty\temp \secondargumentfalse
+ \else \secondargumenttrue \fi
+ \ifsecondargument
+ \processcommalist[#2]\docitation
+ \doifassignmentelse
+ {#1}%
+ {\getparameters[LO][\c!alternative=,\c!extras=,#1]%
+ \edef\@@currentalternative{\LOalternative}%
+ \ifx\@@currentalternative\empty
+ \edef\@@currentalternative{\@@citedefault}%
+ \fi
+ \ifx\LOextras\empty
+ \setupcite[\@@currentalternative][#1]%
+ \else
+ \expandafter\ifx\csname LOright\endcsname \relax
+ \edef\LOextras{{\LOextras\bibalternative\c!right}}%
+ \else
+ \edef\LOextras{{\LOextras\LOright}}%
+ \fi
+ \expanded{\setupcite[\@@currentalternative][#1,\c!right=\LOextras]}%
+ \fi
+ }%
+ {\def\@@currentalternative{#1}}%
+ \expanded{%
+ \processaction[\csname @@pv\@@currentalternative \c!compress\endcsname]}
+ [ \v!yes=>\bibcitecompresstrue,
+ \v!no=>\bibcitecompressfalse,
+ \s!default=>\bibcitecompresstrue,
+ \s!unknown=>\bibcitecompresstrue]%
+ \getvalue{bib\@@currentalternative ref}[#2]%
+ \else
+ \processcommalist[#1]\docitation
+ \expanded{\processaction[\csname @@pv\@@citedefault \c!compress\endcsname]}
+ [ \v!yes=>\bibcitecompresstrue,
+ \v!no=>\bibcitecompressfalse,
+ \s!default=>\bibcitecompresstrue,
+ \s!unknown=>\bibcitecompresstrue]%
+ \edef\@@currentalternative{\@@citedefault}%
+ \getvalue{bib\@@citedefault ref}[#1]%
+ \fi
+ \endgroup}
+
+%D \macros{nocite}
+
+\def\nocite[#1]%
+ {\processcommalist[#1]\addthisref
+ \processcommalist[#1]\docitation }
+
+%D \macros{setupcite}
+
+\def\setupcite{\dodoubleempty\dosetupcite}
+
+\def\dosetupcite[#1][#2]%
+ {\ifsecondargument
+ \def\dodosetupcite##1{\getparameters[\??pv##1][#2]}%
+ \processcommalist[#1]\dodosetupcite
+ \else % default case
+ \getparameters[\??pv\@@citedefault][#1]%
+ \fi }
+
+%D Low-level stuff
+
+\def\getcitedata#1[#2]#3[#4]#5to#6%
+ {\bgroup
+ \addthisref{#4}%
+ \dofetchapublication{#4}%
+ \doifdefinedelse{@@pb@bib#2}%
+ {\xdef#6{\getvalue{@@pb@bib#2}}}%
+ {\xdef#6{\getvalue{@@pb@#2}}}%
+ \egroup}
+
+\def\dofetchapublication#1%
+ {\makepbkvalue{#1}%
+ \processcommacommand[\bibcommandlist,crossref]\clearbibitem
+ \processcommalist [artauthor,author,editor]\clearbibitemtwo
+ \processcommacommand[\bibcommandlist]\bibitemdefs
+ \processcommalist [artauthor,author,editor,crossref]\bibitemdefs
+ \getvalue{pbdd-#1}}
+
+%D This new version writes a reference out to the tui file for every
+%D \type{\cite}. This will allow backlinking.
+%D
+%D Some special care is needed so that references are not added from
+%D weird locations like in the TOC or within a \type{\setbox} command.
+
+\newcounter\citationnumber
+
+\def\docitation#1{%
+ \iftrialtypesetting \else
+ \ifdoinpututilities\else
+ \doglobal\increment\citationnumber
+ \expanded{\rawreference{}{cite-\jobname-\citationnumber}{#1}}%
+ \fi \fi }
+
+%D \macros{numreferred,doifreferredelse,addthisref,publist}
+%D
+%D The interesting command here is \type{\addthisref}, which maintains
+%D the global list of references.
+%D
+%D \type{\numreferred} is needed to do automatic calculations on
+%D the label width, and \type{\doifreferredelse} will be used
+%D to implement \type{criterium=cite}.
+
+\newcounter\numreferred
+
+\long\def\doifreferredelse#1{\doifdefinedelse{pbr-#1}}
+
+\def\addthisref#1%
+ {\doifundefinedelse{pbr-#1}
+ {\setxvalue{pbr-#1}{\citationnumber}%
+ \doglobal\increment\numreferred
+ \ifx\publist\empty \gdef\publist{#1}\else\appended\gdef\publist{,#1}\fi}
+ {\setxvalue{pbr-#1}{\getvalue{pbr-#1},\citationnumber}}}
+
+\let\publist\empty
+
+%D \macros{doifbibreferencefoundelse}
+%D
+%D Some macros to fetch the information provided by
+%D \type{\startpublication}.
+
+\def\doifbibreferencefoundelse#1%
+ {\preloadbiblist
+ \doifdefinedelse{pbdk-#1}
+ {\firstoftwoarguments}
+ {\showmessage\m!publications{5}{#1 is unknown}%
+ \secondoftwoarguments}}
+
+%D \macros{ixbibauthoryear,thebibauthors,thebibyears}
+%D
+%D If compression of \type{\cite}'s argument expansion is on,
+%D the macros that deal with authors and years call this internal
+%D command to do the actual typesetting.
+%D
+%D Two entries with same author but with different years may
+%D be condensed into ``Author (year1,year2)''. This is about the
+%D only optimization that makes sense for the (author,year)
+%D style of citations (years within one author have to be unique
+%D anyway so no need to test for that, and ``Author1, Author2 (year)''
+%D creates more confusion than it does good).
+%D
+%D In the code below,
+%D the macro \type{\thebibauthors} holds the names of the alternative
+%D author info fields for the current list. This is a commalist,
+%D and \type{\thebibyears} holds the (collection of) year(s) that go with
+%D this author (possibly as a nested commalist).
+%D
+%D There had better be an author for all cases, but there
+%D does not have to be year info always. \type{\thebibyears} is
+%D pre-initialized because this makes the insertion macros simpler.
+%D
+%D In `normal' \TeX, of course there are expansion problems again.
+
+\def\ixbibauthoryear#1#2#3#4%
+ {\bgroup
+ \gdef\ixlastcommand {#4}%
+ \gdef\ixsecondcommand{#3}%
+ \gdef\ixfirstcommand {#2}%
+ \glet\thebibauthors \empty
+ \glet\thebibyears \empty
+ \getcommalistsize[#1]%
+ \ifbibcitecompress
+ \dorecurse\commalistsize{\xdef\thebibyears{\thebibyears,}}%
+ \processcommalist[#1]\docompressbibauthoryear
+ \else
+ \processcommalist[#1]\donormalbibauthoryear
+ \fi
+ \egroup
+ \dobibauthoryear}
+
+%D \macros{dodobibauthoryear}
+%D
+%D This macro only has to make sure that the lists
+%D \type{\thebibauthors} and \type{\thebibyears} are printed.
+
+\def\dobibauthoryear
+ {\scratchcounter\zerocount
+ \getcommacommandsize[\thebibauthors]%
+ \edef\authorcount{\commalistsize}%
+ \@EA\processcommalist\@EA[\thebibauthors]\dodobibauthoryear}
+
+\def\dodobibauthoryear#1%
+ {\advance\scratchcounter\plusone
+ \edef\wantednumber{\the\scratchcounter}%
+ \getfromcommacommand[\thebibyears][\wantednumber]%
+ \@EA\def\@EA\currentbibyear\@EA{\commalistelement}%
+ \setcurrentbibauthor{#1}%
+ \ifnum\scratchcounter=\plusone
+ \ixfirstcommand
+ \else\ifnum \scratchcounter=\authorcount\relax
+ \ixlastcommand
+ \else
+ \ixsecondcommand
+ \fi\fi}
+
+\def\setcurrentbibauthor#1%
+ {\getcommacommandsize[#1]%
+ \ifcase\commalistsize
+ % anonymous?
+ \def\currentbibauthor{}%
+ \or
+ \def\currentbibauthor{#1}%
+ \or
+ \expanded{\docurrentbibauthor#1}%
+ \else
+ \handlemultiplebibauthors{\commalistsize}{#1}%
+ \fi }
+
+\newcount\citescratchcounter
+
+\def\handlemultiplebibauthors#1#2%
+ {\citescratchcounter 0
+ \def\currentbibauthor{}%
+ \def\bibprocessauthoritem##1%
+ {\advance\citescratchcounter1
+ \ifnum \citescratchcounter=#1\relax
+ \edef\currentbibauthor{\currentbibauthor##1}%
+ \else \ifnum\numexpr\citescratchcounter+1 = #1\relax
+ \edef\currentbibauthor{\currentbibauthor ##1\bibalternative{andtext}}%
+ \else
+ \edef\currentbibauthor{\currentbibauthor ##1\bibalternative{namesep}}%
+ \fi
+ \fi }%
+ \processcommalist[#2]\bibprocessauthoritem }
+
+\setupcite
+ [author,authoryear,authoryears]
+ [\c!namesep={, }]
+
+%D This discovery of authoretallimit is not the best one,
+%D but it will do for now.
+
+\def\docurrentbibauthor#1,#2%
+ {\doifemptyelse{#2}
+ {\def\currentbibauthor{#1\bibalternative{otherstext}}}
+ {\@EA
+ \ifx\csname \??pv\@@currentalternative authoretallimit\endcsname\relax
+ \edef\currentbibauthor{#1\bibalternative{andtext}#2}%
+ \else
+ \edef\currentbibauthor{#1%
+ \ifcase0\bibalternative{authoretallimit}\relax\or
+ \bibalternative{otherstext}\else\bibalternative{andtext}#2\fi}%
+ \fi}}
+
+%D This is not the one Hans made for me, because I need a global
+%D edef, and the \type{\robustdoifinsetelse} doesn't listen to
+%D \type{\doglobal }
+
+\def\robustaddtocommalist#1#2% {item} \cs
+ {\robustdoifinsetelse{#1}#2\resetglobal
+ {\dodoglobal\xdef#2{\ifx#2\empty\else#2,\fi#1}}}
+
+%D \macros{donormalbibauthoryear}
+%D
+%D Now we get to the macros that fill the two lists.
+%D The `simple' one really is quite simple.
+
+\def\donormalbibauthoryear#1%
+ {\addthisref{#1}%
+ \def\myauthor{Xxxxxxxxxx}%
+ \def\myyear{0000}%
+ \doifbibreferencefoundelse{#1}
+ {\def\myauthor{{\getvalue{pbda-#1}}}%
+ \def\myyear {\getvalue{pbdy-#1}}}%
+ {}%
+ \@EA\doglobal\@EA\appendtocommalist\@EA{\myauthor}\thebibauthors
+ \@EA\doglobal\@EA\appendtocommalist\@EA{\myyear }\thebibyears}
+
+%D \macros{docompressbibauthoryear}
+%D
+%D So much for the easy parts. Nothing at all will be done if
+%D the reference is not found or the reference does not contain
+%D author data. No questions marks o.s.s. (to be fixed later)
+
+\def\docompressbibauthoryear#1%
+ {\addthisref{#1}%
+ \def\myauthor{Xxxxxxxxxx}%
+ \def\myyear {0000}%
+ \doifbibreferencefoundelse{#1}
+ {\xdef\myauthor{\csname pbda-#1\endcsname }%
+ \xdef\myyear {\csname pbdy-#1\endcsname }}
+ {}%
+ \ifx\myauthor\empty\else
+ \checkifmyauthoralreadyexists
+ \findmatchingyear
+ \fi}
+
+%D two temporary counters. One of these two can possibly be replaced
+%D by \type{\scratchcounter}.
+
+\newcount\bibitemcounter
+\newcount\bibitemwanted
+
+%D The first portion is simple enough: if this is the very first author
+%D it is quite straightforward to add it. \type{\bibitemcounter} and
+%D \type{\bibitemwanted} are needed later to insert the year
+%D information in the correct item of \type{\thebibyears}
+
+\def\checkifmyauthoralreadyexists
+ {\doifemptyelsevalue{thebibauthors}
+ {\global\bibitemwanted \plusone
+ \global\bibitemcounter \plusone
+ \xdef\thebibauthors{{\myauthor}}}
+ {% the next weirdness is because according to \getcommalistsize,
+ % the length of \type{[{{},{}}]} is 2.
+ \@EA\getcommalistsize\@EA[\thebibauthors,]%
+ \global\bibitemcounter\commalistsize
+ \global\advance\bibitemcounter\minusone
+ \global\bibitemwanted \zerocount
+ \processcommacommand[\thebibauthors]\docomparemyauthor}}
+
+%D The outer \type{\ifnum} accomplishes the addition of
+%D a new author to \type{\thebibauthors}. The messing about with
+%D the two counters is again to make sure that \type{\thebibyears}
+%D will be updated correctly.If the author {\it was} found,
+%D the counters will stay at their present values and everything
+%D will be setup properly to insert the year info.
+
+\def\docomparemyauthor#1%
+ {\global\advance\bibitemwanted \plusone
+ \def\mytempc{#1}%
+% \message{authors: \myauthor <=>\mytempc \ifx\mytempc\myauthor :Y \else :N
+% \meaning \myauthor, \meaning\mytempc\fi (\the\bibitemwanted = \the\bibitemcounter)}%
+ \ifx\mytempc\myauthor
+ \quitcommalist
+ \else
+ \ifnum\bibitemwanted = \bibitemcounter\relax
+ \global\advance\bibitemwanted \plusone
+ \global\bibitemcounter\bibitemwanted\relax
+ \@EA\doglobal\@EA\robustaddtocommalist\@EA{{\myauthor}}\thebibauthors
+ \fi
+ \fi}
+
+%D This macro should be clear now.
+
+\def\findmatchingyear
+ {\edef\wantednumber{\the\bibitemwanted}%
+ \getfromcommacommand[\thebibyears][\wantednumber]%
+ \ifx\commalistelement\empty
+ \edef\myyear{{\myyear}}%
+ \else
+ \edef\myyear{{\commalistelement, \myyear}}%
+ \fi
+ \edef\newcommalistelement{\myyear}%
+ \doglobal\replaceincommalist \thebibyears \wantednumber}
+
+%D \macros{preparebibrefprefix}
+%D
+%D The reference list only writes bare references when the criterium
+%D is `all'. Otherwise, a prefix is added to make sure that pdfTeX
+%D does not encounter duplicate named references. On the generation
+%D side, this is not a big problem. \type{\preparebibrefprefix}
+%D creates a suitable string to prepend if a prefix is needed.
+%D
+%D Because this macro is used within \type{\cite } that itself
+%D can be used within lists like the table of contents, it needs
+%D to save and restore \type{\savedalltoclevels} and
+%D \type{\currentlevel} (\type{\dosetfilterlevel} needs to change
+%D their values globally).
+
+\def\preparebibrefprefix
+ {\chardef\savedalltoclevels \alltoclevels
+ \let\savedcurrentlevel\currentlevel
+ \let\dosetfilterlevel\patcheddosetfilterlevel
+ \dosettoclevel\??li{pubs}%
+ \edef\bibrefprefix{\@@sectiontype\currentlevel\sectionseparator}%
+ \let\dosetfilterlevel\normaldosetfilterlevel
+ \global\let\currentlevel\savedcurrentlevel
+ \global\chardef\alltoclevels \savedalltoclevels }
+
+%D \macros{preparebibreflist}
+%D
+%D But this optional prefixing is a bit of a problem on the
+%D other side. We would like to do \type{\goto{}[article-full]}
+%D but can't do it like that, because the actual label may be
+%D \type{1:2:0:3:4:article-full]} or so. The problem is solved
+%D by building a commalist that looks like this:
+%D \starttyping
+%D \def\bibreflist%
+%D {1:2:0:3:4:article-full,
+%D 1:2:0:3:article-full,
+%D 1:2:0:article-full,
+%D 1:2:article-full,
+%D 1:article-full,
+%D article-full}
+%D \stoptyping
+
+\def\preparebibreflist#1%
+ {\let\bibreflist\empty
+ \def\storeitem##1%
+ {\ifx\bibreflist\empty
+ \edef\prefix{##1\sectionseparator}%
+ \edef\bibreflist{\prefix#1,#1}%
+ \else
+ \edef\prefix{\prefix##1\sectionseparator}%
+ \edef\bibreflist{\prefix#1,\bibreflist}%
+ \fi}%
+ \expanded{\processseparatedlist[\bibrefprefix][\sectionseparator]}\storeitem }
+
+%D \macros{gotobiblink,inbiblink,atbiblink}
+%D
+%D The final task is looping over that list until a match is found.
+
+\newif\ifbibreffound
+
+\def\gotobiblink#1[#2]%
+ {\bgroup
+ \preparebibrefprefix
+ \preparebibreflist{#2}%
+ \global\bibreffoundfalse
+ \def\setuplink##1%
+ {\ifbibreffound\else
+ \doifreferencefoundelse
+ {##1}
+ {\global\bibreffoundtrue \goto{#1}[##1]}%
+ {}\fi}%
+ \processcommacommand[\bibreflist]\setuplink
+ \ifbibreffound \else \unknownreference{#2}\fi
+ \egroup }
+
+\def\atbiblink[#1]%
+ {\bgroup
+ \preparebibrefprefix
+ \preparebibreflist{#1}%
+ \global\bibreffoundfalse
+ \def\setuplink##1%
+ {\ifbibreffound\else
+ \doifreferencefoundelse
+ {##1}
+ {\global\bibreffoundtrue \at[##1]}%
+ {}\fi}%
+ \processcommacommand[\bibreflist]\setuplink
+ \ifbibreffound \else \unknownreference{#1}\fi
+ \egroup }
+
+\def\inbiblink[#1]%
+ {\bgroup
+ \preparebibrefprefix
+ \preparebibreflist{#1}%
+ \global\bibreffoundfalse
+ \def\setuplink##1%
+ {\ifbibreffound\else
+ \doifreferencefoundelse
+ {##1}
+ {\global\bibreffoundtrue \in[##1]}%
+ {}\fi}%
+ \processcommacommand[\bibreflist]\setuplink
+ \ifbibreffound \else \unknownreference{#1}\fi
+ \egroup }
+
+%D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref}
+%D
+%D Now that all the hard work has been done, these are simple.
+%D \type{\ixbibauthoryearref} stores the data in the macros
+%D \type{\currentbibauthor} and \type{\currentbibyear}.
+
+\def\ifbibinteractionelse%
+ {\iflocation
+ \edef\test{\bibalternative\c!interaction}%
+ \ifx\test\v!stop
+ \@EA\@EA\@EA\secondoftwoarguments
+ \else
+ \@EA\@EA\@EA\firstoftwoarguments
+ \fi
+ \else
+ \@EA\secondoftwoarguments
+ \fi
+ }
+
+\def\bibmaybeinteractive#1#2%
+ {\ifbibcitecompress #2\else
+ \ifbibinteractionelse{\gotobiblink{#2}[#1]}{#2}\fi }
+
+\def\bibauthoryearref[#1]%
+ {\ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left{\currentbibyear}\bibalternative\v!right}}
+ {\bibalternative\c!pubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}}
+ {\bibalternative\c!lastpubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}}}
+
+\def\bibauthoryearsref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}
+ {\bibalternative\c!pubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}
+ {\bibalternative\c!lastpubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}%
+ \bibalternative\v!right}
+
+\def\bibauthorref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}}}
+ {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibauthor}}}
+ {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibauthor}}}%
+ \bibalternative\v!right}
+
+\def\bibyearref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibyear}}}
+ {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibyear}}}
+ {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibyear}}}%
+ \bibalternative\v!right}
+
+%D ML problems:
+
+%D \macros{bibshortref,bibkeyref,bibpageref,bibtyperef,bibserialref}
+%D
+%D There is hardly any point in trying to compress these. The only
+%D thing that needs to be done is making sure that
+%D the separations are inserted correctly. And that is
+%D what \type{\refsep} does.
+
+\newif\iffirstref
+
+\def\refsep{\iffirstref\firstreffalse\else\bibalternative\c!pubsep\fi}
+
+\def\bibshortref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibshortref
+ \bibalternative\v!right}
+
+\def\dobibshortref#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbds-#1}}[#1]}
+ {\unknownreference{#1}}}
+
+
+\def\bibserialref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibserialref
+ \bibalternative\v!right}
+
+\def\dobibserialref#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbdn-#1}}[#1]}
+ {\unknownreference{#1}}}
+
+\def\bibkeyref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibkeyref
+ \bibalternative\v!right}
+
+\def\dobibkeyref#1%
+ {\addthisref{#1}\refsep\gotobiblink{#1}[#1]}
+
+\def\gotoDOI#1#2%
+ {\ifbibinteractionelse
+ {\useURL[bibfooDoi#1][#2]%
+ \useURL[bibfoo#1][http://dx.doi.org/#2]%
+ \goto{\url[bibfooDoi#1]}[url(bibfoo#1)]}
+ {\hyphenatedurl{#2}}}
+
+\def\bibdoiref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibdoiref
+ \bibalternative\v!right}
+
+\def\dobibdoiref#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\expanded{\gotoDOI{#1}{\getvalue{pbdo-#1}}}}
+ {\unknownreference{#1}}}
+
+\def\biburlref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobiburlref
+ \bibalternative\v!right}
+
+\def\gotoURL#1#2%
+ {\ifbibinteractionelse
+ {\useURL[bibfoo#1][#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]}
+ {\hyphenatedurl{#2}}}
+
+\def\dobiburlref#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\expanded{\gotoURL{#1}{\getvalue{pbdu-#1}}}}
+ {\unknownreference{#1}}}
+
+\def\bibtyperef[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibtyperef
+ \bibalternative\v!right}
+
+\def\dobibtyperef#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\gotobiblink{\getvalue{pbdt-#1}}[#1]}
+ {\unknownreference{#1}}}
+
+\def\bibpageref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibpageref
+ \bibalternative\v!right}
+
+\def\dobibpageref#1%
+ {\addthisref{#1}\refsep
+ \ifbibinteractionelse{\atbiblink[#1]}{{\referencingfalse\at[#1]}}}
+
+\def\bibdataref[#1]%
+ {\bibalternative\v!left
+ \firstreftrue\processcommalist[#1]\dobibdata
+ \bibalternative\v!right}
+
+\def\dobibdata#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}{\dotypesetapublication{#1}}
+ {\unknownreference{#1}}}
+
+\let\bibnoneref\nocite
+
+%D \macros{bibnumref}
+%D
+%D It makes sense to try and compress the argument list of
+%D \type{\bibnumref}. There are two things involved: the actual
+%D compression, and a sort routine. The idea is to store the
+%D found values in a new commalist called \type{\therefs}.
+
+%D But that is not too straight-forward, because \type{\in} is
+%D not expandable,
+%D so that the macro \type{\expandrefs} is needed.
+
+\def\expandrefs#1%
+ {\bgroup
+ \preparebibrefprefix
+ \preparebibreflist{#1}%
+ \global\bibreffoundfalse
+ \def\setuplink##1%
+ {\ifbibreffound\else
+ \doifreferencefoundelse
+ {##1}
+ {\global\bibreffoundtrue
+ \@EA\doglobal\@EA\addtocommalist\@EA{\reftypet}\therefs }%
+ {}\fi}%
+ \processcommacommand[\bibreflist]\setuplink
+ \ifbibreffound \else \showmessage\m!publications{5}{#1 unknown}%
+ \doglobal\addtocommalist{0}\therefs\fi
+ \egroup }
+
+%D But at least the actual sorting code is simple (note that sorting
+%D a list with exactly one entry fails to return anything, which
+%D is why the \type{\ifx} is needed).
+
+\def\bibnumref[#1]%
+ {\bibalternative\v!left
+ \penalty\!!tenthousand
+ \processcommalist[#1]\addthisref
+ \firstreftrue
+ \ifbibcitecompress
+ \glet\therefs\empty
+ \processcommalist[#1]\expandrefs
+ \sortcommacommand[\therefs]\donumericcompare
+ \ifx\empty\sortedcommalist\else
+ \let\therefs\sortedcommalist
+ \fi
+ \compresscommacommandnrs[\therefs]%
+ \processcommacommand[\compressedlist]\verysimplebibnumref
+ \else
+ \processcommalist[#1]\dosimplebibnumref
+ \fi
+ \bibalternative\v!right}
+
+\def\dosimplebibnumref #1%
+ {\refsep\ifbibinteractionelse
+ {\inbiblink[#1]}{{\referencingfalse\inbiblink[#1]}}}
+
+\def\verysimplebibnumref#1{\doverysimplebibnumref#1}
+
+\def\doverysimplebibnumref#1#2%
+ {\refsep
+ \ifcase#1\relax \unknownreference{#1}\else
+ \def\tempa{#2}\ifx\empty\tempa#1\else#1\bibalternative\c!inbetween#2\fi
+ \fi}
+
+%D By request from Sanjoy. This makes it easier to implement
+%D \type{\citeasnoun}.
+
+\def\bibauthornumref[#1]%
+ {\getcommalistsize[#1]%
+ \global\bibitemcounter\commalistsize
+ \firstreftrue
+ \processcommalist[#1]\dobibauthornumref }
+
+\def\dobibauthornumref#1%
+ {\addthisref{#1}\refsep
+ \doifbibreferencefoundelse{#1}
+ {\getvalue{pbda-#1}%
+ \bibalternative\c!inbetween
+ \bibalternative\v!left
+ \ifbibinteractionelse{\inbiblink[#1]}
+ {{\referencingfalse\inbiblink[#1]}}%
+ \bibalternative\v!right}
+ {\unknownreference{#1}}}
+
+%D And some defaults are loaded from bibl-apa:
+
+\setuppublications
+ [\v!month\v!conversion=,
+ \c!alternative=apa]
+
+\appendtoks
+ \preloadbiblist
+\to \everystarttext
+
+\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/bibl-tra.mkiv b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv
new file mode 100644
index 00000000000..519af0c6f77
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/bibl-tra.mkiv
@@ -0,0 +1,1552 @@
+%D \module
+%D [ file=bibl-tra,
+%D version=2009.08.22,
+%D title=\CONTEXT\ Publication Module,
+%D subtitle=Publications,
+%D author=Taco Hoekwater,
+%D date=\currentdate,
+%D copyright=Public Domain]
+%C
+%C Donated to the public domain.
+
+%D This module has been adapted to \MKIV\ by Hans Hagen so if things go wrong,
+%D he is to blame. The changes concern references and lists but teh rendering
+%D itself is unchanged. Future versions might provide variants as we have plans
+%D for an upgrade.
+%D
+%D We use a still somewhat experimental extension to the list
+%D mechanism. Eventually the bibtex module will use the bibl loader
+%D and access the data by means of lpath expressions. In that case we
+%D don't need to process the bibliography but still need to track
+%D usage as done here.
+%D
+%D A bit ongoing: make more local macros prefixed with bib, i.e. the bib
+%D namespace is reserved.
+
+\writestatus{loading}{ConTeXt Bibliography Support / BibTeX}
+
+\definefilesynonym[bib][obsolete]
+
+\registerctxluafile{bibl-tra}{1.001}
+
+%D The original was developed independantly by Taco Hoekwater while still working for Kluwer
+%D Academic publishers (it still used the dutch interface then). Development continued after
+%D he left Kluwer, and in Januari 2005, the then already internationalized file was merged
+%D with the core distribution by Hans Hagen. The current version is once again by Taco.
+%D
+%D More documentation and additional resources can be found on the contextgarden:
+%D \hyphenatedurl{http://wiki.contextgarden.net//Bibliography}.
+
+%D \subject{DONE (dd/mm/yyyy)}
+%D
+%D \startitemize
+%D \item add author definition (and associated system variable) (26/05/2005)
+%D \item add finalnamesep support for Oxford comma (17/09/2005)
+%D \item add \type{\insert...} for: doi, eprint, howpublished (19/09/2005)
+%D \item allow a defaulted \type{\setupcite} (19/11/2005)
+%D \item renamed citation type 'number' to 'serial' (19/11/2005)
+%D \item better definition of \type{\inverted...author} (19/11/2005)
+%D \item don't reset [numbercommand] in \type {\setuppublication} by default (20/11/2005)
+%D \item don't disable other \type {\setuppublication} keys if alternative is present (20/11/2005)
+%D \item drop \type{\sanitizeaccents} (20/11/2005)
+%D \item added \type{\nocite} and \type{\cite[none]} (21/11/2005)
+%D \item added headtext for it (23/11/2005)
+%D \item make \type{\cite[url]} and \type{\cite[doi]} interactive (23/11/2005)
+%D \item make right-aligned labels in the list work even when autohang=no
+%D \item use 'et al.' instead of 'et.al.'. Pointed out by Peter M\"unster (30/12/2005)
+%D \item added headtext for cz (31/12/2005)
+%D \item Keep whitespace after \type{\cite} with single argument (31/12/2005)
+%D \item Fix broken \type{\cite{}} support (31/12/2005)
+%D \item Use \type{\readfile} inside \type{\usepublications} instead of \type{\readsysfile} (12/01/2006)
+%D \item Use \type{\currentbibyear} and \type{\currentbibauthor} instead of \type{\YR} and \type{\AU} (05/02/2006)
+%D \item Fix compressed version of authoryear style (05/02/2006)
+%D \item Rename the clashing data fields \type{\url} and \type{\type} to \type{\biburl} and \type{\bibtype} (05/02/2006)
+%D \item Added two french bibl files from Renaud Aubin (06/02/2006)
+%D \item Five new bib class and eight extra bib fields, for IEEEtran (07/02/2006)
+%D \item French keyword translation, provided by Renaud (08/02/2006)
+%D \item fix underscores in undefined keys (22/02/2006)
+%D \item Destroy interactivity in labels of the publication list (13/03/2006)
+%D \item fix multi-cite list compression (11/4/2006)
+%D \item fix \type{\getcitedata} (11/4/2006)
+%D \item magic for chapter bibs (18-25/4/2006)
+%D \item language setting (25/4/2006)
+%D \item use \type{\hyphenatedurl} for \type{\inserturl} (25/4/2006)
+%D \item Add \type{\docitation} to \type{\nocite}(26/4/2006)
+%D \item patents can have numbers, added to bst files (26/4/2006)
+%D \item \type{\docitation} needs a \type{\iftrialtypesetting} (27/4/2006)
+%D \item \type{\filllocalpublist}'s loop is bound by definedness, not resolvedness (27/4/2006)
+%D \item \type{\setuppublications[monthconversion=]} added (15/5/2006)
+%D \item use \type{\undefinedreference} instead of bare question marks (15/5/2006)
+%D \item add grouping around \type{\placepublications} commands (16/5/2006)
+%D \item fix a bug in \type{\cite{
- }} (17/5/2006)
+%D \item support \type{\cite[authornum]} (18/5/2006)
+%D \item make \type{\cite} unexpandable (20/6/2006)
+%D \item allow hyperlinks in author\&year combo's
+%D (cite list compression has to be off) (20/6/2006)
+%D \item fix duplicate labels for per-chapter style (20/6/2006)
+%D \item allow \type{\setupcite[interaction=(start|stop)]}
+%D \item fix the item number in the publication list with 'numbering=yes' (22/6/2006)
+%D \item make the default criterium for \type{\placepublications} be \type{previous} (23/6/2006)
+%D \item fix \type{\normalauthor} and \type{\normalshortauthor} spacing (29/6/2006)
+%D \item do not typeset empty arguments to \type{\typesetapublication} (29/6/2006)
+%D \item add \type{symbol=none} to \type{\setuplist} in unnumbered
+%D mode to prevent typesetting of bare numbers (29/6/2006)
+%D \item remove two incorrect spaces from bibl-num.tex (1/7/2006)
+%D \item reset font styles within \type{\cite}, so that font switches
+%D in \type{left} stay in effect (12/7/2006)
+%D \item guard added against loading bbl files multiple times (13/7/2006)
+%D \item fix \type{\cite[num]} with compression is on. (14/7/2006)
+%D \item test \type{\iflocation} before deciding to use the
+%D interactive version of cite (18/7/2006)
+%D \item support \type{\setupcite[authoretallimit=1]} (18/7/2006)
+%D \item support use of \type{\cite} within titles and captions by
+%D saveguarding the list item extraction and reference placement
+%D code (19/7/2006)
+%D \item support \type{\setuppublicationlist[title=\chapter]} (4/8/2006)
+%D \item use the expansion of \type{\headtext{pubs}} (4/8/2006)
+%D \item hook added for repeated authors in publication list
+%D \type{\setuppublicationlist[artauthorcommand=\mythreeargscommand]}
+%D (4/8/2006)
+%D \item make the bracketed arguments of \type{\artauthor}, \type{\author}
+%D and \type{\editor} (bbl commands) optional (4/8/2006)
+%D \item the constants \type{sorttype}, \type{compress} and
+%D \type{autohang} have moved to the core (8/8/2006)
+%D \item bibtex is now registered as a program to be run by texexec (8/8/2006)
+%D \item fix a bug in \type{\setupcite[authoretallimit=1]} (9/8/2006)
+%D \item fix a bug inside citations that prevented lastpubsep from ever being
+%D used due to a volatile \type{\commalistsize} (25/8/2006).
+%D \item added the possibility of \type{\placepublications[option=continue]}
+%D (6/9/2006)
+%D \item Mojca translated Master's Thesis to Masterarbeit (bibl-apa-de.tex)
+%D (12/9/2006)
+%D \item Added \type{\setuppublicationlist[maybeyear=off]} by request from
+%D Thomas Schmitz (15/9/2006)
+%D \item Removed some spurious spaces pointed out by willi egger (19/9/2006)
+%D \item Add configuration of bibtex executable name (4/11/2006)
+%D \item Fix numbering=short and numbering=bib (spotted by Matthias W\"achter) (4/11/2006)
+%D \item third attempt to get a correct release (5/11/2006)
+%D \item fix a few missing dots in bibl-num.tex (7/12/2006)
+%D \item Patch for DOI's by Tobias Burnus (17/4/2007)
+%D \item Patch for \type{\insertbiburl} and \type{\insertdoi} for Tobias Burnus (18/4/2007)
+%D \item Added a missing \type{\relax} in \type{\dospecialbibinsert},
+%D that made the space before the {\it et al.} text disappear. (18/4/2007)
+%D \item Attempt to fix percent signs in bbl files. As a side-effect,
+%D this prohibits comments in \tex{startpublication} blocks! (17/4/2008)
+%D \item Patch from Matthias W\"achter that allows arbitrary .bst
+%D files to be used with \tex{setupbibtex} (25/9/2008)
+%D \item Extended for the new multilingual setups for the Oct 2008 current of ConTeXt (23/10/2008)
+%D \item Multilingual setups needed another fix (27/10/2008)
+%D \item Two fixes for bibl-apa by Michael Green (27/10/2008)
+%D \item Catalan translation of 'References' (10/11/2008)
+%D \item 'chapter' -> 'chapitre' in bibl-apa-fr (27/11/2008)
+%D \item Run bibtex via os.execute in mkiv modee (01/12/2008)
+%D \item Small correction in bibl-apa's placement of volume
+%D information in articles (05/01/2009)
+%D \item Handle multi-author (more than two) cases in \type{\cite}
+%D (02/03/2009)
+%D \item Suppress a syntax error in \type{cont-xp} mode. The output is
+%D probably not right, though (02/03/2009)
+%D \item Added a \tex{loadmarkfile} at the end, and two new files
+%D from Hans. The \type{t-bib.mkiv} is needed to make the module
+%D work with the new structure code (17/04/2009)
+%D \item Added a patch to \type{t-bib.mkiv} from Hans to make the
+%D cross referencing between multiple citations an
+%D bibliographies work (27/04/2009)
+%D \item Remove a superfluous \type{\unprotect} in t-bib.mkiv (11/05/2009).
+%D \item Patch of incollection in bibl-ams.tex from Xan (08/06/2009).
+%D \item Patch of unpublished in bibl-ams.tex from Xan (22/07/2009).
+%D \item Modified \type{\bibdogetupsometextprefix} so it works for undefined
+%D language labels, from Hans (13/08/2009).
+%D \item Adapt referencing and list insertion to \MKIV. Update some code
+%D to the latest \CONTEXT. Change some names in order to avoid conflicts
+%D with existing core names (like \type {\insertpages}).
+%D \item All constants, variables, message etc.\ are now in the core.
+%D \item Added key: \type {method} (when \type {global}, previous shown entries are
+%D not shown again, when \type {local} they are repeated).
+%D \stopitemize
+%D
+%D \subject{WISHLIST}
+%D
+%D \startitemize
+%D \item link back from publication list to citation
+%D \item export \type {\citation{}}
+%D \item support mlbibtex
+%D \item don't load the whole lot, but filter entries instead
+%D \item 9 vs 10, 19 vs 20 ... prevent extra runs when only subtle changes in wd of reference
+%D \stopitemize
+
+\unprotect
+
+\def\biblistname{pubs} % for compatibility
+
+\definelist
+ [pubs]
+
+\setuplist
+ [pubs]
+ [\c!state=\v!start,
+ \c!width=]
+
+\installstructurelistprocessor{pubs:userdata}%
+ {\ctxlua{bibtex.hacks.add(structure.lists.uservalue("\currentlist",\currentlistindex,"bibref"),\currentlistindex)}}
+
+\newcount\bibtexblock \bibtexblock\plusone
+
+%D \macros{bibdoif,bibdoifnot,bibdoifelse}
+%D
+%D Here are a few small helpers that are used a lot in all the typesetting commands
+%D (\type{\bibinsert...}) we will encounter later.
+
+\long\def\bibdoifelse#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\secondoftwoarguments
+ \else
+ \expandafter\firstoftwoarguments
+ \fi}
+
+\long\def\bibdoifnot#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\firstofoneargument
+ \else
+ \expandafter\gobbleoneargument
+ \fi}
+
+\long\def\bibdoif#1%
+ {\@EA\def\@EA\!!stringa\@EA{#1}%
+ \ifx\!!stringa\empty
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
+%D Unfortunately, \BIBTEX\ is not the best configurable program
+%D around. The names of the commands it parses as well as the \type{.aux}
+%D extension to the file name are both hardwired.
+%D
+%D This means \CONTEXT\ has to write a \LATEX-style auxiliary file, yuk!
+%D The good news is that it can be rather short. We'll just ask
+%D \BIBTEX\ to output the entire database(s) into the \type{bbl} file.
+%D
+%D The \type{\bibstyle} command controls how the \type{bbl} file will
+%D be sorted. The possibilities are:
+%D
+%D \startitemize[packed]
+%D \item by author (+year, title): cont-au.bst
+%D \item by title (+author, year): cont-ti.bst
+%D \item by short key as in abbrev.bst: cont-ab.bst
+%D \item not sorted at all: cont-no.bst
+%D \stopitemize
+
+\newtoks\everysetupbibtex
+
+\unexpanded\def\setupbibtex
+ {\dosingleempty\dosetupbibtex}
+
+\def\dosetupbibtex[#1]%
+ {\let\@@pbdatabase\empty
+ \getparameters[\??pb][#1]%
+ \the\everysetupbibtex}
+
+\def\installbibtexsorter#1#2%
+ {\setvalue{\??pb:\c!sort:#1}{#2}}
+
+\installbibtexsorter\v!no {no}
+\installbibtexsorter\v!author {au}
+\installbibtexsorter\v!title {ti}
+\installbibtexsorter\v!short {ab}
+\installbibtexsorter\empty {no}
+\installbibtexsorter\s!default{no}
+
+\def\thebibtexsorter{\executeifdefined{\??pb:\c!sort:\@@pbsort}\@@pbsort}
+
+\appendtoks
+ \ifx\@@pbdatabase\empty\else
+ \doifmode{*\v!first}{\ctxlua{bibtex.hacks.process { style="\thebibtexsorter", database="\@@pbdatabase" }}}%
+ \fi
+\to \everysetupbibtex
+
+\setupbibtex
+ [\c!sorttype=\v!cite,
+ \c!sort=no]
+
+%D \macros{iftypesetall,ifbibcitecompress}
+%D
+%D The module needs some new \type{\if} statements.
+
+\newtoks\everysetuppublications
+
+\unexpanded\def\setuppublications
+ {\dosingleargument\dosetuppublications}
+
+\def\dosetuppublications[#1]%
+ {\getparameters[\??pb][\c!alternative=,#1]%
+ \doifsomething\@@pbalternative
+ {\readsysfile{bibl-\@@pbalternative.tex}
+ {\showmessage\m!publications{6}{bibl-\@@pbalternative}}
+ {\showmessage\m!publications{1}{bibl-\@@pbalternative}}%
+ \let\@@pbalternative\empty}%
+ \let\setuppublicationlayout\normalsetuppublicationlayout % overloaded in bibl-num ... vadjust needs to be done with option
+ \getparameters[\??pb][#1]% as bibl-* can have set things back
+ \the\everysetuppublications
+ \ignorespaces}
+
+%D We can omit already shown references (\v!global) or use fresh
+%D lists each time (\v!local).
+
+\chardef\bibtexoncemode\plusone % 0=disable, 1=local, 2=global
+
+\appendtoks
+ \doifelse\@@pbmethod\v!local
+ {\chardef\bibtexoncemode\plusone}%
+ {\chardef\bibtexoncemode\plustwo}%
+\to \everysetuppublications
+
+%D Cite lists are compressed, if possible. This is set later on.
+
+\newif\ifbibcitecompress\bibcitecompresstrue
+
+% \appendtoks
+% \processaction
+% [\@@pbnumbering]
+% [ \v!yes=>\let\@@pbinumbercommand\firstofoneargument,
+% \v!no=>\let\@@pbinumbercommand\gobbleoneargument,
+% \v!short=>\def\@@pbinumbercommand##1{\bibgetvars\currentpublicationkey},
+% \v!bib=>\def\@@pbinumbercommand##1{\bibgetvarn\currentpublicationkey},
+% \s!unknown=>\let\@@pbinumbercommand\firstofoneargument]%
+% \to \everysetuppublications
+
+\def\@@pbinumbercommand{\executeifdefined{\??pb:\c!numbercommand:\@@pbnumbering}\firstofoneargument}
+
+\letvalue{\??pb:\c!numbercommand:\v!yes }\firstofoneargument
+\letvalue{\??pb:\c!numbercommand:\v!no }\gobbleoneargument
+\setvalue{\??pb:\c!numbercommand:\v!short}#1{\bibgetvars\currentpublicationkey}
+\setvalue{\??pb:\c!numbercommand:\v!bib }#1{\bibgetvarn\currentpublicationkey}
+
+% to be tested
+%
+% \setvalue{\??pb:\c!numbercommand:\v!short}{\bibgetvars\currentpublicationkey\firstofoneargument}
+% \setvalue{\??pb:\c!numbercommand:\v!bib }{\bibgetvarn\currentpublicationkey\firstofoneargument}
+
+\appendtoks
+ \processaction
+ [\@@pbrefcommand]
+ [\s!default=>\edef\@@citedefault{\@@pbrefcommand},
+ \s!unknown=>\edef\@@citedefault{\@@pbrefcommand}]%
+\to \everysetuppublications
+
+\def\bibleftnumber#1{#1\hfill~}
+
+%D \macros{usepublications}
+%D
+%D After discussing it with Thomas Schmitz it became clear that using external
+%D references makes no sense as one needs to refer to it in special ways and
+%D because similar numbers can be confusing. So, for the moment this is not
+%D supported in \MKIV. (So no: see reference [3-5,9] in "some other document")
+
+\def\usepublications[#1]%
+ {\processcommalist[#1]\dousepublications}
+
+% \def\dousepublications#1%
+% {\doonlyonce{#1.\f!bibextension}
+% {\readfile{#1.\f!bibextension}
+% {\showmessage\m!publications{4}{#1.\f!bibextension}}
+% {\showmessage\m!publications{2}{#1.\f!bibextension}}}}
+
+\def\dousepublications#1%
+ {\doonlyonce{#1.\f!bibextension}{\dodousepublications{#1}}}
+
+\def\dodousepublications#1%
+ {\let\@@savedpar\par
+ \let\par\ignorespaces
+ \ifhmode\kern\zeropoint\fi
+ \readfile{#1.\f!bibextension}
+ {\showmessage\m!publications{4}{#1.\f!bibextension}}
+ {\showmessage\m!publications{2}{#1.\f!bibextension}}%
+ \ifhmode\removeunwantedspaces\fi
+ \let\par\@@savedpar}
+
+%D \macros{setuppublicationlist}
+%D
+%D This will be the first command in (\BIBTEX-generated) \type{bbl}
+%D files. `samplesize' is a sample value (in case of \BIBTEX-generated
+%D files, this will be the longest `short' key). `totalnumber'
+%D is the total number of entries that will follow in this
+%D file.
+%D
+%D Both values are only needed for the label calculation
+%D if `autohang' is `true', so by default the command is
+%D not even needed, and therefore I saw no need to give
+%D it it's own system variable and it just re-uses \type{pb}.
+
+\def\publicationlistparameter#1{\csname\??pv:l:#1\endcsname}
+
+\unexpanded\def\setuppublicationlist
+ {\dosingleempty\dosetuppublicationlist}
+
+\def\dosetuppublicationlist[#1]%
+ {\getparameters[\??pv:l:][#1]%
+ \setuplist[pubs][\c!samplesize={AA99},\c!alternative=a,\c!interaction=,\c!pagenumber=\v!no,#1,\c!command=]}
+
+\unexpanded\def\setuppublicationlayout[#1]#2%
+ {\setvalue{\??pv:l:#1}{#2}}
+
+\let\normalsetuppublicationlayout\setuppublicationlayout
+
+\setuppublicationlist[\c!title=,\c!command=\dospecialbibinsert,\c!maybeyear=\v!on]
+
+%D \macros{bibalternative}
+%D
+%D A nice little shorthand that will be used so we don't have to
+%D key in the weird \type{\@@pv} parameter names all the time.
+
+\def\bibalternative#1%
+ {\csname\??pv\@@currentalternative#1\endcsname}
+
+%D \macros{simplebibdef,bibcommandlist}
+%D
+%D \type{\simplebibdef} defines \type{bib@#1}, which in turn will
+%D use one argument that is stored in \type{@@pb@#1}.
+%D
+%D \type{\simplebibdef} also defines \type{bibinsert#1}, which can be
+%D used in the argument of \type{\setuppublicationlayout} to fetch
+%D one of the \type{@@pb@} data entries. \type{bibinsert#1} then has
+%D three arguments: \type{#1} are commands to be executed before the
+%D data, \type{#2} are commands to be executed after the data, and
+%D \type{#3} are commands to be executed if the data is not found.
+%D
+%D \type{\bibcommandlist} is the list of commands that is affected
+%D by this approach. Later on, it will be used to do a series
+%D of assignments from \type{#1} to \type{bib@#1}: e.g
+%D \type{\title} becomes \type{\bib@title} when used within
+%D a publication.
+
+\newtoks\initializebibdefinitions % we need to prevent clashes
+
+\def\simplebibdef#1% hh: funny expansion ?
+ {\@EA\long\@EA\def\csname bib@#1\endcsname##1%
+ {\setvalue{\??pb @#1}{##1}\ignorespaces}%
+ \expandafter \appendtoks
+ \expandafter\let\csname insert#1\expandafter\endcsname\csname bibinsert#1\endcsname
+ \to \initializebibdefinitions
+ \@EA\unexpanded\@EA\def\csname bibinsert#1\endcsname##1##2##3%
+ {\@EA\bibdoifelse\@EA{\csname\??pb @#1\endcsname}{##1\csname\??pb @#1\endcsname##2}{##3}}}
+
+\def\bibcommandlist
+ {abstract, annotate, arttitle, assignee, bibnumber, bibtype, biburl, chapter, city,
+ comment, country, day, dayfiled, doi, edition, eprint, howpublished, isbn, issn,
+ issue, journal, keyword, keywords, lastchecked, month, monthfiled, names, nationality,
+ note, notes, organization, pages, pubname, pubyear, revision, series, size, thekey,
+ title, volume, yearfiled}
+
+\processcommacommand[\bibcommandlist]\simplebibdef
+
+% \def\bibinsertdoi#1#2#3%
+% {\begingroup
+% \bibdoifelse{\@@pb@doi}%
+% {\edef\ascii{\detokenize\expandafter{\@@pb@doi}}% probably not ok, to less expansion
+% #1\expanded{\bibgotoDOI{\@@pb@thekey}{\ascii}}#2}{#3}%
+% \endgroup}
+%
+% \def\bibinsertbiburl#1#2#3%
+% {\begingroup
+% \bibdoifelse{\@@pb@biburl}%
+% {\edef\ascii{\detokenize\expandafter{\@@pb@biburl}}% probably not ok, to less expansion
+% #1\expanded{\bibgotoURL{\@@pb@thekey}{\ascii}}#2}{#3}%
+% \endgroup}
+
+\def\bibinsertdoi#1#2#3% let's see how this fails
+ {\bibdoifelse{\@@pb@doi}{#1\expanded{\bibgotoDOI{\@@pb@thekey}{\@@pb@doi}}#2}{#3}}
+
+\def\bibinsertbiburl#1#2#3% let's see how this fails
+ {\bibdoifelse{\@@pb@biburl}{#1\expanded{\bibgotoURL{\@@pb@thekey}{\@@pb@biburl}}#2}{#3}}
+
+\def\bibinsertmonth#1#2#3%
+ {\bibdoifelse\@@pb@month
+ {#1\doifnumberelse\@@pb@month
+ {\doifconversiondefinedelse\@@pbmonthconversion
+ {\convertnumber\@@pbmonthconversion\@@pb@month}{\@@pb@month}}%
+ {\@@pb@month}#2}%
+ {#3}}
+
+\appendtoks
+ \let\inserturl \bibinsertbiburl % for backward compat.
+ \let\inserttype\bibinsertbibtype % for backward compat.
+\to\initializebibdefinitions
+
+\def\newbibfield[#1]%
+ {\simplebibdef{#1}%
+ \edef\bibcommandlist{\bibcommandlist,#1}}
+
+%D \macros{complexbibdef,specialbibinsert}
+%D
+%D The commands \type{\artauthor}, \type{\author} and
+%D \type{\editor} are more complex than the other commands.
+%D Their argument lists have this form:
+%D
+%D \type{\author[junior]{firstnames}[inits]{von}{surname}}
+%D
+%D (bracketed stuff is optional)
+%D
+%D And not only that, but there also might be more than one of each of
+%D these commands. This is why a special command is needed to insert
+%D them, as well as one extra counter for each command.
+
+% todo: instead of \getvalue{bla@num} in specs we should do
+% \bibentrynum{bla} so that we can create a better namespace
+
+%D All of these \type{\@EA}'s and \type{\csnames} make this code
+%D look far more complex than it really is. For example, the argument
+%D \type{author} defines the macro \type{\bib@author} to do two
+%D things: increment the counter \type{\author@num} (let's say to 2)
+%D and next store it's arguments in the macro \type{\@@pb@author2}.
+%D And it defines \type{\bibinsertauthors} to expand into
+%D \starttyping
+%D \specialbibinsert{author}{\author@num}{}{}{}
+%D \stoptyping
+
+% \def\docomplexbibdef#1%
+% {\def\currentype{#1}%
+% \dosingleempty\dodocomplexbibdef}
+
+% \def\dodocomplexbibdef[#1]#2%
+% {\def\firstarg{#1}\def\secondarg{#2}%
+% \dosingleempty\dododocomplexbibdef}
+
+% \def\dododocomplexbibdef[#1]#2#3%
+% {\@EA\increment\csname\currentype @num\endcsname
+% \setevalue{\??pb @\currentype\csname \currentype @num\endcsname}%
+% {{\secondarg}{#2}{#3}{#1}{\firstarg}}\ignorespaces}
+
+\def\docomplexbibdef#1%
+ {\dodoubleempty\dodocomplexbibdef[#1]}
+
+\def\dodocomplexbibdef[#1][#2]#3%
+ {\doquadrupleempty\dododocomplexbibdef[#1][#2][#3]}
+
+\def\dododocomplexbibdef[#1][#2][#3][#4]#5#6%
+ {\@EA\increment\csname#1@num\endcsname % todo: bib in name
+ \setevalue{\??pb @#1\csname#1@num\endcsname}{{#3}{#5}{#6}{#4}{#2}}\ignorespaces}
+
+\def\complexbibdef#1%
+ {\@EA\newcounter\csname #1@num\endcsname
+ \@EA\def\csname bib@#1\endcsname{\docomplexbibdef{#1}}%
+ \expandafter \appendtoks
+ \expandafter\let\csname insert#1s\expandafter\endcsname\csname bibinsert#1s\endcsname
+ \to \initializebibdefinitions
+ \@EA\def\csname bibinsert#1s\endcsname##1##2##3{\specialbibinsert{#1}{\csname #1@num\endcsname}{##1}{\unskip ##2}{##3}}}
+
+\processcommalist[author,artauthor,editor]\complexbibdef
+
+%D Another level of indirection is needed to control the
+%D typesetting of all of these arguments.
+
+\newcount\etallimitcounter
+\newcount\etaldisplaycounter
+\newcount\todocounter
+
+\def\specialbibinsert#1#2#3#4#5%
+ {\bgroup
+ \ifnum#2>\zerocount
+ \etallimitcounter =0\bibalternative{#1etallimit}\relax
+ \etaldisplaycounter=0\bibalternative{#1etaldisplay}\relax
+ \ifnum #2>\etallimitcounter
+ \todocounter\etaldisplaycounter
+ % just in case ...
+ \ifnum\todocounter>\etallimitcounter
+ \todocounter\etallimitcounter
+ \fi
+ \else
+ \todocounter#2\relax
+ \fi
+ \ifnum\todocounter>\zerocount
+ % find the current author list
+ \let\templist\empty
+ \dorecurse{#2}
+ {\scratchtoks\@EA\@EA\@EA{\csname\??pb @#1\recurselevel\endcsname}%
+ \edef\templist{\ifx\templist\empty\else\templist,\fi\the\scratchtoks}}%
+ #3\publicationlistparameter\c!command{#1}{\todocounter}{\templist}#4\relax
+ \else
+ #5%
+ \fi
+ \else
+ #5%
+ \fi
+ \egroup}
+
+%D This macro does the hard work of inserting a list of people in the
+%D output, with proper regard of all the inbetween strings that can
+%D arise depending on length of the list of people.
+
+%D \#1 = type
+%D \#2 = number of items to be typeset
+%D \#3 = commacommand containing authors
+
+% \def\dospecialbibinsert#1#2#3%
+% {\getcommacommandsize[#3]%
+% \scratchcounter\zerocount
+% \def\processauthoritem##1%
+% {\advance\scratchcounter\plusone
+% \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax
+% \publicationlistparameter{#1}##1%
+% \ifnum\scratchcounter=#2\relax
+% \ifnum\etallimitcounter<\commalistsize\relax
+% \bibalternative{#1etaltext}%
+% \fi
+% \else\ifnum\numexpr\scratchcounter+\plusone\relax=#2\relax
+% \ifnum\commalistsize>\plustwo
+% \bibalternative\c!finalnamesep
+% \else
+% \bibalternative\c!lastnamesep
+% \fi
+% \else
+% \bibalternative\c!namesep
+% \fi\fi
+% \fi}%
+% \processcommacommand[#3]\processauthoritem}
+
+\def\doprocessauthoritem#1#2#3%
+ {\advance\scratchcounter\plusone
+ \ifnum\numexpr\scratchcounter-\plusone\relax<#2\relax
+ \publicationlistparameter{#1}#3%
+ \ifnum\scratchcounter=#2\relax
+ \ifnum\etallimitcounter<\commalistsize\relax
+ \bibalternative{#1etaltext}%
+ \fi
+ \else\ifnum\numexpr\scratchcounter+\plusone\relax=#2\relax
+ \ifnum\commalistsize>\plustwo
+ \bibalternative\c!finalnamesep
+ \else
+ \bibalternative\c!lastnamesep
+ \fi
+ \else
+ \bibalternative\c!namesep
+ \fi\fi
+ \fi}
+
+\def\dospecialbibinsert#1#2#3%
+ {\getcommacommandsize[#3]%
+ \scratchcounter\zerocount
+ \processcommacommand[#3]{\doprocessauthoritem{#1}{#2}}}
+
+%D \macros{invertedauthor,normalauthor,invertedshortauthor,normalshortauthor}
+%D
+%D Just some commands that can be used in \type{\setuppublicationparameters}
+%D If you want to write an extension to the styles, you might
+%D as well define some of these commands yourself.
+%D
+%D The argument list has been reordered here, and the meanings
+%D are:
+%D
+%D \startlines
+%D \type{#1} firstnames
+%D \type{#2} von
+%D \type{#3} surname
+%D \type{#4} inits
+%D \type{#5} junior
+%D \stoplines
+
+\def\normalauthor#1#2#3#4#5%
+ {\bibdoif{#1}{#1\bibalternative\c!firstnamesep}%
+ \bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}}
+
+\def\normalshortauthor#1#2#3#4#5%
+ {\bibdoif{#4}{#4\bibalternative\c!firstnamesep}%
+ \bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!surnamesep#5\unskip}}
+
+\def\invertedauthor#1#2#3#4#5%
+ {\bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!juniorsep#5}%
+ \bibdoif{#1}{\bibalternative\c!surnamesep#1\unskip}}
+
+\def\invertedshortauthor#1#2#3#4#5%
+ {\bibdoif{#2}{#2\bibalternative\c!vonsep}%
+ #3%
+ \bibdoif{#5}{\bibalternative\c!juniorsep#5}%
+ \bibdoif{#4}{\bibalternative\c!surnamesep#4\unskip}}
+
+%D \macros{clearbibitem,clearbibitemtwo,bibitemdefs}
+%D
+%D These are used in \type{\typesetapublication} to do
+%D initializations and cleanups.
+
+\def\clearbibitem#1{\setvalue{\??pb @#1}{}}%
+
+% \def\clearbibitemtwo#1%
+% {\letvalue{#1@num}\!!zerocount
+% \doloop
+% {\doifdefinedelse{\??pb @#1\recurselevel}
+% {\letvalue{\??pb @#1\recurselevel}\empty} % why not undefined?
+% {\exitloop}}}
+
+% \def\clearbibitemtwo#1%
+% {\letvalue{#1@num}\!!zerocount
+% \doloop
+% {\ifcsname\??pb @#1\recurselevel\endcsname
+% \expandafter\let\csname\??pb @#1\recurselevel\undefined
+% \else
+% \exitloop
+% \fi}}
+
+\def\clearbibitemtwo#1% is this reset really needed? after all we reset the counter and we are local
+ {%\dofastrecurse\plusone{\csname#1@num\endcsname}\plusone{\expandafter\let\csname\??pb @#1\recurselevel\undefined}%
+ \letvalue{#1@num}\!!zerocount}
+
+\def\bibitemdefs#1%
+ {\@EA\let\csname#1\expandafter\endcsname\csname bib@#1\endcsname}
+
+\def\presetbibvariables % make a fast resetter (toks)
+ {\processcommacommand[\bibcommandlist,crossref]\clearbibitem
+ \processcommalist [artauthor,author,editor]\clearbibitemtwo
+ \processcommacommand[\bibcommandlist]\bibitemdefs
+ \processcommalist [artauthor,author,editor,crossref]\bibitemdefs}
+
+%D \macros{startpublication}
+%D
+%D We are coming to the end of this module, to the macros that
+%D do typesetting and read the \type{bbl} file.
+
+\newcount\bibtexcounter
+
+%D Just a \type{\dosingleempty} is the most friendly
+%D of doing this: there need not even be an argument
+%D to \type{\startpublication}. Of course, then there
+%D is no key either, and it had better be an
+%D article (otherwise the layout will be all screwed up).
+%D
+%D Only specifying the key in the argument is also
+%D legal. In storing this stuff into macros, some trickery with
+%D token registers is needed to fix the expansion problems. Even so,
+%D this appears to not always be 100\% safe, so people are
+%D urgently advised to use \ETEX\ instead of traditional \TEX.
+%D
+%D In \ETEX, all expansion problems are conveniently solved by
+%D the primitive \type{\protected}. To put that another way:
+%D
+%D It's not a bug in this module if it does not appear in \ETEX!
+%D
+%D Now prohibits comments, so % can be used for urls
+
+\unexpanded\def\startpublication
+ {\begingroup
+ \catcode`\%=\othercatcode
+ \dosingleempty\dostartpublication}
+
+\let\stoppublication\relax
+
+% this is rather memory hungry; some day i will rewrite this so that
+% we use the database instead
+
+%D \macros{doifbibreferencefoundelse}
+%D
+%D Some macros to fetch the information provided by
+%D \type{\startpublication}.
+
+% we can consider a faster variant in the bbl file; we can also consider
+% storing the keys in lua (and then do more in lua) and use calls to
+% fetch the variables
+
+% hm, we can store at the lua end ...
+
+\long\def\dostartpublication[#1]#2\stoppublication
+ {\doifassignmentelse{#1}%
+ {\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}%
+ {\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}%
+ \ctxlua{bibtex.hacks.register("\@@pbk")}%
+ \setxvalue{pbd:\@@pbk}##1{\noexpand\ifcase##1\noexpand\or
+ \@@pbk\noexpand\or
+ \@@pba\noexpand\or
+ \@@pby\noexpand\or
+ \@@pbs\noexpand\or
+ \@@pbn\noexpand\or
+ \@@pbt\noexpand\or
+ \@@pbo\noexpand\or
+ \@@pbu\noexpand\or
+ \normalunexpanded{#2}\noexpand\fi}%
+ \endgroup
+ \ignorespaces}
+
+\def\bibgetvark#1{\csname pbd:#1\endcsname\plusone }
+\def\bibgetvara#1{\csname pbd:#1\endcsname\plustwo }
+\def\bibgetvary#1{\csname pbd:#1\endcsname\plusthree}
+\def\bibgetvars#1{\csname pbd:#1\endcsname\plusfour }
+\def\bibgetvarn#1{\csname pbd:#1\endcsname\plusfive }
+\def\bibgetvart#1{\csname pbd:#1\endcsname\plussix }
+\def\bibgetvaro#1{\csname pbd:#1\endcsname\plusseven}
+\def\bibgetvaru#1{\csname pbd:#1\endcsname\pluseight}
+\def\bibgetvard#1{\csname pbd:#1\endcsname\plusnine }
+
+\def\doifbibreferencefoundelse#1%
+ {\preloadbiblist
+ \doifdefinedelse{pbd:#1}
+ \firstoftwoarguments
+ {\showmessage\m!publications{5}{#1 is unknown}\secondoftwoarguments}}
+
+%D \macros{bib@crossref}
+%D
+%D \type{\crossref} is used in database files to point to another
+%D entry. Because of this special situation, it has to be defined
+%D separately. Since this command will not be seen until at
+%D \type{\placepublications}, it may force extra runs. The same is
+%D true for \type{\cite} commands inside of publications.
+
+% used in bib self
+
+\def\bib@crossref#1% called via \csname \endcsname
+ {\setvalue{\??pb @crossref}{#1}\ignorespaces}
+
+\def\bibinsertcrossref#1#2#3%
+ {\bibdoifelse\@@pb@crossref{#1\cite[\@@pb@crossref]#2}{#3}}
+
+\appendtoks\let\insertcrossref\bibinsertcrossref\to\initializebibdefinitions
+
+%D The next macro is needed because the number command of the
+%D publist sometimes needs to fetch something from the current
+%D item (like the 'short' key). For this, the ID of the current
+%D item is passed in the implict parameter \type{\currentpublicationkey}
+
+\def\doprocessbibtexentry#1{\typesetapublication{#1}}
+
+\def\typesetpubslist
+ {\dobeginoflist
+ % \the\initializebibdefinitions % COMMENTED
+ \edef\currentlist{pubs}%
+ \doif{\listparameter\c!criterium}\v!cite{\setuplist[pubs][\c!criterium=\v!here]}%
+ \ctxlua{bibtex.hacks.reset(\number\bibtexoncemode)}%
+ \placestructurelist{pubs}{\listparameter\c!criterium}{\listparameter\c!number}%
+ \ctxlua{bibtex.hacks.flush("\@@pbsorttype")}%
+ \doendoflist}
+
+\newif\ifinpublist
+
+\def\initializepubslist
+ {\def\currentlist{pubs}%
+ \edef\@@pbnumbering{\@@pbnumbering}%
+ \doifelse\@@pbautohang\v!yes
+ {\ifx\@@pbnumbering\v!short
+ \setbox\scratchbox\hbox{\@@pbnumbercommand{\listparameter\c!samplesize}}%
+ \else
+ \setbox\scratchbox\hbox{\@@pbnumbercommand{\ctxlua{tex.write(structure.lists.size())}}}%
+ \fi
+ \edef\publistnumberbox{\hbox to \the\wd\scratchbox}%
+ \expanded{\setuplist[pubs][\c!width=\the\wd\scratchbox,\c!distance=\zeropoint]}%
+ \ifx\@@pbnumbering\v!short
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{\bibgetvars\currentpublicationkey}}}%
+ \else\ifx\@@pbnumbering\v!bib
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{\bibgetvarn\currentpublicationkey}}}%
+ \else
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{##1}}}%
+ \fi\fi}
+ {\doifelsenothing{\listparameter\c!width}
+ {\let \publistnumberbox \hbox}
+ {\edef\publistnumberbox{\hbox to \listparameter\c!width}}%
+ \ifx\@@pbnumbering\v!short
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{\bibgetvars\currentpublicationkey}}}%
+ \else\ifx\@@pbnumbering\v!bib
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{\bibgetvarn\currentpublicationkey}}}%
+ \else
+ \def\@@pblimitednumber##1{\publistnumberbox{\@@pbnumbercommand{##1}}}%
+ \fi\fi}%
+ \ifx\@@pbnumbering\v!no
+ \setuplist[pubs][\c!numbercommand=,\c!symbol=\v!none,\c!textcommand=\outdented]%
+ \else
+ \setuplist[pubs][\c!numbercommand=\@@pblimitednumber]%
+ \fi
+ \doifelse{\publicationlistparameter\c!maybeyear}{\v!off}{\def\maybeyear##1{}}{\def\maybeyear##1{##1}}%
+ \forgetall}
+
+\def\outdented#1% move to supp-box ?
+ {\hskip-\hangindent#1\relax}
+
+%D The full list of publications
+
+\def\completepublications
+ {\dosingleempty\docompletepublications}
+
+\def\docompletepublications[#1]%
+ {\begingroup
+ \setuplist[pubs][\c!criterium=\v!previous,#1]
+ \doifelsenothing{\publicationlistparameter\c!title}
+ {\systemsuppliedchapter[pubs]{\headtext{pubs}}}
+ {\normalexpanded{\systemsuppliedchapter[pubs]{\publicationlistparameter\c!title}}}%
+ \dodoplacepublications}
+
+%D And the portion with the entries only.
+
+\def\bibrefprefix{\number\bibtexblock:}
+
+\unexpanded\def\placepublications
+ {\dosingleempty\doplacepublications}
+
+\def\doplacepublications[#1]%
+ {\begingroup
+ \setuplist[pubs][\c!criterium=\v!previous,#1]%
+ \dodoplacepublications}
+
+\def\dodoplacepublications
+ {\determinelistcharacteristics[pubs]%
+ \initializepubslist
+ \doifnot{\namedlistparameter{pubs}\c!option}\v!continue
+ {\global\bibtexcounter\zerocount}%
+ \inpublisttrue
+ \typesetpubslist
+ \inpublistfalse
+ \endgroup
+ \global\advance\bibtexblock\plusone}
+
+%D \subsubject{What's in a publication}
+
+\unexpanded\def\typesetapublication#1%
+ {\doifsomething{#1}
+ {\doifelse{\namedlistparameter{pubs}\c!criterium}\v!all
+ {\doplacepublicationindeed{#1}}%
+ {\ctxlua{bibtex.hacks.doifalreadyplaced("#1")}
+ {}
+ {\doplacepublicationindeed{#1}}}%
+ }}
+
+% for the moment we don't access the data directly but we will do that
+% later when we get away from storing the data and only deal with
+% references
+
+% we'll define proper handlers later
+
+\def\doplacepublicationindeed#1%
+ {\doifbibreferencefoundelse{#1}
+ {\global\advance\bibtexcounter\plusone
+ \def\currentpublicationkey{#1}%
+ \ctxlua{bibtex.hacks.registerplaced("#1")}%
+ \dodolistelement
+ {pubs}%
+ {}%
+ {\number\bibtexcounter}%
+ {\expanded{\reference[\bibrefprefix#1]{\number\bibtexcounter}}%
+ \strut\dotypesetapublication{#1}\strut}%
+ {}%
+ {}}
+ {}} % invalid
+
+\def\dotypesetapublication#1%
+ {\bgroup
+ \the\initializebibdefinitions % NEW
+ \def\@@currentalternative{:l:}%
+ \presetbibvariables
+ \let\biblanguage\empty
+ \ignorespaces
+ \bibgetvard{#1}%
+ \removeunwantedspaces
+ \ignorespaces
+ \bibalternative{\bibgetvart{#1}}%
+ \removeunwantedspaces
+ \egroup}
+
+%D An few afterthoughts:
+
+\let\maybeyear\gobbleoneargument
+\let\noopsort \gobbleoneargument
+
+%D This is the result of bibtex's `language' field.
+
+\def\setbiblanguage#1#2{\setvalue{\??pb\s!language#1}{#2}}
+
+\def\lang#1%
+ {\edef\biblanguage{#1}%
+ \ifcsname\??pb\s!language#1\endcsname
+ \language[\getvalue{\??pb\s!language#1}]%
+ \fi
+ \ignorespaces}
+
+%D \subject{Citations}
+
+%D \macros{cite,bibref}
+%D
+%D The indirection with \type{\dobibref} allows \LATEX\ style
+%D \type{\cite} commands with a braced argument (these might appear
+%D in included data from the \type{.bib} file).
+
+% \unexpanded\def\cite
+% {\doifnextoptionalelse\dodocite\dobibref}
+% \def\dobibref#1%
+% {\docite[#1][]}
+% \def\dodocite[#1]%
+% {\startstrictinspectnextcharacter
+% \dodoubleempty\dododocite[#1]}
+% \def\dododocite % [#1][#2]
+% {\stopstrictinspectnextcharacter
+% \docite}
+
+\unexpanded\def\cite
+ {\strictdoifnextoptionalelse\dodocite\dobibref}
+
+\def\dobibref#1%
+ {\docite[#1][]}
+
+\def\dodocite[#1]%
+ {\strictdoifnextoptionalelse{\docite[#1]}{\docite[#1][]}}
+
+\def\docite[#1][#2]%
+ {\begingroup
+ \doifelsenothing{#2}\secondargumentfalse\secondargumenttrue
+ \ifsecondargument
+ \dowhatevercite{#1}{#2}%
+ \else
+ \donumberedcite{#1}%
+ \fi
+ \endgroup}
+
+\def\dowhatevercite#1#2%
+ {\processcommalist[#2]\docitation
+ \setupinteraction[\c!style=]%
+ \doifassignmentelse
+ {#1}%
+ {\getparameters[LO][\c!alternative=,\c!extras=,#1]%
+ \edef\@@currentalternative{\LOalternative}%
+ \ifx\@@currentalternative\empty
+ \edef\@@currentalternative{\@@citedefault}%
+ \fi
+ \ifx\LOextras\empty
+ \setupcite[\@@currentalternative][#1]%
+ \else
+ \expandafter\ifx\csname LOright\endcsname \relax
+ \edef\LOextras{{\LOextras\bibalternative\c!right}}%
+ \else
+ \edef\LOextras{{\LOextras\LOright}}%
+ \fi
+ \expanded{\setupcite[\@@currentalternative][#1,\c!right=\LOextras]}%
+ \fi}%
+ {\def\@@currentalternative{#1}}%
+ \doifelsevalue{@@pv\@@currentalternative\c!compress}\v!no\bibcitecompressfalse\bibcitecompresstrue
+ \getvalue{bib\@@currentalternative ref}[#2]}
+
+\def\donumberedcite#1%
+ {\processcommalist[#1]\docitation
+ \setupinteraction[\c!style=]%
+ \edef\@@currentalternative{\@@citedefault}%
+ \doifelsevalue{@@pv\@@currentalternative\c!compress}\v!no\bibcitecompressfalse\bibcitecompresstrue
+ \getvalue{bib\@@citedefault ref}[#1]}
+
+%D \macros{nocite}
+
+\def\nocite[#1]%
+ {\processcommalist[#1]\docitation}
+
+%D \macros{setupcite}
+
+\unexpanded\def\setupcite{\dodoubleempty\dosetupcite}
+
+\def\dosetupcite[#1][#2]%
+ {\ifsecondargument
+ \def\dodosetupcite##1{\getparameters[\??pv##1][#2]}%
+ \processcommalist[#1]\dodosetupcite
+ \else % default case
+ \getparameters[\??pv\@@citedefault][#1]%
+ \fi}
+
+%D Low-level stuff
+
+\def\getcitedata#1[#2]#3[#4]#5to#6%
+ {\bgroup
+ \dofetchapublication{#4}%
+ \doifdefinedelse{\??pb @bib#2}%
+ {\xdef#6{\getvalue{\??pb @bib#2}}}%
+ {\xdef#6{\getvalue{\??pb @#2}}}%
+ \egroup}
+
+\def\dofetchapublication#1%
+ {\def\currentpublicationkey{#1}%
+ \presetbibvariables
+ \ignorespaces\bibgetvard{#1}}
+
+\def\docitation#1%
+ {\iftrialtypesetting \else
+ \expanded{\writedatatolist[pubs][bibref=#1]}%
+ \fi}
+
+\let\addthisref\gobbleoneargument % keep this for compatibility
+
+%D \macros{ixbibauthoryear,thebibauthors,thebibyears}
+%D
+%D If compression of \type{\cite}'s argument expansion is on,
+%D the macros that deal with authors and years call this internal
+%D command to do the actual typesetting.
+%D
+%D Two entries with same author but with different years may
+%D be condensed into ``Author (year1,year2)''. This is about the
+%D only optimization that makes sense for the (author,year)
+%D style of citations (years within one author have to be unique
+%D anyway so no need to test for that, and ``Author1, Author2 (year)''
+%D creates more confusion than it does good).
+%D
+%D In the code below,
+%D the macro \type{\thebibauthors} holds the names of the alternative
+%D author info fields for the current list. This is a commalist,
+%D and \type{\thebibyears} holds the (collection of) year(s) that go with
+%D this author (possibly as a nested commalist).
+%D
+%D There had better be an author for all cases, but there
+%D does not have to be year info always. \type{\thebibyears} is
+%D pre-initialized because this makes the insertion macros simpler.
+%D
+%D In `normal' \TeX, of course there are expansion problems again.
+
+\def\ixbibauthoryear#1#2#3#4%
+ {\bgroup
+ \gdef\ixlastcommand {#4}%
+ \gdef\ixsecondcommand{#3}%
+ \gdef\ixfirstcommand {#2}%
+ \glet\thebibauthors \empty
+ \glet\thebibyears \empty
+ \getcommalistsize[#1]%
+ \ifbibcitecompress
+ \dorecurse\commalistsize{\xdef\thebibyears{\thebibyears,}}%
+ \processcommalist[#1]\docompressbibauthoryear
+ \else
+ \processcommalist[#1]\donormalbibauthoryear
+ \fi
+ \egroup
+ \dobibauthoryear}
+
+%D \macros{dodobibauthoryear}
+%D
+%D This macro only has to make sure that the lists
+%D \type{\thebibauthors} and \type{\thebibyears} are printed.
+
+\def\dobibauthoryear
+ {\scratchcounter\zerocount
+ \getcommacommandsize[\thebibauthors]%
+ \edef\authorcount{\commalistsize}%
+ \@EA\processcommalist\@EA[\thebibauthors]\dodobibauthoryear}
+
+\def\dodobibauthoryear#1%
+ {\advance\scratchcounter\plusone
+ \edef\wantednumber{\the\scratchcounter}%
+ \getfromcommacommand[\thebibyears][\wantednumber]%
+ \@EA\def\@EA\currentbibyear\@EA{\commalistelement}%
+ \setcurrentbibauthor{#1}%
+ \ifnum\scratchcounter=\plusone
+ \ixfirstcommand
+ \else\ifnum \scratchcounter=\authorcount\relax
+ \ixlastcommand
+ \else
+ \ixsecondcommand
+ \fi\fi}
+
+\def\setcurrentbibauthor#1%
+ {\getcommacommandsize[#1]%
+ \ifcase\commalistsize
+ % anonymous?
+ \let\currentbibauthor\empty
+ \or
+ \def\currentbibauthor{#1}%
+ \or
+ \expanded{\docurrentbibauthor#1}%
+ \else
+ \handlemultiplebibauthors{\commalistsize}{#1}%
+ \fi}
+
+\newcount\citescratchcounter
+
+\def\handlemultiplebibauthors#1#2%
+ {\citescratchcounter\zerocount
+ \let\currentbibauthor\empty
+ \def\bibprocessauthoritem##1%
+ {\advance\citescratchcounter\plusone
+ \ifnum \citescratchcounter=#1\relax
+ \edef\currentbibauthor{\currentbibauthor##1}%
+ \else\ifnum\numexpr\citescratchcounter+\plusone\relax=#1\relax
+ \edef\currentbibauthor{\currentbibauthor##1\bibalternative{andtext}}%
+ \else
+ \edef\currentbibauthor{\currentbibauthor##1\bibalternative{namesep}}%
+ \fi\fi}%
+ \processcommalist[#2]\bibprocessauthoritem}
+
+\setupcite
+ [author,authoryear,authoryears]
+ [\c!namesep={, }]
+
+%D This discovery of authoretallimit is not the best one,
+%D but it will do for now.
+
+\def\docurrentbibauthor#1,#2%
+ {\doifemptyelse{#2}
+ {\def\currentbibauthor{#1\bibalternative{otherstext}}}
+ {\@EA\ifx\csname\??pv\@@currentalternative authoretallimit\endcsname\relax
+ \edef\currentbibauthor{#1\bibalternative{andtext}#2}%
+ \else
+ \edef\currentbibauthor{#1%
+ \ifcase0\bibalternative{authoretallimit}\relax\or
+ \bibalternative{otherstext}\else\bibalternative{andtext}#2\fi}%
+ \fi}}
+
+%D This is not the one Hans made for me, because I need a global
+%D edef, and the \type{\robustdoifinsetelse} doesn't listen to
+%D \type{\doglobal }
+
+\def\robustaddtocommalist#1#2% {item} \cs
+ {\robustdoifinsetelse{#1}#2\resetglobal
+ {\dodoglobal\xdef#2{\ifx#2\empty\else#2,\fi#1}}}
+
+%D \macros{donormalbibauthoryear}
+%D
+%D Now we get to the macros that fill the two lists.
+%D The `simple' one really is quite simple.
+
+\def\donormalbibauthoryear#1%
+ {\def\myauthor{Xxxxxxxxxx}%
+ \def\myyear{0000}%
+ \doifbibreferencefoundelse{#1}
+ {\def\myauthor{{\bibgetvara{#1}}}%
+ \def\myyear {\bibgetvary{#1}}}%
+ {}%
+ \@EA\doglobal\@EA\appendtocommalist\@EA{\myauthor}\thebibauthors
+ \@EA\doglobal\@EA\appendtocommalist\@EA{\myyear }\thebibyears}
+
+%D \macros{docompressbibauthoryear}
+%D
+%D So much for the easy parts. Nothing at all will be done if
+%D the reference is not found or the reference does not contain
+%D author data. No questions marks o.s.s. (to be fixed later)
+
+\def\docompressbibauthoryear#1%
+ {\def\myauthor{Xxxxxxxxxx}%
+ \def\myyear {0000}%
+ \doifbibreferencefoundelse{#1}
+ {\xdef\myauthor{\bibgetvara{#1}}%
+ \xdef\myyear {\bibgetvary{#1}}}
+ {}%
+ \ifx\myauthor\empty\else
+ \checkifmyauthoralreadyexists
+ \findmatchingyear
+ \fi}
+
+%D two temporary counters. One of these two can possibly be replaced
+%D by \type{\scratchcounter}.
+
+\newcount\bibitemcounter
+\newcount\bibitemwanted
+
+%D The first portion is simple enough: if this is the very first author
+%D it is quite straightforward to add it. \type{\bibitemcounter} and
+%D \type{\bibitemwanted} are needed later to insert the year
+%D information in the correct item of \type{\thebibyears}
+
+\def\checkifmyauthoralreadyexists
+ {\doifemptyelsevalue{thebibauthors}
+ {\global\bibitemwanted \plusone
+ \global\bibitemcounter\plusone
+ \xdef\thebibauthors{{\myauthor}}}
+ {% the next weirdness is because according to \getcommalistsize,
+ % the length of \type{[{{},{}}]} is 2.
+ \@EA\getcommalistsize\@EA[\thebibauthors,]%
+ \global\bibitemcounter\numexpr\commalistsize+\minusone\relax
+ \global\bibitemwanted \zerocount
+ \processcommacommand[\thebibauthors]\docomparemyauthor}}
+
+%D The outer \type{\ifnum} accomplishes the addition of
+%D a new author to \type{\thebibauthors}. The messing about with
+%D the two counters is again to make sure that \type{\thebibyears}
+%D will be updated correctly.If the author {\it was} found,
+%D the counters will stay at their present values and everything
+%D will be setup properly to insert the year info.
+
+\def\docomparemyauthor#1%
+ {\global\advance\bibitemwanted \plusone
+ \def\mytempc{#1}%
+ \ifx\mytempc\myauthor
+ \quitcommalist
+ \else\ifnum\bibitemwanted=\bibitemcounter\relax
+ \global\advance\bibitemwanted \plusone
+ \global\bibitemcounter\bibitemwanted\relax
+ \@EA\doglobal\@EA\robustaddtocommalist\@EA{{\myauthor}}\thebibauthors
+ \fi\fi}
+
+%D This macro should be clear now.
+
+\def\findmatchingyear
+ {\edef\wantednumber{\the\bibitemwanted}%
+ \getfromcommacommand[\thebibyears][\wantednumber]%
+ \ifx\commalistelement\empty
+ \edef\myyear{{\myyear}}%
+ \else
+ \edef\myyear{{\commalistelement,\myyear}}%
+ \fi
+ \edef\newcommalistelement{\myyear}%
+ \doglobal\replaceincommalist \thebibyears \wantednumber}
+
+%D \macros{gotobiblink,inbiblink,atbiblink}
+%D
+%D The final task is looping over that list until a match is found.
+
+\def\gotobiblink#1[#2]{\doifreferencefoundelse{\bibrefprefix#2}{\goto{#1}[\bibrefprefix#2]}{\unknownreference{#2}}}
+\def\atbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\at [\bibrefprefix#1]}{\unknownreference{#1}}}
+\def\inbiblink [#1]{\doifreferencefoundelse{\bibrefprefix#1}{\expanded{\goto{\currentreferencetext}}[\bibrefprefix#1]}{\unknownreference{#1}}}
+
+%D \macros{bibauthoryearref,bibauthoryearsref,bibauthorref,bibyearref}
+%D
+%D Now that all the hard work has been done, these are simple.
+%D \type{\ixbibauthoryearref} stores the data in the macros
+%D \type{\currentbibauthor} and \type{\currentbibyear}.
+
+\def\ifbibinteractionelse
+ {\iflocation
+ \edef\test{\bibalternative\c!interaction}%
+ \ifx\test\v!stop
+ \@EA\@EA\@EA\secondoftwoarguments
+ \else
+ \@EA\@EA\@EA\firstoftwoarguments
+ \fi
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
+\def\ifbibinteractionelse
+ {\iflocation
+ \doifelse{\bibalternative\c!interaction}\v!stop
+ {\@EA\secondoftwoarguments}
+ {\@EA\firstoftwoarguments}%
+ \else
+ \@EA\secondoftwoarguments
+ \fi}
+
+\def\bibmaybeinteractive#1#2%
+ {\ifbibcitecompress
+ #2%
+ \else
+ \ifbibinteractionelse{\gotobiblink{#2}[#1]}{#2}%
+ \fi}
+
+\def\bibauthoryearref[#1]%
+ {\ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left{\currentbibyear}\bibalternative\v!right}}
+ {\bibalternative\c!pubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}}
+ {\bibalternative\c!lastpubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween
+ \bibalternative\v!left {\currentbibyear}\bibalternative\v!right}}}
+
+\def\bibauthoryearsref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}
+ {\bibalternative\c!pubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}
+ {\bibalternative\c!lastpubsep
+ \bibmaybeinteractive{#1}{{\currentbibauthor}\bibalternative\c!inbetween{\currentbibyear}}}%
+ \bibalternative\v!right}
+
+\def\bibauthorref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibauthor}}}
+ {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibauthor}}}
+ {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibauthor}}}%
+ \bibalternative\v!right}
+
+\def\bibyearref[#1]%
+ {\bibalternative\v!left
+ \ixbibauthoryear{#1}%
+ {\bibmaybeinteractive{#1}{{\currentbibyear}}}
+ {\bibalternative\c!pubsep \bibmaybeinteractive{#1}{{\currentbibyear}}}
+ {\bibalternative\c!lastpubsep\bibmaybeinteractive{#1}{{\currentbibyear}}}%
+ \bibalternative\v!right}
+
+%D \macros{bibshortref,bibkeyref,bibpageref,bibtyperef,bibserialref}
+%D
+%D There is hardly any point in trying to compress these. The only
+%D thing that needs to be done is making sure that
+%D the separations are inserted correctly. And that is
+%D what \type{\bibinsertrefsep} does.
+
+\newconditional\firstbibrefsep
+
+\def\bibresetrefsep
+ {\settrue\firstbibrefsep}
+
+\def\bibinsertrefsep
+ {\ifconditional\firstbibrefsep
+ \setfalse\firstbibrefsep
+ \else
+ \bibalternative\c!pubsep
+ \fi}
+
+\def\bibshortref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibshortref
+ \bibalternative\v!right}
+
+\def\dobibshortref#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\gotobiblink{\bibgetvars{#1}}[#1]}
+ {\unknownreference{#1}}}
+
+\def\bibserialref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibserialref
+ \bibalternative\v!right}
+
+\def\dobibserialref#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\gotobiblink{\bibgetvarn{#1}}[#1]}
+ {\unknownreference{#1}}}
+
+\def\bibkeyref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibkeyref
+ \bibalternative\v!right}
+
+\def\dobibkeyref#1%
+ {\bibinsertrefsep
+ \gotobiblink{#1}[#1]}
+
+\def\bibgotoDOI#1#2%
+ {\ifbibinteractionelse
+ {\useURL[bibfooDoi#1][#2]%
+ \useURL[bibfoo#1][http://dx.doi.org/#2]%
+ \goto{\url[bibfooDoi#1]}[url(bibfoo#1)]}
+ {\hyphenatedurl{#2}}}
+
+\def\bibdoiref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibdoiref
+ \bibalternative\v!right}
+
+\def\dobibdoiref#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\expanded{\bibgotoDOI{#1}{\bibgetvaro{#1}}}}
+ {\unknownreference{#1}}}
+
+\def\biburlref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobiburlref
+ \bibalternative\v!right}
+
+\def\bibgotoURL#1#2%
+ {\ifbibinteractionelse
+ {\useURL[bibfoo#1][#2]\goto{\url[bibfoo#1]}[url(bibfoo#1)]}
+ {\hyphenatedurl{#2}}}
+
+\def\dobiburlref#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\expanded{\bibgotoURL{#1}{\bibgetvaru{#1}}}}
+ {\unknownreference{#1}}}
+
+\def\bibtyperef[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibtyperef
+ \bibalternative\v!right}
+
+\def\dobibtyperef#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\gotobiblink{\bibgetvart{#1}}[#1]}
+ {\unknownreference{#1}}}
+
+\def\bibpageref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibpageref
+ \bibalternative\v!right}
+
+\def\dobibpageref#1%
+ {\bibinsertrefsep
+ \ifbibinteractionelse
+ {\atbiblink[#1]}
+ {{\referencingfalse\at[#1]}}}
+
+\def\bibdataref[#1]%
+ {\bibalternative\v!left
+ \bibresetrefsep\processcommalist[#1]\dobibdata
+ \bibalternative\v!right}
+
+\def\dobibdata#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\dotypesetapublication{#1}}
+ {\unknownreference{#1}}}
+
+\let\bibnoneref\nocite
+
+%D \macros{bibnumref}
+
+\def\bibnumref[#1]%
+ {\begingroup
+ \bibalternative\v!left
+ \penalty\!!tenthousand
+ \ctxlua{bibtex.hacks.resolve("","\number\bibtexblock","#1")}%
+ \bibalternative\v!right
+ \endgroup}
+
+\def\dowithbibtexnumrefconnector#1#2%
+ {\ifnum#1>\plusone
+ \ifnum#2>\plusone
+ \ifnum#2=#1\relax
+ \bibalternative{lastpubsep}%
+ \else
+ \bibalternative{pubsep}%
+ \fi
+ \fi
+ \fi}
+
+\def\dowithbibtexnumref#1#2#3#4#5% n, i, prefix block ref
+ {\dowithbibtexnumrefconnector{#1}{#2}%
+ \def\bibrefprefix{#4:}%
+ \inbiblink[#5]}
+
+\def\dowithbibtexnumrefrange#1#2#3#4#5#6#7% n, i, prefix block ref
+ {\dowithbibtexnumrefconnector{#1}{#2}%
+ \def\bibrefprefix{#4:}%
+ \inbiblink[#5]%
+ \endash
+ \def\bibrefprefix{#6:}%
+ \inbiblink[#7]}
+
+%D By request from Sanjoy. This makes it easier to implement
+%D \type{\citeasnoun}.
+
+\def\bibauthornumref[#1]%
+ {\getcommalistsize[#1]%
+ \global\bibitemcounter\commalistsize
+ \bibresetrefsep
+ \processcommalist[#1]\dobibauthornumref }
+
+\def\dobibauthornumref#1%
+ {\bibinsertrefsep
+ \doifbibreferencefoundelse{#1}
+ {\begingroup
+ \bibgetvara{#1}%
+ \bibalternative\c!inbetween
+ \setuppublications[\c!refcommand=num]%
+ \cite[#1]%
+ \endgroup}
+ {\unknownreference{#1}}}
+
+%D And some defaults are loaded from bibl-apa:
+
+\def\c!monthconversion{monthconversion} % todo
+
+\setuppublications
+ [\c!monthconversion=,
+ \c!alternative=apa,
+ \c!method=\v!global,
+ \c!refcommand=num,
+ \c!numbercommand=\bibleftnumber]
+
+\def\preloadbiblist
+ {\globallet\preloadbiblist\relax
+ \dousepublications\jobname}
+
+% \appendtoks \preloadbiblist \to \everysetuppublications
+% \appendtoks \preloadbiblist \to \everystarttext
+
+\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/bibl-tst.lua b/Master/texmf-dist/tex/context/base/bibl-tst.lua
index a1b85b0f78b..5ff8f45709f 100644
--- a/Master/texmf-dist/tex/context/base/bibl-tst.lua
+++ b/Master/texmf-dist/tex/context/base/bibl-tst.lua
@@ -11,8 +11,8 @@ bibtex.load(session,"texgraph.bib")
bibtex.load(session,"texjourn.bib")
bibtex.load(session,"texnique.bib")
bibtex.load(session,"tugboat.bib")
+print(bibtex.size,statistics.elapsedtime(bibtex))
bibtex.toxml(session)
-
print(bibtex.size,statistics.elapsedtime(bibtex))
--~ print(table.serialize(session.data))
diff --git a/Master/texmf-dist/tex/context/base/blob-ini.lua b/Master/texmf-dist/tex/context/base/blob-ini.lua
new file mode 100644
index 00000000000..0f7ccee26c5
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/blob-ini.lua
@@ -0,0 +1,165 @@
+if not modules then modules = { } end modules ['blob-ini'] = {
+ version = 1.001,
+ comment = "companion to blob-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+-- later we will consider an OO variant.
+
+-- This module is just a playground. Occasionally we need to typeset
+-- at the lua and and this is one method. In principle we can construct
+-- pages this way too which sometimes makes sense in dumb cases. Actually,
+-- if one only needs this, one does not really need tex, okay maybe the
+-- parbuilder but that one can be simplified as well then.
+
+-- set fonts, attributes
+-- rest already done in packers etc
+-- add local par whatsit (or wait till cleaned up)
+-- collapse or new pars
+-- interline spacing etc
+
+-- DON'T USE THESE FUNCTIONS AS THEY WILL CHANGE!
+
+local type = type
+
+local utfvalues = string.utfvalues
+local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
+
+local fontdata = fonts.identifiers
+
+local new_glyph_node = nodes.glyph
+local new_glue_node = nodes.glyph
+
+local copy_node = node.copy
+local copy_node_list = node.copy_list
+local insert_node_after = node.insert_after
+local flush_node_list = node.flush_list
+local hpack_node_list = node.hpack
+local vpack_node_list = node.vpack
+local write_node = node.write
+
+local current_font = font.current
+
+blobs = blobs or { }
+
+local newline = lpegpatterns.newline
+local space = lpegpatterns.spacer
+local spacing = newline * space^0
+local content = (space^1)/" " + (1-spacing)
+
+local ctxtextcapture = lpeg.Ct ( (
+ space^0 * (
+ newline^2 * space^0 * lpeg.Cc("")
+ + newline * space^0 * lpeg.Cc(" ")
+ + lpeg.Cs(content^1)
+ )
+)^0)
+
+local function tonodes(str,fnt,attr) -- (str,template_glyph)
+ if not str or str == "" then
+ return
+ end
+ local head, tail, space, fnt, template = nil, nil, nil, nil, nil
+ if not fnt then
+ fnt = current_font()
+ elseif type(fnt) ~= "number" and fnt.id == "glyph" then
+ fnt, template = nil, fnt
+ -- else
+ -- already a number
+ end
+ for s in utfvalues(str) do
+ local n
+ if s == 32 then
+ if not space then
+ local parameters = fontdata[fnt].parameters
+ space = new_glue_node(parameters.space,parameters.space_stretch,parameters.space_shrink)
+ n = space
+ else
+ n = copy_node(space)
+ end
+ elseif template then
+ n = copy_node(template)
+ n.char = s
+ else
+ n = new_glyph_node(fnt,s)
+ end
+ if attr then -- normall false when template
+ n.attr = copy_node_list(attr)
+ end
+ if head then
+ insert_node_after(head,tail,n)
+ else
+ head = n
+ end
+ tail = n
+ end
+ return head, tail
+end
+
+blobs.tonodes = tonodes
+
+function blobs.new()
+ return {
+ list = { },
+ }
+end
+
+function blobs.append(t,str)
+ local kind = type(str)
+ local dummy = nil
+ if kind == "string" then
+ local pars = lpegmatch(ctxtextcapture,str)
+ local list = t.list
+ for p=1,#pars do
+ local str = pars[p]
+ if #str == 0 then
+ list[#list+1 ] = { head = nil, tail = nil }
+ else
+ local l = list[#list]
+ if not l then
+ l = { head = nil, tail = nil }
+ list[#list+1 ] = l
+ end
+ local head, tail = tonodes(str,nil,nil)
+ if head then
+ if l.head then
+ l.tail.next = head
+ head.prev = l.tail
+ l.tail = tail
+ else
+ l.head, l.tail = head, tail
+ end
+ end
+ end
+ end
+ end
+end
+
+function blobs.pack(t,how)
+ local list = t.list
+ for i=1,#list do
+ local pack = list[i].pack
+ if pack then
+ flush_node_list(node.pack)
+ end
+ if how == "vertical" then
+ -- we need to prepend a local par node
+ -- list[i].pack = node.vpack(list[i].head,"exactly")
+ logs.report("blobs","vpack not yet supported")
+ else
+ list[i].pack = hpack_node_list(list[i].head,"exactly")
+ end
+ end
+end
+
+function blobs.write(t)
+ local list = t.list
+ for i=1,#list do
+ local pack = list[i].pack
+ if pack then
+ write_node(pack)
+ end
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/blob-ini.mkiv b/Master/texmf-dist/tex/context/base/blob-ini.mkiv
new file mode 100644
index 00000000000..7f63ec73d91
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/blob-ini.mkiv
@@ -0,0 +1,34 @@
+%D \module
+%D [ file=blob-ini,
+%D version=2010.04.06,
+%D title=\CONTEXT\ \LUA\ Typesetting,
+%D subtitle=Initialization,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%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 Lua Typesetting / Initialization}
+
+%D This is a prelude to typesetting at the \LUA\ end. The code
+%D is already quite old but will only get nice when we are further
+%D down the road (close to version 1.00 of \LUATEX). Typesetting in
+%D pure \LUA\ sometimes makes sense.
+
+\registerctxluafile{blob-ini}{1.001}
+
+\endinput
+
+% \starttext
+%
+% \startluacode
+% local b = blobs.new()
+% blobs.append(b,"Hello world.\n Here we are.\n\n And Again!")
+% blobs.pack(b)
+% blobs.write(b)
+% \stopluacode
+%
+% \stoptext
diff --git a/Master/texmf-dist/tex/context/base/buff-ini.lua b/Master/texmf-dist/tex/context/base/buff-ini.lua
index f02963d6a06..6b1af8f96f3 100644
--- a/Master/texmf-dist/tex/context/base/buff-ini.lua
+++ b/Master/texmf-dist/tex/context/base/buff-ini.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['buff-ini'] = {
version = 1.001,
- comment = "companion to core-buf.tex",
+ comment = "companion to core-buf.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -20,16 +20,24 @@ buffers.visualizers = { }
-- if needed we can make 'm local
+local trace_run = false trackers.register("buffers.run", function(v) trace_run = v end)
+local trace_visualize = false trackers.register("buffers.visualize", function(v) trace_visualize = v end)
+
local utf = unicode.utf8
local concat, texsprint, texprint, texwrite = table.concat, tex.sprint, tex.print, tex.write
local utfbyte, utffind, utfgsub = utf.byte, utf.find, utf.gsub
local type, next = type, next
-local byte, sub, find, char, gsub, rep, lower = string.byte, string.sub, string.find, string.char, string.gsub, string.rep, string.lower
+local huge = math.huge
+local byte, sub, find, char, gsub, rep, lower, format, gmatch, match = string.byte, string.sub, string.find, string.char, string.gsub, string.rep, string.lower, string.format, string.gmatch, string.match
local utfcharacters, utfvalues = string.utfcharacters, string.utfvalues
local ctxcatcodes = tex.ctxcatcodes
+local variables = interfaces.variables
+local lpegmatch = lpeg.match
+
+local data, flags, hooks, visualizers = buffers.data, buffers.flags, buffers.hooks, buffers.visualizers
-local data, commands, flags, hooks, visualizers = buffers.data, buffers.commands, buffers.flags, buffers.hooks, buffers.visualizers
+visualizers.defaultname = variables.typing
function buffers.raw(name)
return data[name] or { }
@@ -47,6 +55,7 @@ function buffers.append(name, str)
data[name] = (data[name] or "") .. str
end
+
buffers.flags.store_as_table = true
-- to be sorted out: crlf + \ ; slow now
@@ -65,11 +74,11 @@ function buffers.grab(name,begintag,endtag,bufferdata)
buffers.level = buffers.level - 1
else
if dn == "" then
- dn = bufferdata:sub(1,#bufferdata-1)
+ dn = sub(bufferdata,1,#bufferdata-1)
else
- dn = dn .. "\n" .. bufferdata:sub(1,#bufferdata-1)
+ dn = dn .. "\n" .. sub(bufferdata,1,#bufferdata-1)
end
- dn = dn:gsub("[\010\013]$","")
+ dn = gsub(dn,"[\010\013]$","")
if flags.store_as_table then
dn = dn:splitlines()
end
@@ -104,23 +113,25 @@ function buffers.verbatimbreak(n,m)
if flags.optimize_verbatim then
if n == 2 or n == m then
texsprint(no_break_command)
- else
+ elseif n > 1 then
texsprint(do_break_command)
end
end
end
-function buffers.strip(lines)
- local first, last = 1, #lines
+function buffers.strip(lines,first,last)
+ local first, last = first or 1, last or #lines
for i=first,last do
- if #lines[i] == 0 then
+ local li = lines[i]
+ if #li == 0 or find(li,"^%s*$") then
first = first + 1
else
break
end
end
for i=last,first,-1 do
- if #lines[i] == 0 then
+ local li = lines[i]
+ if #li == 0 or find(li,"^%s*$") then
last = last - 1
else
break
@@ -129,15 +140,62 @@ function buffers.strip(lines)
return first, last, last - first + 1
end
-function buffers.type(name)
+function buffers.range(lines,first,last,range) -- 1,3 1,+3 fromhere,tothere
+ local first, last = first or 1, last or #lines
+ local what = aux.settings_to_array(range)
+ local r_first, r_last = what[1], what[2]
+ local f, l = tonumber(r_first), tonumber(r_last)
+ if r_first then
+ if f then
+ if f > first then
+ first = f
+ end
+ else
+ for i=first,last do
+ if find(lines[i],r_first) then
+ first, strip = i + 1
+ break
+ end
+ end
+ end
+ end
+ if r_last then
+ if l then
+ if find(r_last,"^[%+]") then -- 1,+3
+ l = first + l
+ end
+ if l < last then
+ last = l
+ end
+ else
+ for i=first,last do
+ if find(lines[i],r_last) then
+ last = i - 1
+ break
+ end
+ end
+ end
+ end
+ return first, last
+end
+
+function buffers.type(name,realign,range)
local lines = data[name]
local action = buffers.typeline
if lines then
if type(lines) == "string" then
lines = lines:splitlines()
+ data[name] = lines
+ end
+ if realign then
+ lines = buffers.realign(lines,realign)
end
local line, n = 0, 0
local first, last, m = buffers.strip(lines)
+ if range then
+ first, last = buffers.range(lines,first,last,range)
+ first, last = buffers.strip(lines,first,last)
+ end
hooks.begin_of_display()
for i=first,last do
n, line = action(lines[i], n, m, line)
@@ -153,16 +211,34 @@ function buffers.loaddata(filename) -- this one might go away
if not str then
ok, str, n = resolvers.loaders.tex(file.addsuffix(filename,'tex'))
end
- return str or ""
end
-function buffers.typefile(name) -- still somewhat messy, since name can be be suffixless
+function buffers.loaddata(filename) -- this one might go away
+ local foundname = resolvers.findtexfile(filename) or ""
+ if foundname == "" then
+ foundname = resolvers.findtexfile(file.addsuffix(filename,'tex')) or ""
+ end
+ if foundname == "" then
+ return ""
+ else
+ return resolvers.loadtexfile(foundname)
+ end
+end
+
+function buffers.typefile(name,realign,range) -- still somewhat messy, since name can be be suffixless
local str = buffers.loaddata(name)
if str and str~= "" then
local lines = str:splitlines()
+ if realign then
+ lines = buffers.realign(lines,realign)
+ end
local line, n, action = 0, 0, buffers.typeline
local first, last, m = buffers.strip(lines)
hooks.begin_of_display()
+ if range then
+ first, last = buffers.range(lines,first,last,range)
+ first, last = buffers.strip(lines,first,last)
+ end
for i=first,last do
n, line = action(lines[i], n, m, line)
end
@@ -173,7 +249,7 @@ end
function buffers.typeline(str,n,m,line)
n = n + 1
buffers.verbatimbreak(n,m)
- if str:find("%S") then
+ if find(str,"%S") then
line = line + 1
hooks.begin_of_line(line)
hooks.flush_line(hooks.line(str))
@@ -187,28 +263,51 @@ function buffers.typeline(str,n,m,line)
return n, line
end
-function buffers.save(name,list,encapsulate)
- if not name or name == "" then
- name = tex.jobname
- end
- if list then
- -- ok
- else
+-- The optional prefix hack is there for the typesetbuffer feature and
+-- in mkii we needed that (this hidden feature is used in a manual).
+
+local function prepared(name,list) -- list is optional
+ if not list or list == "" then
list = name
- name = tex.jobname .. "-" .. name .. ".tmp"
end
- local content = buffers.collect(list)
+ if not name or name == "" then
+ name = tex.jobname .. "-" .. list .. ".tmp"
+ end
+ local content = buffers.collect(list,nil) or ""
if content == "" then
content = "empty buffer"
end
- if encapsulate then
- io.savedata(name, "\\starttext\n"..content.."\n\\stoptext\n")
- else
- io.savedata(name, content)
+ return name, content
+end
+
+local capsule = "\\starttext\n%s\n\\stoptext\n"
+local command = "context %s"
+
+function buffers.save(name,list,encapsulate) -- list is optional
+ local name, content = prepared(name,list)
+ io.savedata(name, (encapsulate and format(capsule,content)) or content)
+end
+
+function commands.savebuffer(list,name) -- name is optional
+ buffers.save(name,list)
+end
+
+function buffers.run(name,list,encapsulate)
+ local name, content = prepared(name,list)
+ local data = io.loaddata(name)
+ content = (encapsulate and format(capsule,content)) or content
+ if data ~= content then
+ if trace_run then
+ commands.writestatus("buffers","changes in '%s', processing forced",name)
+ end
+ io.savedata(name,content)
+ os.execute(format(command,name))
+ elseif trace_run then
+ commands.writestatus("buffers","no changes in '%s', not processed",name)
end
end
-local printer = (lpeg.linebyline/texprint)^0
+local printer = (lpeg.patterns.textline/texprint)^0
function buffers.get(name)
local b = buffers.data[name]
@@ -218,7 +317,7 @@ function buffers.get(name)
texprint(b[i])
end
else
- printer:match(b)
+ lpegmatch(printer,b)
end
end
end
@@ -240,21 +339,15 @@ buffers.content = content
function buffers.collect(names,separator) -- no print
-- maybe we should always store a buffer as table so
- -- that we can pass if directly
+ -- that we can pass it directly
+ if type(names) == "string" then
+ names = aux.settings_to_array(names)
+ end
local t = { }
- if type(names) == "table" then
- for i=1,#names do
- local c = content(names[i],separator)
- if c ~= "" then
- t[#t+1] = c
- end
- end
- else
- for name in names:gmatch("[^,%s]+") do
- local c = content(name,separator)
- if c ~= "" then
- t[#t+1] = c
- end
+ for i=1,#names do
+ local c = content(names[i],separator)
+ if c ~= "" then
+ t[#t+1] = c
end
end
return concat(t,separator or "\r") -- "\n" is safer due to comments and such
@@ -274,11 +367,12 @@ function buffers.inspect(name)
local b = data[name]
if b then
if type(b) == "table" then
- for _,v in ipairs(b) do
+ for k=1,#b do
+ local v = b[k]
if v == "" then
texsprint(ctxcatcodes,"[crlf]\\par ") -- space ?
else
- texsprint(ctxcatcodes,(gsub(b,"(.)",tobyte)),"\\par")
+ texsprint(ctxcatcodes,(gsub(v,"(.)",tobyte)),"\\par")
end
end
else
@@ -289,42 +383,90 @@ end
-- maybe just line(n,str) empty(n,str)
-visualizers.handlers = visualizers.handlers or { }
-visualizers.escapetoken = nil
-visualizers.tablength = 7
-visualizers.enabletab = true -- false
-visualizers.enableescape = false
-visualizers.obeyspace = true
+visualizers.tablength = 7
+visualizers.enabletab = true -- false
+visualizers.obeyspace = true
+
+function buffers.settablength(tablength)
+ visualizers.tablength = tablength and tonumber(tablength) or 7
+end
+
+visualizers.handlers = visualizers.handlers or { }
local handlers = visualizers.handlers
function buffers.newvisualizer(name)
+ name = lower(name)
local handler = { }
handlers[name] = handler
return handler
end
function buffers.getvisualizer(name)
- return handlers[name]
+ name = lower(name)
+ return handlers[name] or buffers.loadvisualizer(name)
end
-local default = buffers.newvisualizer("default")
+function buffers.loadvisualizer(name)
+ name = lower(name)
+ local hn = handlers[name]
+ if hn then
+ return hn
+ else
+ environment.loadluafile("pret-" .. name)
+ local hn = handlers[name]
+ if not hn then
+ -- hn = buffers.newvisualizer(name)
+ hn = handlers[visualizers.defaultname]
+ handlers[name] = hn
+ if trace_visualize then
+ logs.report("buffers","mapping '%s' visualizer onto '%s'",name,visualizers.defaultname)
+ end
+ elseif trace_visualize then
+ logs.report("buffers","loading '%s' visualizer",name)
+ end
+ return hn
+ end
+end
+
+-- was "default", should be set at tex end (todo)
+
+local default = buffers.newvisualizer(visualizers.defaultname)
+
+--~ print(variables.typing) os.exit()
+
+-- will become cleaner
local currentvisualizer, currenthandler
function buffers.setvisualizer(str)
currentvisualizer = lower(str)
currenthandler = handlers[currentvisualizer]
- if not currenthandler then
- currentvisualizer = 'default'
+ if currenthandler then
+ -- if trace_visualize then
+ -- logs.report("buffers","enabling specific '%s' visualizer",currentvisualizer)
+ -- end
+ else
+ currentvisualizer = visualizers.defaultname
currenthandler = handlers.default
+ -- if trace_visualize then
+ -- logs.report("buffers","enabling default visualizer '%s'",currentvisualizer)
+ -- end
end
if currenthandler.reset then
currenthandler.reset()
end
end
-buffers.setvisualizer("default")
+function buffers.resetvisualizer()
+ currentvisualizer = visualizers.defaultname
+ currenthandler = handlers.default
+ if currenthandler.reset then
+ currenthandler.reset()
+ end
+end
+
+buffers.setvisualizer(visualizers.defaultname)
function visualizers.reset()
end
@@ -351,10 +493,15 @@ function hooks.end_of_inline()
(currenthandler.end_of_inline or default.end_of_inline)()
end
-
function hooks.flush_line(str,nesting)
- str = gsub(str," *[\n\r]+ *"," ") ; -- semi colon needed
- (currenthandler.flush_line or default.flush_line)(str,nesting)
+ local fl = currenthandler.flush_line
+ if fl then
+ str = gsub(str," *[\n\r]+ *"," ") ; -- semi colon needed
+ fl(str,nesting)
+ else
+ -- gsub done later
+ default.flush_line(str,nesting)
+ end
end
function hooks.flush_inline(str,nesting)
@@ -419,11 +566,11 @@ function default.line(str)
end
function default.flush_line(str)
- str = str:gsub(" *[\n\r]+ *"," ")
+ str = gsub(str," *[\n\r]+ *"," ")
if visualizers.obeyspace then
for c in utfcharacters(str) do
if c == " " then
- texsprint(ctxcatcodes,"\\obs ")
+ texsprint(ctxcatcodes,"\\obs")
else
texwrite(c)
end
@@ -454,13 +601,14 @@ end
-- special one
-commands.nested = "\\switchslantedtype "
+buffers.commands.nested = "\\switchslantedtype "
-- todo : utf + faster, direct print and such. no \\char, vrb catcodes, see end
function visualizers.flush_nested(str, enable) -- no utf, kind of obsolete mess
- str = str:gsub(" *[\n\r]+ *"," ")
+ str = gsub(str," *[\n\r]+ *"," ")
local result, c, nested, i = "", "", 0, 1
+ local commands = buffers.commands -- otherwise wrong commands
while i < #str do -- slow
c = sub(str,i,i+1)
if c == "<<" then
@@ -481,7 +629,7 @@ function visualizers.flush_nested(str, enable) -- no utf, kind of obsolete mess
c = sub(str,i,i)
if c == " " then
result = result .. "\\obs "
- elseif c:find("%a") then
+ elseif find(c,"%a") then
result = result .. c
else
result = result .. "\\char" .. byte(c) .. " "
@@ -546,6 +694,106 @@ function buffers.flush_result(result,nested)
end
end
+-- new
+
+function buffers.realign(name,forced_n) -- no, auto,
+ local n, d
+ if type(name) == "string" then
+ d = data[name]
+ if type(d) == "string" then
+ d = d:splitlines()
+ end
+ else
+ d = name -- already a buffer
+ end
+ forced_n = (forced_n == variables.auto and huge) or tonumber(forced_n)
+ if forced_n then
+ for i=1, #d do
+ local spaces = find(d[i],"%S")
+ if not spaces then
+ -- empty line
+ elseif not n then
+ n = spaces
+ elseif spaces == 0 then
+ n = 0
+ break
+ elseif n > spaces then
+ n = spaces
+ end
+ end
+ if n > 0 then
+ if n > forced_n then
+ n = forced_n
+ end
+ for i=1,#d do
+ d[i] = sub(d[i],n)
+ end
+ end
+ end
+ return d
+end
+
+-- escapes: buffers.set_escape("tex","/BTEX","/ETEX")
+
+local function flush_escaped_line(str,pattern,flushline)
+ while true do
+ local a, b, c = match(str,pattern)
+ if a and a ~= "" then
+ flushline(a)
+ end
+ if b and b ~= "" then
+ texsprint(ctxcatcodes,"{",b,"}")
+ end
+ if c then
+ if c == "" then
+ break
+ else
+ str = c
+ end
+ else
+ flushline(str)
+ break
+ end
+ end
+end
+
+function buffers.set_escape(name,pair)
+ if pair and pair ~= "" then
+ local visualizer = buffers.getvisualizer(name)
+ visualizer.normal_flush_line = visualizer.normal_flush_line or visualizer.flush_line
+ if pair == variables.no then
+ visualizer.flush_line = visualizer.normal_flush_line or visualizer.flush_line
+ if trace_visualize then
+ logs.report("buffers","resetting escape range for visualizer '%s'",name)
+ end
+ else
+ local start, stop
+ if pair == variables.yes then
+ start, stop = "/BTEX", "/ETEX"
+ else
+ pair = string.split(pair,",")
+ start, stop = string.esc(pair[1] or ""), string.esc(pair[2] or "")
+ end
+ if start ~= "" then
+ local pattern
+ if stop == "" then
+ pattern = "^(.-)" .. start .. "(.*)(.*)$"
+ else
+ pattern = "^(.-)" .. start .. "(.-)" .. stop .. "(.*)$"
+ end
+ function visualizer.flush_line(str)
+ flush_escaped_line(str,pattern,visualizer.normal_flush_line)
+ end
+ if trace_visualize then
+ logs.report("buffers","setting escape range for visualizer '%s' to %s -> %s",name,start,stop)
+ end
+ elseif trace_visualize then
+ logs.report("buffers","problematic escape specification '%s' for visualizer '%s'",pair,name)
+ end
+ end
+ end
+end
+
-- THIS WILL BECOME A FRAMEWORK: the problem with prety printing is that
-- we deal with snippets and therefore we need tolerant parsing
@@ -587,6 +835,4 @@ end
--~ str = [[test 123 test $oeps$]]
---~ pattern:match(str)
-
-
+--~ lpegmatch(pattern,str)
diff --git a/Master/texmf-dist/tex/context/base/buff-ini.mkii b/Master/texmf-dist/tex/context/base/buff-ini.mkii
index 0f0655ea126..fc147d09041 100644
--- a/Master/texmf-dist/tex/context/base/buff-ini.mkii
+++ b/Master/texmf-dist/tex/context/base/buff-ini.mkii
@@ -188,15 +188,15 @@
\letvalue{\??bu#1\c!number }\nofdefinedbuffers
\letvalue{\??bu#1\c!paragraph}\v!no
\setevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
- \setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}%
- \setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}%
+ \unexpanded\setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}%
+ \unexpanded\setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}%
\getparameters[\??bu#1][#2]%
\fi}
\def\definebuffer
{\dodoubleempty\dodefinebuffer}
-\def\getbuffer
+\unexpanded\def\getbuffer
{\dodoubleempty\dogetbuffer}
\def\dogetbuffer[#1][#2]%
@@ -213,7 +213,7 @@
\dobuffer{16}{#2}\dogetbufferasis
\getvalue{\??bu#1\c!after}}
-\def\typebuffer
+\unexpanded\def\typebuffer
{\dodoubleempty\dotypebuffer}
\def\dogetfilebuffer{\typefile{\TEXbufferfile{\currentbuffer}}}
diff --git a/Master/texmf-dist/tex/context/base/buff-ini.mkiv b/Master/texmf-dist/tex/context/base/buff-ini.mkiv
index 29ce4687de9..86b0fa3c530 100644
--- a/Master/texmf-dist/tex/context/base/buff-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/buff-ini.mkiv
@@ -51,11 +51,7 @@
% \stoptext
\ifdefined\doinitializeverbatim \else% temp hack
- \ifdefined\mkinitializeverbatim
- \let\doinitializeverbatim\mkinitializeverbatim
- \else
- \def\doinitializeverbatim{\tttf}
- \fi
+ \def\doinitializeverbatim{\tttf}
\fi
\unprotect
@@ -150,7 +146,7 @@
\ctxlua{buffers.set("\currentbuffer", \!!bs\detokenize{#2}\!!es)}%
\endgroup}
-\def\setupbuffer
+\unexpanded\def\setupbuffer
{\dodoubleempty\dosetupbuffer}
\def\dosetupbuffer[#1][#2]%
@@ -165,16 +161,19 @@
\doglobal\increment\nofdefinedbuffers
\letvalue{\??bu#1\c!number }\nofdefinedbuffers
\letvalue{\??bu#1\c!paragraph}\v!no
- \setevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}%
- \setevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}%
- \setevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}%
+ \setuevalue{\e!start#1}{\noexpand\dostartbuffer[#1][def-\nofdefinedbuffers][\e!start#1][\e!stop#1]}% maybe also relax stop
+ \setuevalue{\e!get #1}{\noexpand\dogetbuffer [#1][def-\nofdefinedbuffers]}%
+ \setuevalue{\e!type #1}{\noexpand\dotypebuffer [#1][def-\nofdefinedbuffers]}%
\getparameters[\??bu#1][#2]%
\fi}
-\def\definebuffer
+\unexpanded\def\definebuffer
{\dodoubleempty\dodefinebuffer}
+
+\def\thebuffernumber#1%
+ {\csname\??bu#1\c!number\endcsname}
-\def\getbuffer
+\unexpanded\def\getbuffer
{\dodoubleempty\dogetbuffer}
\def\dogetbuffer[#1][#2]%
@@ -191,18 +190,18 @@
\dobuffer{16}{#2}\dogetbufferasis
\getvalue{\??bu#1\c!after}}
-\def\typebuffer
+\unexpanded\def\typebuffer
{\dodoubleempty\dotypebuffer}
\def\doprocessbufferverbatim
{\doinitializeverbatim
- \ctxlua{buffers.type("\currentbuffer")}}
+ \ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")}}
\def\doprocessbufferlinesverbatim#1#2#3%
{#2%
% todo, set up numbers
\doinitializeverbatim
- \ctxlua{buffers.type("\currentbuffer")}
+ \ctxlua{buffers.type("\currentbuffer","\typingparameter\c!strip")}
#3}
\def\doifelsebuffer#1%
@@ -276,20 +275,20 @@
\ifsecondargument
\dosetbufferoffset{#1}%
\doifelse{#2}\v!all
- {\def\startbufferparagraph{\normalbufferparagraph{#1}}}
- {\def\startbufferparagraph{\filterbufferparagraph{#1}{#2}}}%
- \def\stopbufferparagraph{\dostopbufferparagraph{#1}}%
+ {\unexpanded\def\startbufferparagraph{\normalbufferparagraph{#1}}}
+ {\unexpanded\def\startbufferparagraph{\filterbufferparagraph{#1}{#2}}}%
+ \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{#1}}%
\def\next{\getparagraphedbuffer[#1]}%
\else
\dosetbufferoffset\empty
- \def\startbufferparagraph{\filterbufferparagraph{}{#1}}%
- \def\stopbufferparagraph{\dostopbufferparagraph{}}%
+ \unexpanded\def\startbufferparagraph{\filterbufferparagraph{}{#1}}%
+ \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{}}%
\def\next{\getparagraphedbuffer[]}%
\fi
\else
\dosetbufferoffset\empty
- \def\startbufferparagraph{\normalbufferparagraph{}}%
- \def\stopbufferparagraph{\dostopbufferparagraph{}}%
+ \unexpanded\def\startbufferparagraph{\normalbufferparagraph{}}%
+ \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{}}%
\def\next{\getparagraphedbuffer[]}%
\fi
\next}
@@ -329,7 +328,7 @@
\def\fakebufferparagraph#1%
{\bgroup
- \def\stopbufferparagraph{\dostopbufferparagraph{#1}\egroup\egroup}%
+ \unexpanded\def\stopbufferparagraph{\dostopbufferparagraph{#1}\egroup\egroup}%
\setbox\scratchbox\vbox\bgroup\dostartbufferparagraph{#1}}
% definitions
@@ -342,8 +341,15 @@
\c!after=]
% only mkiv:
+%
+% \startbuffer[x]
+% x
+% \stopbuffer
+%
+% \savebuffer[x][temp.log]
+
+\unexpanded\def\savebuffer{\dodoubleempty\dosavebuffer}
-\def\savebuffer{\dosingleempty\dosavebuffer}
-\def\dosavebuffer[#1]{\ctxlua{buffers.save("#1")}}
+\def\dosavebuffer[#1][#2]{\ctxlua{commands.savebuffer("#1","#2")}}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/buff-ver.mkii b/Master/texmf-dist/tex/context/base/buff-ver.mkii
index 6b3817a7028..e7ad5474f37 100644
--- a/Master/texmf-dist/tex/context/base/buff-ver.mkii
+++ b/Master/texmf-dist/tex/context/base/buff-ver.mkii
@@ -144,7 +144,6 @@
\let\obeycharacters\setupprettytype
\let\obeytabs\ignoretabs}
-
\def\setupcommonverbatim
{\recatcodeuppercharactersfalse % obey regime / encoding
%
@@ -577,11 +576,13 @@
\veryraggedright}
\def\ignorehyphens
- {% \language\minusone % extra bonus, the \null should do the job too
+ {% \nohyphens % forgotten when no \par
+ \normallanguage\minusone % fails as the font redoes the language
\def\obeyedspace {\hskip\interwordspace\relax}% better than spaceskip
\def\controlspace{\hskip\zeropoint\hbox{\normalcontrolspace}\hskip\zeropoint\relax}%
\spaceskip.5em\relax}
+
\unexpanded\def\typ
{\bgroup
\let\@@tylines\v!hyphenated
@@ -634,6 +635,11 @@
\unexpanded\def\mat{\groupedcommand{\setgroupedtype\$}{\$}}
\unexpanded\def\dis{\groupedcommand{\setgroupedtype\$\$}{\$\$}}
+\let\normaltexttex\tex
+\let\normaltextarg\arg
+\let\normaltextmat\mat
+\let\normaltextdis\dis
+
%D \macros
%D {starttyping}
%D
diff --git a/Master/texmf-dist/tex/context/base/buff-ver.mkiv b/Master/texmf-dist/tex/context/base/buff-ver.mkiv
index 28e3e60d501..dacbdb7ac99 100644
--- a/Master/texmf-dist/tex/context/base/buff-ver.mkiv
+++ b/Master/texmf-dist/tex/context/base/buff-ver.mkiv
@@ -17,9 +17,9 @@
\unprotect
-\ifx\startlinenumbering\undefined \let\startlinenumbering\relax \fi
-\ifx\stoplinenumbering \undefined \let\stoplinenumbering\relax \fi
-\ifx\setuplinenumbering\undefined \def\setuplinenumbering[#1]{} \fi
+\ifdefined\startlinenumbering\else \let\startlinenumbering \relax \fi
+\ifdefined\stoplinenumbering \else \let\stoplinenumbering \relax \fi
+\ifdefined\setuplinenumbering\else \unexpanded\def\setuplinenumbering[#1]{} \fi
% D \macros
% D {iflinepar}
@@ -66,16 +66,17 @@
\uppercasestring#2\to\asciib
\setevalue{\??ty\??ty\asciia}{\asciib}}
-\def\setupprettiesintype#1%
+\unexpanded\def\setupprettiesintype#1%
{\uppercasestring#1\to\ascii
\edef\prettyidentifier{\executeifdefined{\??ty\??ty\ascii}{TEX}}%
\begingroup
% we can move this to lua
- \lowercasestring \f!prettyprefix\prettyidentifier\to\filename
- \doonlyonce\filename{\ctxloadluafile\filename\empty}%
+ % \lowercasestring \f!prettyprefix\prettyidentifier\to\filename
+ % \doonlyonce\filename{\ctxloadluafile\filename\empty}%
+ \ctxlua{buffers.loadvisualizer("\ascii")}%
\endgroup}
-\def\setupprettytype
+\unexpanded\def\setupprettytype
{\processingverbatimtrue % will move
\ctxlua{buffers.visualizers.reset()}}
@@ -84,7 +85,7 @@
\spaceskip\wd\scratchbox
\xspaceskip\spaceskip}
-\let\obeycharacters\relax
+\let\obeycharacters\relax % tab mess can go
\setvalue{\??tp:\c!lines:\v!yes }{\obeybreakpoints}
\setvalue{\??tp:\c!lines:\v!hyphenated}{\obeyhyphens}
@@ -93,59 +94,65 @@
%setvalue{\??tp:\c!empty:\v!all }{\obeyallemptylines}
\setvalue{\??tp:\c!option:\v!none }{\let\obeycharacters\relax}
-\setvalue{\??tp:\c!option:\v!color }{\setupprettiesintype{TEX}%
- \let\obeycharacters\setupprettytype
- \let\obeytabs\ignoretabs}
+\setvalue{\??tp:\c!option:\empty }{\let\obeycharacters\relax}
+\setvalue{\??tp:\c!option:\v!color }{\setupprettiesintype{\typingparameter\c!option}%
+ \let\obeycharacters\setupprettytype}
\setvalue{\??tp:\c!option:\v!normal }{\let\obeycharacters\setupgroupedtype}
-\setvalue{\??tp:\c!option:\v!commands }{\def\obeycharacters{\setupcommandsintype}%
- \let\obeytabs\ignoretabs}
-\setvalue{\??tp:\c!option:\v!slanted }{\let\obeycharacters\setupslantedtype
- \let\obeytabs\ignoretabs}
+\setvalue{\??tp:\c!option:\v!slanted }{\let\obeycharacters\setupslantedtype}
\setvalue{\??tp:\c!option:\s!unknown }{\setupprettiesintype{\typingparameter\c!option}%
- \let\obeycharacters\setupprettytype
- \let\obeytabs\ignoretabs}
+ \let\obeycharacters\setupprettytype}
+%setvalue{\??tp:\c!option:\v!commands }{\def\obeycharacters{\setupcommandsintype}}
\def\dosetverbatimfont
{\redoconvertfont\dosetfontattribute{\currenttypingclass\currenttyping}\c!style
\normalnoligatures\font}
-\def\setupcommonverbatim
+\unexpanded\def\setupcommonverbatim
{\let\prettyidentifier\s!default
%
-% \doifelse{\typingparameter\c!text}\v!yes
-% \naturaltextexttrue
-% \naturaltextextfalse
\def\prettyidentifierfont{\typingparameter\c!icommand}%
\def\prettyvariablefont {\typingparameter\c!vcommand}%
\def\prettynaturalfont {\typingparameter\c!ccommand}%
%
- \doif{\typingparameter\c!space}\v!on
- {\def\obeyspaces{\setcontrolspaces}}%
- \doif{\typingparameter\c!page }\v!no
- {\def\obeypages {\ignorepages}}%
- %
\ignorehyphens % default
\getvalue{\??tp:\c!lines:\typingparameter\c!lines}%
\getvalue{\??tp:\c!empty:\typingparameter\c!empty}%
\getvalue{\??tp:\c!option:\ifcsname\??tp:\c!option:\typingparameter\c!option\endcsname\typingparameter\c!option\else\s!unknown\fi}%
- \doifnumberelse{\typingparameter\c!tab}
- {\def\obeytabs{\setfixedtabskips{\typingparameter\c!tab}}}%
- \donothing
\setupverbatimcolor}
\newtoks \everyinitializeverbatim
-\def\doinitializeverbatim
+\def\ignorebeginofpretty [#1]{}
+\def\ignoreendofpretty {}
+
+\def\doverbatimbop{\bgroup\beginofpretty}
+\def\doverbatimeop{\endofpretty\egroup}
+\def\doverbatimsop{\endofpretty\egroup\bgroup\beginofpretty}
+
+\let\noverbatimbop\ignorebeginofpretty
+\let\noverbatimeop\ignoreendofpretty
+\let\noverbatimsop\ignorebeginofpretty
+
+\def\doinitializeverbatim % todo: combine all in one call is faster
{\ctxlua{buffers.visualizers.reset()}%
- \def\obs{\obeyedspace}%
+ \doifelse{\typingparameter\c!space}\v!on
+ {\let\obs\fastcontrolspace}%
+ {\let\obs\specialobeyedspace}%
+ \edef\askedverbatimtab{\typingparameter\c!tab}%
+ \doifelse\askedverbatimtab\v!no
+ {\ctxlua{buffers.settablength(1)}}
+ {\doifnumberelse{\askedverbatimtab}
+ {\ctxlua{buffers.settablength(\askedverbatimtab)}}
+ {\ctxlua{buffers.settablength()}}}%
\ctxlua{buffers.doifelsevisualizer("\prettyidentifier")}
{\ctxlua{buffers.setvisualizer("\prettyidentifier")}%
- \def\bop{\bgroup\beginofpretty}%
- \def\eop{\endofpretty\egroup}%
- \def\sop{\endofpretty\egroup\bgroup\beginofpretty}}%
- {\let\bop\donothing
- \let\eop\donothing
- \let\sop\donothing}%
+ \let\bop\doverbatimbop
+ \let\eop\doverbatimeop
+ \let\sop\doverbatimsop}%
+ {\ctxlua{buffers.setvisualizer("\v!typing")}% or resetdefaultvisualizer
+ \let\bop\noverbatimbop
+ \let\eop\noverbatimeop
+ \let\sop\noverbatimsop}%
\relax\the\everyinitializeverbatim\relax}
\appendtoks
@@ -163,14 +170,54 @@
% \typeTEX{\example---oeps}. this---ligates---again.
% \type {\example---oeps}. this---ligates---again.
-\def\setupcommandsintype % can also be \string\
- {\ctxlua{
- buffers.visualizers.enableescape = true
- buffers.visualizers.escapetoken = \!!bs\typingparameter\c!escape\!!es
- }%
- \setevalue{\typingparameter\c!escape}{\typingparameter\c!escape}}
+%D \startbuffer
+%D \setuptyping[TEX][escape=yes]
+%D
+%D \startTEX
+%D /BTEX\em sometex/ETEX
+%D /BTEX\em sometex/ETEX \after
+%D \before /BTEX\em sometex/ETEX
+%D \before /BTEX\em sometex/ETEX \after
+%D \before /BTEX\em sometex/ETEX \inbetween /BTEX\em sometex/ETEX \after
+%D \before \after
+%D \stopTEX
+%D \stopbuffer
+%D
+%D \typebuffer \start \getbuffer \stop
+%D
+%D \startbuffer
+%D \setuptyping[TEX][escape={[[,]]}]
+%D
+%D \startTEX
+%D [[\em sometex]]
+%D [[\em sometex]] \after
+%D \before [[\em sometex]]
+%D \before [[\em sometex]] \after
+%D \before [[\em sometex]] \inbetween [[\em sometex]] \after
+%D \before \after
+%D \stopTEX
+%D \stopbuffer
+%D
+%D \typebuffer \start \getbuffer \stop
+%D
+%D \startbuffer
+%D \setuptyping[TEX][escape=//]
+%D
+%D \startTEX
+%D //\em sometex
+%D \before //\em sometex
+%D \stopTEX
+%D
+%D \typebuffer \start \getbuffer \stop
+
+\unexpanded\def\setupcommandsintype
+ {\ctxlua{buffers.set_escape("\currenttyping",\!!bs\typingparameter\c!escape\!!es)}}
+
+\appendtoks
+ \setupcommandsintype
+\to \everyinitializeverbatim
-\def\setupslantedtype
+\unexpanded\def\setupslantedtype
{\slantedtypepermittedtrue}
\ifx\setupprettytype \undefined \let\setupprettytype \relax \fi
@@ -272,15 +319,6 @@
\catcode`\>=\@@other
\futurelet\next\dodotype}
-% \def\dodotype
-% {\ifx\next\bgroup
-% \@EA\dodotypeA
-% \else\if\next<%
-% \doifelse{\typingparameter\c!option}\v!none{\@EAEAEA\dodotypeB}{\@EAEAEA\dodotypeC}%
-% \else
-% \@EAEAEA\dodotypeD
-% \fi\fi}
-
\def\dodotype
{\ifx\next\bgroup
\@EA\dodotypeA
@@ -362,19 +400,15 @@
\setupcommonverbatim
%\dosetverbatimfont
%\setverbatimspaceskip
- %\let\obeytabs \ignoretabs % probably not needed
- %\let\obeylines\ignorelines % probably not needed
- %\let\obeypages\ignorepages % probably not needed
%\setupcopyverbatim % not needed
- \setcatcodetable\vrbcatcodes
- }
+ \setcatcodetable\vrbcatcodes}
%D \macros
%D {setuptype}
%D
%D Some characteristics of \type{\type} can be set up by:
-\def\setuptype
+\unexpanded\def\setuptype
{\dodoubleempty\dosetuptype}
\def\dosetuptype[#1][#2]%
@@ -407,7 +441,7 @@
\veryraggedright}
\def\ignorehyphens
- {% \language\minusone % extra bonus, the \null should do the job too
+ {\language\minusone % extra bonus, the \null should do the job too
\let\obeyedspace \specialobeyedspace
\let\controlspace\specialcontrolspace
\spaceskip.5em\relax}
@@ -465,6 +499,19 @@
\unexpanded\def\mat{\groupedcommand{\setgroupedtype\$}{\$}}
\unexpanded\def\dis{\groupedcommand{\setgroupedtype\$\$}{\$\$}}
+\let\normaltexttex\tex
+\let\normaltextarg\arg
+\let\normaltextmat\mat
+\let\normaltextdis\dis
+
+\def\astype
+ {\groupedcommand\dorawtype\relax}
+
+\def\dorawtype
+ {\let\currenttypingclass\??ty
+ \normalverbatimcolor % \verbatimcolor
+ \dosetverbatimfont}
+
%D \macros
%D {starttyping}
%D
@@ -491,9 +538,9 @@
{\setxvalue{\currenttypingclass\currenttyping#1}{#2}}
\setvalue{\??tp:\c!blank:\v!standard}{\ctxparskip}
-\setvalue{\??tp:\c!blank:\v!small }{\blankokleinmaat}
-\setvalue{\??tp:\c!blank:\v!medium }{\blankomiddelmaat}
-\setvalue{\??tp:\c!blank:\v!big }{\blankogrootmaat}
+\setvalue{\??tp:\c!blank:\v!small }{\smallskipamount}
+\setvalue{\??tp:\c!blank:\v!medium }{\medskipamount}
+\setvalue{\??tp:\c!blank:\v!big }{\bigskipamount}
\setvalue{\??tp:\c!blank:\v!halfline}{.5\baselineskip}
\setvalue{\??tp:\c!blank:\v!line }{\baselineskip}
\setvalue{\??tp:\c!blank:\v!none }{\zeropoint}
@@ -519,9 +566,11 @@
\else
\doadaptleftskip{\typingparameter\c!margin}%
\fi
+ % no symbolic blanks !
\edef\!!stringa{\executeifdefined{\??bo\typingparameter\c!blank}{\typingparameter\c!blank}}%
\scratchskip\executeifdefined{\??tp:\c!blank:\!!stringa}\!!stringa\relax
\ifgridsnapping
+ % this will be adapted
\ifdim\scratchskip=.5\baselineskip\relax
\edef\verbatimbaselineskip{\the\scratchskip}% new
\else
@@ -530,6 +579,7 @@
\else
\edef\verbatimbaselineskip{\the\scratchskip}%
\fi
+\doifsomething{\typingparameter\c!align}{\setupalign[\typingparameter\c!align]}%
\setupcommonverbatim}
%D The basic display verbatim commands are defined in an
@@ -582,22 +632,21 @@
\def\dotypefileverbatim
{\doinitializeverbatim
- \ctxlua{buffers.typefile("\readfilename")}}
+ \beginofverbatimlines
+ \ctxlua{buffers.typefile("\readfilename","\typingparameter\c!strip","\typingparameter\c!range")}%
+ \endofverbatimlines}
\def\dotypefilelinesverbatim#1#2%
- {#1%
- \doinitializeverbatim
- \ctxlua{buffers.typefile("\readfilename")}%
- #2}
+ {#1\dotypefileverbatim#2}
\unexpanded\def\dotypeblockverbatim#1#2%
- {\dowithbuffer{_typing_}{#1}{#2}
- {}
- {\doinitializeverbatim
- \beginofverbatimlines
- \ctxlua{buffers.type("_typing_")}%
- \endofverbatimlines
- \csname#2\endcsname}}
+ {\dowithbuffer{_typing_}{#1}{#2}
+ {}
+ {\doinitializeverbatim
+ \beginofverbatimlines
+ \ctxlua{buffers.type("_typing_","\typingparameter\c!strip","\typingparameter\c!range")}%
+ \endofverbatimlines
+ \csname#2\endcsname}}
\def\dododostarttyping[#1]%
{\typingparameter\c!before
@@ -612,8 +661,7 @@
{\stopverbatimcolor
\stoppacked % includes \egroup
\typingparameter\c!after
- \egroup
- \dochecknextindentation{\??tp#1}%
+ \normalexpanded{\egroup\checknextindentation[\typingparameter\c!indentnext]}%
\dorechecknextindentation}
%D Line numbering for files is combined with filtering, while
@@ -630,7 +678,7 @@
%D ...
%D \stopcode
%D
-%D \startcode[continue]
+%D \startcode[start=continue]
%D ...
%D ...
%D \stopcode
@@ -640,6 +688,27 @@
%D \stopcode
%D \stoptyping
+%D Ranges:
+%D
+%D \starttyping
+%D % label:start:one
+%D
+%D \def\MyMacro
+%D {just an example}
+%D
+%D % label:stop:one
+%D
+%D \starttext
+%D
+%D % \typefile[file][range={3,6}]{whatever.tex}
+%D
+%D % \typefile[file][range={3,+2}]{whatever.tex}
+%D
+%D \typefile[file][range={label:start:one,label:stop:one}]{whatever.tex}
+%D
+%D \stoptext
+%D \stoptyping
+
%D \macros
%D {setuptyping}
%D
@@ -655,7 +724,7 @@
\getparameters[\??tp][#1]%
\fi}
-\def\setuptyping
+\unexpanded\def\setuptyping
{\dodoubleempty\dosetuptyping}
%D \macros
@@ -664,11 +733,11 @@
%D Specific inline verbatim commands can be defined with the
%D following command.
-\def\definetype
+\unexpanded\def\definetype
{\dodoubleempty\dodefinetype}
\def\dodefinetype[#1][#2]%
- {\unexpanded\setvalue{#1}{\dotype{#1}}%
+ {\setuvalue{#1}{\dotype{#1}}%
\getparameters[\??ty#1][#2]}
%D \macros
@@ -688,7 +757,9 @@
%D
%D The definitions default to the standard typing values.
-\def\presettyping[#1][#2]%
+% TODO: parent etc !
+
+\def\presettyping[#1][#2]% brrr also use parent here
{\copyparameters[\??tp#1][\??tp][\c!color,\c!style]%
\getparameters [\??tp#1][#2]}
@@ -697,7 +768,7 @@
\setvalue{\e!stop #1}{\dostoptyping {#1}}%
\presettyping[#1][#2]}
-\def\definetyping
+\unexpanded\def\definetyping
{\dodoubleempty\dodefinetyping}
%D We can use some core color commands. These are faster than
@@ -705,7 +776,7 @@
%D line basis.
%D
%D \starttyping
-%D \def\setupverbatimcolor%
+%D \unexpanded\def\setupverbatimcolor%
%D {\edef\prettypalet{\prettyidentifier\typingparameter\c!palet}%
%D \def\beginofpretty[##1]{\startcolormode{\prettypalet:##1}}%
%D \def\endofpretty {\stopcolormode}}
@@ -720,10 +791,7 @@
\def\normalstopverbatimcolor {\stopcolor}
\def\normalverbatimcolor {\getvalue{\typingparameter\c!color}}% command !
-\def\ignorebeginofpretty [#1]{}
-\def\ignoreendofpretty {}
-
-\def\setupnormalprettyverbatim
+\unexpanded\def\setupnormalprettyverbatim
{\edef\prettypalet{\prettyidentifier\prettypalet}%
\let\beginofpretty \normalbeginofpretty
\let\endofpretty \normalendofpretty
@@ -731,7 +799,7 @@
\let\stopverbatimcolor \normalstopverbatimcolor
\let\verbatimcolor \normalverbatimcolor}
-\def\setupignoreprettyverbatim
+\unexpanded\def\setupignoreprettyverbatim
{\let\prettypalet \empty
\let\beginofpretty \ignorebeginofpretty
\let\endofpretty \ignoreendofpretty
@@ -739,7 +807,7 @@
\let\stopverbatimcolor \normalstopverbatimcolor
\let\verbatimcolor \normalverbatimcolor}
-\def\setupverbatimcolor
+\unexpanded\def\setupverbatimcolor
{\edef\prettypalet{\typingparameter\c!palet}%
\ifx\prettypalet\empty
\setupignoreprettyverbatim
@@ -799,33 +867,28 @@
\fi\fi}
\def\dosetuptypelinenumbering#1% fuzzy
- {\ifcsname\currenttypingclass\currenttyping\c!start\endcsname \else
- \setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!nlines=]%
- \fi
- \setuptyping[\currenttyping][#1]%
+ {%\ifcsname\currenttypingclass\currenttyping\c!start\endcsname \else
+ % \setuptyping[\currenttyping][\c!start=1,\c!stop=,\c!step=1,\c!continue=\v!no,\c!nlines=]%
+ %\fi
+ \doifassignmentelse{#1}{\setuptyping[\currenttyping][#1]}\donothing
\doifelse{\typingparameter\c!numbering}\v!file
{% kind of special: filters lines !
- \setuplinenumbering[\c!method=\v!file]%
+ \setuplinenumbering[\currenttyping][\c!method=\v!file]%
\donetrue}
{\doifelse{\typingparameter\c!numbering}\v!line
- {% \setuplinenumbering defaults start/step to 1/1, so we need
- \doifinsetelse\v!continue{#1,\typingparameter\c!start}
- {\scratchcounter0\typingparameter\c!n
- \setxtypingparameter\c!start{\ifnum\scratchcounter=0 1\else\number\scratchcounter\fi}}%
- {\doifnothing{\typingparameter\c!start}{\settypingparameter\c!start{1}}}%
- \doifnothing{\typingparameter\c!step}{\settypingparameter\c!step{1}}%
- \setuplinenumbering
- [\c!method=\v!type,
- \c!start=\typingparameter\c!start,
- \c!stop=\typingparameter\c!stop,
- \c!step=\typingparameter\c!step]%
+ {\doifinset\v!continue{#1}{\setuptyping[\currenttyping][\c!continue=\v!yes]}% fails: \settypingparameter\c!continue{\v!yes}
\donetrue}
{\donefalse}}%
\ifdone
- \ifx\startlinenumbering\undefined \let\startlinenumbering\relax \fi
- \ifx\stoplinenumbering \undefined \let\stoplinenumbering \relax \fi
- \def\beginofverbatimlines{\startlinenumbering}%
- \def\endofverbatimlines {\stoplinenumbering\setxtypingparameter\c!n{\number\linenumber}}%
+ \edef\beginofverbatimlines{\noexpand\startlinenumbering
+ [\currenttyping]%
+ [\c!continue=\typingparameter\c!continue,
+ \c!method=\v!type,
+ \c!start=\typingparameter\c!start,
+ \c!stop=\typingparameter\c!stop, % ?
+ \c!step=\typingparameter\c!step]%
+ }%
+ \def\endofverbatimlines{\stoplinenumbering}%
\fi}
\def\reporttypingerror#1% temp hack
@@ -880,7 +943,8 @@
{\doiflocfileelse{#1}
{\firstoftwoarguments}
{\doifinputfileelse{#1}
- {\def\readfilename{\pathplusfile\filepath{#1}}\firstoftwoarguments} % messy, looks wrong too
+% {\def\readfilename{\pathplusfile\filepath{#1}}\firstoftwoarguments} % messy, looks wrong too
+ {\def\readfilename{#1}\firstoftwoarguments} % messy, looks wrong too
{\secondoftwoarguments}}}
\def\dodotypefile[#1][#2]#3%
@@ -930,14 +994,16 @@
\c!evenmargin=\!!zeropoint,
\c!oddmargin=\!!zeropoint,
\c!blank=\v!line,
- \c!escape=/, % beware \string\ , should also be accepted
+ \c!escape=, % yes | no | START,STOP BTEX,ETEX
\c!numbering=\v!no,
\c!lines=,
+ \c!range=,
\c!empty=,
\c!start=1,
\c!stop=,
\c!step=1,
\c!continue=,
+ \c!strip=\v!no, % auto or number
\c!nlines=]
\definetyping[\v!typing]
diff --git a/Master/texmf-dist/tex/context/base/bxml-apa.mkiv b/Master/texmf-dist/tex/context/base/bxml-apa.mkiv
new file mode 100644
index 00000000000..5fc87e5efc6
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/bxml-apa.mkiv
@@ -0,0 +1,613 @@
+%D \module
+%D [ file=bxml-apa,
+%D version=2010.05.14, % based on bibl-apa.tex
+%D title=APA bibliography style,
+%D subtitle=Publications,
+%D author={Taco Hoekwater \& Hans Hagen},
+%D date=\currentdate,
+%D copyright={Hans Hagen \& Taco Hoekwater}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+% helpers (todo)
+
+\let\maybeyear\firstofoneargument
+\let\etalchar \firstofoneargument
+
+\setupbibtexcitationvariants
+ [author,year]
+ [\c!andtext={ and },
+ \c!otherstext={ et al.},
+ \c!pubsep={, },
+ \c!lastpubsep={ and },
+ \c!compress=\v!no,
+ \c!inbetween={ },
+ \c!left={(},
+ \c!right={)}]
+
+\setupbibtexcitationvariants
+ [authoryear]
+ [\c!andtext={ and },
+ \c!otherstext={ et al.},
+ \c!pubsep={, },
+ \c!lastpubsep={ and },
+ \c!compress=\v!yes,
+ \c!inbetween={ },
+ \c!left={(},
+ \c!right={)}]
+
+\setupbibtexcitationvariants
+ [authoryears]
+ [\c!andtext={ and },
+ \c!otherstext={ et al.},
+ \c!pubsep={, },
+ \c!lastpubsep={ and },
+ \c!compress=\v!yes,
+ \c!inbetween={, },
+ \c!left={(},
+ \c!right={)}]
+
+\setupbibtexcitationvariants
+ [key,serial,authornum,page,short,type,doi,url]
+ [\c!andtext={ and },
+ \c!otherstext={ et al.},
+ \c!pubsep={, },
+ \c!lastpubsep={ and },
+ \c!compress=\v!no,
+ \c!inbetween={ },
+ \c!left={[},
+ \c!right={]}]
+
+\setupbibtexcitationvariants
+ [num]
+ [\c!andtext={ and },
+ \c!otherstext={ et al.},
+ \c!pubsep={, },
+ \c!lastpubsep={ and },
+ \c!compress=\v!yes,
+ \c!inbetween={--},
+ \c!left={[},
+ \c!right={]}]
+
+\setupbibtexpublications
+ [\c!sorttype=,
+ \c!criterium=,
+ \c!refcommand=authoryears,
+ \c!numbering=\v!no,
+ \c!autohang=\v!no]
+
+\setupbibtexpublications
+ [\c!width=2em, % 24pt,
+ \c!artauthor=invertedshort,
+ \c!editor=invertedshort,
+ \c!author=invertedshort,
+ \c!namesep={, },
+ \c!lastnamesep={ and },
+ \c!finalnamesep={ and },
+ \c!firstnamesep={, },
+ \c!juniorsep={ },
+ \c!vonsep={ },
+ \c!surnamesep={, },
+ \c!authoretallimit=5,
+ \c!editoretallimit=5,
+ \c!artauthoretallimit=5,
+ \c!authoretaldisplay=5,
+ \c!editoretaldisplay=5,
+ \c!artauthoretaldisplay=5,
+ \c!authoretaltext={ et al.},
+ \c!editoretaltext={ et al.},
+ \c!artauthoretaltext={ et al.}]
+
+% common
+
+\startxmlsetups bibtex:apa:common:wherefrom
+ \bibxmldoifelse {address} {
+ \getvariable{bibtex:temp}{left}
+ \bibxmldoifelse {country} {
+ \bibxmldoifelse {\getvariable{bibtex:temp}{label}} {
+ \bibxmlflush{address}\bibtexcomma\bibxmlflush{country}: \bibxmlflush{\getvariable{bibtex:temp}{label}}
+ } {
+ \bibxmlflush{address}\bibtexcomma\bibxmlflush{country}
+ }
+ } {
+ \bibxmldoifelse {\getvariable{bibtex:temp}{label}} {
+ \bibxmlflush{address}\bibtexcomma\bibxmlflush{\getvariable{bibtex:temp}{label}}
+ } {
+ \bibxmlflush{address}
+ }
+ }
+ \getvariable{bibtex:temp}{right}
+ } {
+ \bibxmldoifelse {country} {
+ \getvariable{bibtex:temp}{left}
+ \bibxmldoifelse {\getvariable{bibtex:temp}{label}} {
+ \bibxmlflush{country}: \bibxmlflush{\getvariable{bibtex:temp}{label}}
+ } {
+ \bibxmlflush{country}
+ }
+ \getvariable{bibtex:temp}{right}
+ } {
+ \bibxmldoifelse {\getvariable{bibtex:temp}{label}} {
+ \getvariable{bibtex:temp}{left}
+ \bibxmlflush{\getvariable{bibtex:temp}{label}}
+ \getvariable{bibtex:temp}{right}
+ } {
+ \getvariable{bibtex:temp}{otherwise}
+ }
+ }
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:publisher
+ \setvariables[bibtex:temp][label=publisher,left=,right=,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:organization
+ \setvariables[bibtex:temp][label=organization,left=,right=,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:school
+ \setvariables[bibtex:temp][label=school,left=,right=,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:institution
+ \setvariables[bibtex:temp][label=institution,left=,right=,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:school:subsentence
+ \setvariables[bibtex:temp][label=school,left=\bibtexcomma,right=\bibtexperiod,otherwise=\bibtexperiod]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:institution:subsentence
+ \setvariables[bibtex:temp][label=institution,left=\bibtexcomma,right=\bibtexperiod,otherwise=\bibtexperiod]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:publisher:sentence
+ \setvariables[bibtex:temp][label=publisher,left=\bibtexspace,right=\bibtexperiod,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+\startxmlsetups bibtex:apa:common:organization:sentence
+ \setvariables[bibtex:temp][label=organization,left=\bibtexspace,right=\bibtexperiod,otherwise=]\relax
+ \bibxmlsetup{bibtex:apa:common:wherefrom}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:title-and-series
+ \bibxmldoif {title} {
+ \bibxmlflush{title}
+ \bibxmldoif {series} {
+ \bibtexlparent\bibxmlflush{series}\bibtexrparent
+ }
+ \bibtexperiod
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:title-it-and-series
+ \bibxmldoif {title} {
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ \bibxmldoif {series} {
+ \bibtexlparent\bibxmlflush{series}\bibtexrparent
+ }
+ \bibtexperiod
+ }
+\stopxmlsetups
+
+\disablemode[bibtex:apa:edited-book]
+
+\startxmlsetups bibtex:apa:common:author-and-year
+ \bibxmldoif {author} {
+ \bibxmlsetup{bibtex:format:author}
+ }
+ \bibxmldoif {year} {
+ \bibtexlparent\bibxmlflush{year}\bibtexrparent
+ }
+ \bibtexperiod
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:author-or-key-and-year
+ \bibxmldoifelse {author} {
+ \bibxmlsetup{bibtex:format:author}
+ } {
+ \bibxmldoif {key} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:key}\bibtexrbracket
+ }
+ }
+ \bibxmldoif {year} {
+ \bibtexlparent\bibxmlflush{year}\bibtexrparent
+ }
+ \bibtexperiod
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:author-editors-crossref-year
+ \bibxmldoif {author} {
+ \bibxmlsetup{bibtex:format:author}
+ } {
+ \bibxmldoifelse {editor} {
+ \enablemode[bibtex:apa:edited-book]
+ \xmlsetup{#1}{bibtex:format:editor}
+ \bibtexcomma\bibtexsingularplural{editor}{editors}
+ } {
+ % weird period
+ \bibxmldoif {crossref} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket\bibtexperiod
+ }
+ }
+ }
+ \bibxmldoif {year} {
+ \bibtexlparent\bibxmlflush{year}\bibtexrparent
+ }
+ \bibtexperiod
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:editor-or-key-and-year
+ \bibxmldoifelse {editor} {
+ \enablemode[bibtex:apa:edited-book]
+ \xmlsetup{#1}{bibtex:format:editor}
+ \bibtexcomma\bibtexsingularplural{editor}{editors}
+ } {
+ \bibxmldoif {key} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:key}\bibtexrbracket
+ }
+ }
+ \bibtexspace
+ \bibxmldoif {year} {
+ \bibtexlparent\bibxmlflush{year}\bibtexrparent
+ }
+ \bibtexperiod
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:note
+ \bibxmldoif {note} {
+ \bibtexspace\bibxmlflush{note}\bibtexperiod
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:comment
+ \bibxmldoif {comment} {
+ \bibtexspace\bibxmlflush{comment}\bibtexperiod
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:pages:p
+ \bibxmldoif {pages} {
+ \bibtexspace\bibxmlflush{pages}\bibtexspace p\bibtexperiod
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:pages:pp
+ \bibxmldoif {pages} {
+ \bibtexspace\bibxmlflush{pages}\bibtexspace pp\bibtexperiod
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:pages:pages
+ \bibxmldoif {pages} {
+ \bibtexcomma pages~\bibxmlflush{pages}
+ }
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:edition:sentense
+ \bibxmldoif {edition} {
+ \bibtexspace\bibxmlflush{edition}\bibtexspace edition\bibtexperiod
+ }
+\stopxmlsetups
+
+% check ewhen the next is used (no period)
+
+% \startxmlsetups bibtex:apa:common:edition
+% \bibxmldoif {edition} {
+% \bibtexspace\bibxmlflush{edition}\bibtexspace edition
+% }
+% \stopxmlsetups
+
+% we can share more, todo
+
+% specific
+
+\startxmlsetups bibtex:apa:article
+ \bibxmlsetup{bibtex:apa:common:author-or-key-and-year}
+ \bibxmldoif {title} {
+ \bibxmlflush{title}\bibtexperiod
+ }
+ \bibxmldoifelse {journal} {
+ \bgroup\it\bibxmlflush{journal}\/\egroup
+ } {
+ \bibxmldoif {crossref} {
+ In\bibtexspace\bibxmlflush{crossref}
+ }
+ }
+ \bibxmldoifelse {volume} {
+ \bibtexcomma\bgroup\it\bibxmlflush{volume}\/\egroup
+ \bibxmldoif {issue} {
+ \bibtexlparent\bibxmlflush{issue}\bibtexlparent
+ }
+ \bibxmldoif {pages} {
+ \bibtexcomma\bibxmlflush{pages}
+ }
+ \bibtexperiod
+ } {
+ \bibxmlsetup{bibtex:apa:common:pages:pp}
+ }
+ \bibxmlsetup{bibtex:apa:common:note}
+ \bibxmlsetup{bibtex:apa:common:comment}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:book
+ \bibxmlsetup{bibtex:apa:common:author-editors-crossref-year}
+ \bibxmldoif {title} {
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ \doifmodeelse {bibtex:apa:edited-book} {
+ \bibxmldoifelse {volume} {
+ \bibtexspace Number\nonbreakablespace\bibxmlflush{volume}
+ \bibxmldoifelse {series} {
+ \bibtexspace in\nonbreakablespace\bibxmlflush{series}\bibtexperiod
+ } {
+ \bibxmldoifelse {crossref} {
+ \bibtexspace in\bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket
+ } {
+ \bibtexperiod
+ }
+ }
+ } {
+ \bibxmldoif {series} {
+ \bibtexspace\bibxmlflush{series}
+ }
+ \bibtexperiod
+ }
+ } {
+ \bibxmldoifelse {crossref} {
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ \bibxmldoif {volume} {
+ Volume\nonbreakablespace\bibxmlflush{volume}\bibtexspace of\nonbreakablespace
+ }
+ } {
+ \bibxmldoif {volume} {
+ \bibtexcomma volume\nonbreakablespace\bibxmlflush{volume}
+ \bibxmldoif {series} {
+ \bibtexspace of\nonbreakablespace\bgroup\it\bibxmlflush{series}\/\egroup
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ }
+ }
+ }
+ }
+ \bibxmlsetup{bibtex:apa:common:edition:sentence}
+ \bibxmlsetup{bibtex:apa:common:publisher:sentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}% twice?
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:inbook
+ \bibxmlsetup{bibtex:apa:common:author-editors-crossref-year}
+ \bibxmldoifelse {title} {
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ } {
+ \doifmodeelse {bibtex:apa:edited-book} {
+ \bibxmldoifelse {volume} {
+ \bibtexspace number\nonbreakablespace\bibxmlflush{volume}
+ \bibxmldoifelse {series} {
+ \bibtexspace in\nonbreakablespace\bibxmlflush{series}\bibtexperiod
+ } {
+ \bibxmldoifelse {crossref} {
+ \bibtexspace in\bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket
+ } {
+ \bibtexperiod
+ }
+ }
+ } {
+ \bibxmldoif {series} {
+ \bibtexspace\bibxmlflush{series}\bibtexperiod
+ }
+ }
+ } {
+ \bibxmldoifelse {crossref} {
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibxmldoif {volume} {
+ Volume\nonbreakablespace\bibxmlflush{volume}\bibtexspace of\nonbreakablespace
+ }
+ \bibxmldoif {crossref} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket
+ }
+ } {
+ \bibxmldoif {volume} {
+ \bibtexcomma volume\nonbreakablespace\bibxmlflush{volume}
+ \bibxmldoif {series} {
+ \bibtexspace of\nonbreakablespace\bgroup\it\bibxmlflush{series}\/\egroup
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ }
+ }
+ }
+ }
+ \bibtexspace
+ \bibxmlsetup{bibtex:apa:common:edition:sentence}
+ \bibxmlsetup{bibtex:apa:common:publisher}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:booklet
+ \bibxmlsetup{bibtex:apa:common:author-or-key-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-it-and-series}
+ \bibxmlsetup{bibtex:apa:common:edition:sentence}
+ \bibxmlsetup{bibtex:apa:common:publication:sentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:manual
+ \bibxmlsetup{bibtex:apa:common:author-or-key-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-it-and-series}
+ \bibxmlsetup{bibtex:apa:common:edition:sentence}
+ \bibxmlsetup{bibtex:apa:common:organization:sentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:incollection
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmldoif {arttitle} {
+ \bibxmlflush{arttitle}\bibtexperiod
+ }
+ In\bibtexspace
+ \bibxmldoifelse {title} {
+ \bibxmlsetup{bibtex:format:editors}\bibtexcomma
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ \bibxmldoif {series} {
+ \bibxmldoif {volume} {
+ \bibtexcomma number\bibtexspace\bibxmlflush{volume}\bibtexspace in
+ }
+ \bibtexspace\bibxmlflush{series}
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}\bibtexspace
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibxmldoif {edition} {
+ \bibtexspace\bibxmlflush{edition}\bibtexspace edition
+ }
+ \bibxmlsetup{bibtex:apa:common:publisher:sentence}
+ } {
+ \bibxmldoif {crossref} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}
+ }
+ \bibtexspace
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ }
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:inproceedings
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmldoif {arttitle} {
+ \bibxmlflush{arttitle}\bibtexperiod
+ }
+ In\bibtexspace
+ \bibxmldoifelse {title} {
+ \bibxmldoif {editors} {
+ \bibxmlflush{bibtex:apa:format:editors}
+ \bibtexcomma\bibtexsingularplural{editor}{editors}\bibtexcomma
+ }
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ \bibxmldoif {series} {
+ \bibxmldoif {volume} {
+ \bibtexcomma number~\bibxmlflush{volume} in
+ }
+ \bibtexspace
+ \bibxmlflush{series}
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}\bibtexspace
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ \bibxmlsetup{bibtex:apa:common:organization:sentence}
+ } {
+ \bibxmldoif {crossref} {
+ \bibtexlbracket\bibxmlsetup{bibtex:format:crossref}\bibtexrbracket
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}\bibtexspace
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ }
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:proceedings
+ \bibxmlsetup{bibtex:apa:common:editor-or-key-and-year}
+ \bibxmldoif {title} {
+ \bgroup\it\bibxmlflush{title}\/\egroup
+ \bibxmldoif {volume} {
+ \bibtexcomma number\bibtexspace\bibxmlflush{volume}\bibtexspace in\bibtexspace
+ }
+ \bibxmldoif {chapter} {
+ \bibtexcomma\bibxmlflush{chapter}\bibtexspace
+ }
+ \bibxmlsetup{bibtex:apa:common:pages:pages}
+ \bibtexperiod
+ \bibxmlsetup{bibtex:apa:common:organization:sentence}
+ }
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:common:thesis
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-it-and-series}
+ \bibxmldoifelse {type} {
+ \bibxmlflush{type}
+ } {
+ \getvariable{bibtex:temp}{label}
+ }
+ \bibxmlsetup{bibtex:apa:common:school:subsentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:mastersthesis
+ \setvariables[bibtex:temp][label=Master's thesis]
+ \bibxmlsetup{bibtex:apa:common:thesis}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:phdthesis
+ \setvariables[bibtex:temp][label=PhD thesis]
+ \bibxmlsetup{bibtex:apa:common:thesis}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:techreport
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-and-series}
+ \bibxmldoifelse {type} {
+ \bibxmlflush{type}
+ \bibxmldoif {volume} {
+ \bibtexspace\bibxmlflush{volume}
+ }
+ } {
+ \bibtexspace Technical Report
+ }
+ \bibxmlsetup{bibtex:apa:common:institution:subsentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:misc
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-and-series}
+ \bibxmlsetup{bibtex:apa:common:publisher:sentence}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\startxmlsetups bibtex:apa:unpublished
+ \bibxmlsetup{bibtex:apa:common:author-and-year}
+ \bibxmlsetup{bibtex:apa:common:title-and-series}
+ \bibxmlsetup{bibtex:apa:common:pages:p}
+ \bibxmldoif {type} {
+ \bibtexlparent\bibxmlflush{type}\bibtexrparent
+ }
+ \bibxmlsetup{bibtex:apa:common:note}
+\stopxmlsetups
+
+\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/catc-ctx.tex b/Master/texmf-dist/tex/context/base/catc-ctx.tex
index 83e802e7773..21e7d013641 100644
--- a/Master/texmf-dist/tex/context/base/catc-ctx.tex
+++ b/Master/texmf-dist/tex/context/base/catc-ctx.tex
@@ -14,13 +14,13 @@
%D We prefer to define relevant catcode tables in this file instead
%D of everywhere around.
-\ifx\ctxcatcodes \undefined \newcatcodetable \ctxcatcodes \fi
-\ifx\mthcatcodes \undefined \newcatcodetable \mthcatcodes \fi % math, not used, too tricky
-\ifx\xmlcatcodesn\undefined \newcatcodetable \xmlcatcodesn \fi % normal
-\ifx\xmlcatcodese\undefined \newcatcodetable \xmlcatcodese \fi % entitle
-\ifx\xmlcatcodesr\undefined \newcatcodetable \xmlcatcodesr \fi % reduce
-\ifx\typcatcodesa\undefined \newcatcodetable \typcatcodesa \fi % { }
-\ifx\typcatcodesb\undefined \newcatcodetable \typcatcodesb \fi % < >
+\ifdefined \ctxcatcodes \else \newcatcodetable \ctxcatcodes \fi
+\ifdefined \mthcatcodes \else \newcatcodetable \mthcatcodes \fi % math, not used, too tricky
+\ifdefined \xmlcatcodesn \else \newcatcodetable \xmlcatcodesn \fi % normal
+\ifdefined \xmlcatcodese \else \newcatcodetable \xmlcatcodese \fi % entitle
+\ifdefined \xmlcatcodesr \else \newcatcodetable \xmlcatcodesr \fi % reduce
+\ifdefined \typcatcodesa \else \newcatcodetable \typcatcodesa \fi % { }
+\ifdefined \typcatcodesb \else \newcatcodetable \typcatcodesb \fi % < >
\startcatcodetable \ctxcatcodes
\catcode`\^^I = 10
@@ -202,7 +202,7 @@
\catcodetable \ctxcatcodes
\let\defaultcatcodetable\ctxcatcodes
-\let\xmlcatcodes \xmlcatcodesn
+\let\xmlcatcodes \xmlcatcodesn % beware, in mkiv we use \notcatcodes
\endinput
diff --git a/Master/texmf-dist/tex/context/base/catc-def.tex b/Master/texmf-dist/tex/context/base/catc-def.tex
index 0346f6dae7a..e80cfe12539 100644
--- a/Master/texmf-dist/tex/context/base/catc-def.tex
+++ b/Master/texmf-dist/tex/context/base/catc-def.tex
@@ -13,12 +13,12 @@
%D The following catcode tables are rather \CONTEXT\ independent.
-\ifx\nilcatcodes \undefined \newcatcodetable \nilcatcodes \fi
-\ifx\texcatcodes \undefined \newcatcodetable \texcatcodes \fi
-\ifx\luacatcodes \undefined \newcatcodetable \luacatcodes \fi
-\ifx\notcatcodes \undefined \newcatcodetable \notcatcodes \fi
-\ifx\vrbcatcodes \undefined \newcatcodetable \vrbcatcodes \fi
-\ifx\prtcatcodes \undefined \newcatcodetable \prtcatcodes \fi
+\ifdefined\nilcatcodes \else \newcatcodetable \nilcatcodes \fi
+\ifdefined\texcatcodes \else \newcatcodetable \texcatcodes \fi
+\ifdefined\luacatcodes \else \newcatcodetable \luacatcodes \fi
+\ifdefined\notcatcodes \else \newcatcodetable \notcatcodes \fi
+\ifdefined\vrbcatcodes \else \newcatcodetable \vrbcatcodes \fi
+\ifdefined\prtcatcodes \else \newcatcodetable \prtcatcodes \fi
\startcatcodetable \nilcatcodes
\catcode`\^^I = 10 % ascii tab is a blank space
diff --git a/Master/texmf-dist/tex/context/base/catc-ini.lua b/Master/texmf-dist/tex/context/base/catc-ini.lua
index e1558b459a0..2749f403c9c 100644
--- a/Master/texmf-dist/tex/context/base/catc-ini.lua
+++ b/Master/texmf-dist/tex/context/base/catc-ini.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['catc-ini'] = {
version = 1.001,
- comment = "companion to catc-ini.tex",
+ comment = "companion to catc-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -17,7 +17,12 @@ storage.register("catcodes/names", catcodes.names, "catcodes.names")
function catcodes.register(name,number)
catcodes.numbers[name] = number
- catcodes.names[number] = name
+ local cnn = catcodes.names[number]
+ if cnn then
+ cnn[#cnn+1] = name
+ else
+ catcodes.names[number] = { name }
+ end
tex[name] = number
end
diff --git a/Master/texmf-dist/tex/context/base/catc-ini.mkiv b/Master/texmf-dist/tex/context/base/catc-ini.mkiv
index 668a55d3bdd..269330a1bbd 100644
--- a/Master/texmf-dist/tex/context/base/catc-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/catc-ini.mkiv
@@ -70,7 +70,7 @@
\catcode`\% \othercatcode
\catcode127 \othercatcode}
-\long\def\startcatcodetable#1#2\stopcatcodetable
+\long\normalprotected\def\startcatcodetable#1#2\stopcatcodetable
{\bgroup
\catcodetable\scratchcatcodes
\the\setdefaultcatcodes
@@ -80,7 +80,7 @@
\newcatcodetable\dummycatcodes
-\long\def\startextendcatcodetable#1#2\stopextendcatcodetable
+\long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable
{\bgroup
\catcodetable#1\relax
\globaldefs\plusone
@@ -90,7 +90,7 @@
% ==
%
-% \long\def\startextendcatcodetable#1#2\stopextendcatcodetable
+% \long\normalprotected\def\startextendcatcodetable#1#2\stopextendcatcodetable
% {\bgroup
% \scratchcounter\the\catcodetable
% \catcodetable #1 #2
@@ -107,7 +107,9 @@
%D The next command can be defined in a cleaner way in the
%D Mk IV file but we want to have a fast one with a minimal
-%D chance for interference.
+%D chance for interference. Do we still need this complex
+%D mechanism? Future versions of \MKIV\ might only use
+%D active characters for very special cases.
\chardef\activehackcode=`\~
@@ -128,7 +130,7 @@
\def\letcatcodecommandc % only first time
{\expandafter\gdef\csname CCL:\number\cctcountera:\number\cctcounterb\expandafter\endcsname\expandafter
{\expandafter\let\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname}%
- \reinstatecatcodecommanda
+ \reinstatecatcodecommandua % unexpanded
\csname CCL:\number\cctcountera:\number\cctcounterb\endcsname}
% expandable def
@@ -165,8 +167,8 @@
\def\uedcatcodecommandc % only first time
{\expandafter\gdef\csname CCU:\number\cctcountera:\number\cctcounterb\expandafter\endcsname
\expandafter##\expandafter1\expandafter
- {\expandafter\unexpanded\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}%
- \reinstatecatcodecommanda
+ {\expandafter\normalprotected\expandafter\def\csname CCC:\number\cctcountera:\number\cctcounterb\endcsname{##1}}%
+ \reinstatecatcodecommandua % unexpanded
\csname CCU:\number\cctcountera:\number\cctcounterb\endcsname}
\def\reinstatecatcodecommand{\afterassignment\reinstatecatcodecommanda\cctcounterb}
@@ -178,6 +180,13 @@
\uppercase{\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}%
\egroup}
+\def\reinstatecatcodecommandua % can be used when a direct definition has been done
+ {\bgroup % and the selector has been lost
+ \uccode\activehackcode\cctcounterb
+ \catcode\uccode\activehackcode\activecatcode
+ \uppercase{\normalprotected\xdef~{\noexpand\catcodecommand{\number\cctcounterb}}}%
+ \egroup}
+
\chardef\defaultcatcodetable\zerocount
\def\catcodecommand#1%
@@ -270,5 +279,39 @@
% \tracecatcodetables
+%D Only in \MKIV\ (to be used when crossing pages with changed catcodes
+%D in the current vector):
+%D
+%D \starttyping
+%D \normalprotected\def\startcrap
+%D {\bgroup
+%D \pushcatcodes
+%D \whitespace
+%D \obeylines
+%D \activatespacehandler\v!yes
+%D \strut}
+%D
+%D \normalprotected\def\stopcrap
+%D {\popcatcodes
+%D \egroup}
+%D \stoptyping
+
+\newcount\catcodetablelevel
+
+\def\pushcatcodes
+ {\bgroup
+ \global\advance\catcodetablelevel\plusone
+ \ifcsname @@ccf:\number\catcodetablelevel\endcsname \else
+ \global\advance\cctdefcounter\plusone
+ \expandafter\global\expandafter\chardef\csname @@ccf:\number\catcodetablelevel\endcsname\cctdefcounter
+ \fi
+ \catcodetable\ctxcatcodes
+ \expandafter\savecatcodetable\csname @@ccf:\number\catcodetablelevel\endcsname
+ \egroup
+ \expandafter\catcodetable\csname @@ccf:\number\catcodetablelevel\endcsname}
+
+\def\popcatcodes
+ {\global\advance\catcodetablelevel\minusone}
+
\endinput
diff --git a/Master/texmf-dist/tex/context/base/char-act.mkiv b/Master/texmf-dist/tex/context/base/char-act.mkiv
index 34358784a2a..2dc7823f0bf 100644
--- a/Master/texmf-dist/tex/context/base/char-act.mkiv
+++ b/Master/texmf-dist/tex/context/base/char-act.mkiv
@@ -102,6 +102,19 @@
\prettynaturalfont{\scantextokens\expandafter{\ascii}\ifhmode\unskip\fi}%
\egroup}
+%D What-a-mess:
+
+% \def\normalspacecodes
+% {\catcode`\^^I = 10
+% \catcode`\^^M = 5
+% \catcode`\^^L = 5
+% \catcode`\ = 10
+% \catcode`\^^Z = 9 }
+
+% \appendtoks
+% \normalspacecodes
+% \to \everybeforeoutput
+
\endinput \protect
% obsolete (old hack for idris)
diff --git a/Master/texmf-dist/tex/context/base/char-cmp.lua b/Master/texmf-dist/tex/context/base/char-cmp.lua
index bd33604996a..c7deb79010f 100644
--- a/Master/texmf-dist/tex/context/base/char-cmp.lua
+++ b/Master/texmf-dist/tex/context/base/char-cmp.lua
@@ -1,12 +1,13 @@
if not modules then modules = { } end modules ['char-cmp'] = {
version = 1.001,
- comment = "companion to char-ini.tex",
+ comment = "companion to char-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local utf = unicode.utf8
+local unpack = unpack or table.unpack
characters = characters or { }
characters.uncomposed = characters.uncomposed or { }
diff --git a/Master/texmf-dist/tex/context/base/char-def.lua b/Master/texmf-dist/tex/context/base/char-def.lua
index 665572ee81f..b7abee0fbf6 100644
--- a/Master/texmf-dist/tex/context/base/char-def.lua
+++ b/Master/texmf-dist/tex/context/base/char-def.lua
@@ -1,5 +1,6 @@
if not modules then modules = { } end modules ['char-def'] = {
version = 1.001,
+ comment = "companion to char-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -586,6 +587,7 @@ characters.data={
adobename="at",
category="po",
cjkwd="na",
+ contextname="textat",
description="COMMERCIAL AT",
direction="on",
linebreak="al",
@@ -885,7 +887,7 @@ characters.data={
direction="on",
linebreak="op",
mathclass="open",
- mathname="lbracket",
+ mathname="lbrack",
mirror=0x005D,
unicodeslot=0x005B,
},
@@ -909,7 +911,7 @@ characters.data={
direction="on",
linebreak="cl",
mathclass="close",
- mathname="rbracket",
+ mathname="rbrack",
mirror=0x005B,
unicodeslot=0x005D,
},
@@ -8710,6 +8712,8 @@ characters.data={
description="GREEK CAPITAL LETTER ALPHA",
direction="l",
lccode=0x03B1,
+ mathclass="variable",
+ mathname="Alpha",
linebreak="al",
unicodeslot=0x0391,
},
@@ -8721,6 +8725,8 @@ characters.data={
description="GREEK CAPITAL LETTER BETA",
direction="l",
lccode=0x03B2,
+ mathclass="variable",
+ mathname="Beta",
linebreak="al",
unicodeslot=0x0392,
},
@@ -8731,6 +8737,8 @@ characters.data={
contextname="greekGamma",
description="GREEK CAPITAL LETTER GAMMA",
direction="l",
+ mathclass="variable",
+ mathname="Gamma",
lccode=0x03B3,
linebreak="al",
unicodeslot=0x0393,
@@ -8741,6 +8749,8 @@ characters.data={
contextname="greekDelta",
description="GREEK CAPITAL LETTER DELTA",
direction="l",
+ mathclass="variable",
+ mathname="Delta",
lccode=0x03B4,
linebreak="al",
unicodeslot=0x0394,
@@ -8752,6 +8762,8 @@ characters.data={
contextname="greekEpsilon",
description="GREEK CAPITAL LETTER EPSILON",
direction="l",
+ mathclass="variable",
+ mathname="Epsilon",
lccode=0x03B5,
linebreak="al",
unicodeslot=0x0395,
@@ -8763,6 +8775,8 @@ characters.data={
contextname="greekZeta",
description="GREEK CAPITAL LETTER ZETA",
direction="l",
+ mathclass="variable",
+ mathname="Zeta",
lccode=0x03B6,
linebreak="al",
unicodeslot=0x0396,
@@ -8774,6 +8788,8 @@ characters.data={
contextname="greekEta",
description="GREEK CAPITAL LETTER ETA",
direction="l",
+ mathclass="variable",
+ mathname="Eta",
lccode=0x03B7,
linebreak="al",
unicodeslot=0x0397,
@@ -8785,6 +8801,8 @@ characters.data={
contextname="greekTheta",
description="GREEK CAPITAL LETTER THETA",
direction="l",
+ mathclass="variable",
+ mathname="Theta",
lccode=0x03B8,
linebreak="al",
unicodeslot=0x0398,
@@ -8796,6 +8814,8 @@ characters.data={
contextname="greekIota",
description="GREEK CAPITAL LETTER IOTA",
direction="l",
+ mathclass="variable",
+ mathname="Iota",
lccode=0x03B9,
linebreak="al",
unicodeslot=0x0399,
@@ -8807,6 +8827,8 @@ characters.data={
contextname="greekKappa",
description="GREEK CAPITAL LETTER KAPPA",
direction="l",
+ mathclass="variable",
+ mathname="Kappa",
lccode=0x03BA,
linebreak="al",
unicodeslot=0x039A,
@@ -8818,6 +8840,8 @@ characters.data={
contextname="greekLambda",
description="GREEK CAPITAL LETTER LAMDA",
direction="l",
+ mathclass="variable",
+ mathname="Lambda",
lccode=0x03BB,
linebreak="al",
unicodeslot=0x039B,
@@ -8829,6 +8853,8 @@ characters.data={
contextname="greekMu",
description="GREEK CAPITAL LETTER MU",
direction="l",
+ mathclass="variable",
+ mathname="Mu",
lccode=0x03BC,
linebreak="al",
unicodeslot=0x039C,
@@ -8840,6 +8866,8 @@ characters.data={
contextname="greekNu",
description="GREEK CAPITAL LETTER NU",
direction="l",
+ mathclass="variable",
+ mathname="Nu",
lccode=0x03BD,
linebreak="al",
unicodeslot=0x039D,
@@ -8851,6 +8879,8 @@ characters.data={
contextname="greekXi",
description="GREEK CAPITAL LETTER XI",
direction="l",
+ mathclass="variable",
+ mathname="Xi",
lccode=0x03BE,
linebreak="al",
unicodeslot=0x039E,
@@ -8862,6 +8892,8 @@ characters.data={
contextname="greekOmicron",
description="GREEK CAPITAL LETTER OMICRON",
direction="l",
+ mathclass="variable",
+ mathname="Omicron",
lccode=0x03BF,
linebreak="al",
unicodeslot=0x039F,
@@ -8873,6 +8905,8 @@ characters.data={
contextname="greekPi",
description="GREEK CAPITAL LETTER PI",
direction="l",
+ mathclass="variable",
+ mathname="Pi",
lccode=0x03C0,
linebreak="al",
unicodeslot=0x03A0,
@@ -8884,6 +8918,8 @@ characters.data={
contextname="greekRho",
description="GREEK CAPITAL LETTER RHO",
direction="l",
+ mathclass="variable",
+ mathname="Rho",
lccode=0x03C1,
linebreak="al",
unicodeslot=0x03A1,
@@ -8895,6 +8931,8 @@ characters.data={
contextname="greekSigma",
description="GREEK CAPITAL LETTER SIGMA",
direction="l",
+ mathclass="variable",
+ mathname="Sigma",
lccode=0x03C3,
linebreak="al",
unicodeslot=0x03A3,
@@ -8906,6 +8944,8 @@ characters.data={
contextname="greekTau",
description="GREEK CAPITAL LETTER TAU",
direction="l",
+ mathclass="variable",
+ mathname="Tau",
lccode=0x03C4,
linebreak="al",
unicodeslot=0x03A4,
@@ -8917,6 +8957,8 @@ characters.data={
contextname="greekUpsilon",
description="GREEK CAPITAL LETTER UPSILON",
direction="l",
+ mathclass="variable",
+ mathname="Upsilon",
lccode=0x03C5,
linebreak="al",
unicodeslot=0x03A5,
@@ -8928,6 +8970,8 @@ characters.data={
contextname="greekPhi",
description="GREEK CAPITAL LETTER PHI",
direction="l",
+ mathclass="variable",
+ mathname="Phi",
lccode=0x03C6,
linebreak="al",
unicodeslot=0x03A6,
@@ -8939,6 +8983,8 @@ characters.data={
contextname="greekChi",
description="GREEK CAPITAL LETTER CHI",
direction="l",
+ mathclass="variable",
+ mathname="Chi",
lccode=0x03C7,
linebreak="al",
unicodeslot=0x03A7,
@@ -8950,6 +8996,8 @@ characters.data={
contextname="greekPsi",
description="GREEK CAPITAL LETTER PSI",
direction="l",
+ mathclass="variable",
+ mathname="Psi",
lccode=0x03C8,
linebreak="al",
unicodeslot=0x03A8,
@@ -8960,6 +9008,8 @@ characters.data={
contextname="greekOmega",
description="GREEK CAPITAL LETTER OMEGA",
direction="l",
+ mathclass="variable",
+ mathname="Omega",
lccode=0x03C9,
linebreak="al",
unicodeslot=0x03A9,
@@ -9055,6 +9105,8 @@ characters.data={
description="GREEK SMALL LETTER ALPHA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="alpha",
uccode=0x0391,
unicodeslot=0x03B1,
},
@@ -9066,6 +9118,8 @@ characters.data={
description="GREEK SMALL LETTER BETA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="beta",
uccode=0x0392,
unicodeslot=0x03B2,
},
@@ -9077,6 +9131,8 @@ characters.data={
description="GREEK SMALL LETTER GAMMA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="gamma",
uccode=0x0393,
unicodeslot=0x03B3,
},
@@ -9088,6 +9144,8 @@ characters.data={
description="GREEK SMALL LETTER DELTA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="delta",
uccode=0x0394,
unicodeslot=0x03B4,
},
@@ -9099,6 +9157,8 @@ characters.data={
description="GREEK SMALL LETTER EPSILON",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="varepsilon",
uccode=0x0395,
unicodeslot=0x03B5,
},
@@ -9110,6 +9170,8 @@ characters.data={
description="GREEK SMALL LETTER ZETA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="zeta",
uccode=0x0396,
unicodeslot=0x03B6,
},
@@ -9121,6 +9183,8 @@ characters.data={
description="GREEK SMALL LETTER ETA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="eta",
uccode=0x0397,
unicodeslot=0x03B7,
},
@@ -9132,6 +9196,8 @@ characters.data={
description="GREEK SMALL LETTER THETA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="theta",
uccode=0x0398,
unicodeslot=0x03B8,
},
@@ -9143,6 +9209,8 @@ characters.data={
description="GREEK SMALL LETTER IOTA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="iota",
uccode=0x0399,
unicodeslot=0x03B9,
},
@@ -9154,6 +9222,8 @@ characters.data={
description="GREEK SMALL LETTER KAPPA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="kappa",
uccode=0x039A,
unicodeslot=0x03BA,
},
@@ -9165,6 +9235,8 @@ characters.data={
description="GREEK SMALL LETTER LAMDA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="lambda",
uccode=0x039B,
unicodeslot=0x03BB,
},
@@ -9175,6 +9247,8 @@ characters.data={
description="GREEK SMALL LETTER MU",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="mu",
uccode=0x039C,
unicodeslot=0x03BC,
},
@@ -9186,6 +9260,8 @@ characters.data={
description="GREEK SMALL LETTER NU",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="nu",
uccode=0x039D,
unicodeslot=0x03BD,
},
@@ -9197,6 +9273,8 @@ characters.data={
description="GREEK SMALL LETTER XI",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="xi",
uccode=0x039E,
unicodeslot=0x03BE,
},
@@ -9208,6 +9286,8 @@ characters.data={
description="GREEK SMALL LETTER OMICRON",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="omicron",
uccode=0x039F,
unicodeslot=0x03BF,
},
@@ -9219,6 +9299,8 @@ characters.data={
description="GREEK SMALL LETTER PI",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="pi",
uccode=0x03A0,
unicodeslot=0x03C0,
},
@@ -9230,6 +9312,8 @@ characters.data={
description="GREEK SMALL LETTER RHO",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="rho",
uccode=0x03A1,
unicodeslot=0x03C1,
},
@@ -9240,6 +9324,8 @@ characters.data={
description="GREEK SMALL LETTER FINAL SIGMA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="varsigma",
uccode=0x03A3,
unicodeslot=0x03C2,
},
@@ -9251,6 +9337,8 @@ characters.data={
description="GREEK SMALL LETTER SIGMA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="sigma",
uccode=0x03A3,
unicodeslot=0x03C3,
},
@@ -9262,6 +9350,8 @@ characters.data={
description="GREEK SMALL LETTER TAU",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="tau",
uccode=0x03A4,
unicodeslot=0x03C4,
},
@@ -9273,6 +9363,8 @@ characters.data={
description="GREEK SMALL LETTER UPSILON",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="upsilon",
uccode=0x03A5,
unicodeslot=0x03C5,
},
@@ -9284,6 +9376,8 @@ characters.data={
description="GREEK SMALL LETTER PHI",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="varphi",
uccode=0x03A6,
unicodeslot=0x03C6,
},
@@ -9295,6 +9389,8 @@ characters.data={
description="GREEK SMALL LETTER CHI",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="chi",
uccode=0x03A7,
unicodeslot=0x03C7,
},
@@ -9306,6 +9402,8 @@ characters.data={
description="GREEK SMALL LETTER PSI",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="psi",
uccode=0x03A8,
unicodeslot=0x03C8,
},
@@ -9317,6 +9415,8 @@ characters.data={
description="GREEK SMALL LETTER OMEGA",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="omega",
uccode=0x03A9,
unicodeslot=0x03C9,
},
@@ -9396,6 +9496,8 @@ characters.data={
description="GREEK THETA SYMBOL",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="varTheta",
specials={ "compat", 0x03B8 },
uccode=0x0398,
unicodeslot=0x03D1,
@@ -9433,6 +9535,8 @@ characters.data={
direction="l",
linebreak="al",
specials={ "compat", 0x03C6 },
+ mathclass="variable",
+ mathname="phi",
uccode=0x03A6,
unicodeslot=0x03D5,
},
@@ -9443,6 +9547,8 @@ characters.data={
description="GREEK PI SYMBOL",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="varpi",
specials={ "compat", 0x03C0 },
uccode=0x03A0,
unicodeslot=0x03D6,
@@ -9706,6 +9812,8 @@ characters.data={
description="GREEK LUNATE EPSILON SYMBOL",
direction="l",
linebreak="al",
+ mathclass="variable",
+ mathname="epsilon",
specials={ "compat", 0x03B5 },
uccode=0x0395,
unicodeslot=0x03F5,
@@ -13907,6 +14015,7 @@ characters.data={
category="cf",
description="ARABIC NUMBER SIGN",
direction="an",
+ visible="yes",
linebreak="al",
unicodeslot=0x0600,
},
@@ -13914,6 +14023,7 @@ characters.data={
category="cf",
description="ARABIC SIGN SANAH",
direction="an",
+ visible="yes",
linebreak="al",
unicodeslot=0x0601,
},
@@ -13921,6 +14031,7 @@ characters.data={
category="cf",
description="ARABIC FOOTNOTE MARKER",
direction="an",
+ visible="yes",
linebreak="al",
unicodeslot=0x0602,
},
@@ -13928,6 +14039,7 @@ characters.data={
category="cf",
description="ARABIC SIGN SAFHA",
direction="an",
+ visible="yes",
linebreak="al",
unicodeslot=0x0603,
},
@@ -15448,6 +15560,7 @@ characters.data={
category="cf",
description="ARABIC END OF AYAH",
direction="an",
+ visible="yes",
linebreak="al",
unicodeslot=0x06DD,
},
@@ -15797,6 +15910,7 @@ characters.data={
category="cf",
description="SYRIAC ABBREVIATION MARK",
direction="bn",
+ visible="yes",
linebreak="al",
unicodeslot=0x070F,
},
@@ -48736,6 +48850,7 @@ characters.data={
[0x200C]={
adobename="afii61664",
category="cf",
+ contextname="zwnj",
description="ZERO WIDTH NON-JOINER",
direction="bn",
linebreak="cm",
@@ -48744,6 +48859,7 @@ characters.data={
[0x200D]={
adobename="afii301",
category="cf",
+ contextname="zwj",
description="ZERO WIDTH JOINER",
direction="bn",
linebreak="cm",
@@ -49444,7 +49560,7 @@ characters.data={
[0x2061]={
category="cf",
comment="maybe: nulloperator",
- contextcommand="relax",
+ contextname="relax",
description="FUNCTION APPLICATION",
direction="bn",
linebreak="al",
@@ -50038,6 +50154,8 @@ characters.data={
description="COMBINING THREE DOTS ABOVE",
direction="nsm",
linebreak="cm",
+ mathclass="accent",
+ mathname="dddot",
unicodeslot=0x20DB,
},
[0x20DC]={
@@ -59877,6 +59995,8 @@ characters.data={
description="BLACK RIGHT-POINTING TRIANGLE",
direction="on",
linebreak="ai",
+ mathclass="bin",
+ mathname="blacktriangleright",
unicodeslot=0x25B6,
},
[0x25B7]={
@@ -59892,6 +60012,8 @@ characters.data={
description="BLACK RIGHT-POINTING SMALL TRIANGLE",
direction="on",
linebreak="al",
+ mathclass="bin",
+ mathname="blacktriangleleft",
unicodeslot=0x25B8,
},
[0x25B9]={
@@ -108416,6 +108538,7 @@ characters.data={
category="cf",
description="INTERLINEAR ANNOTATION ANCHOR",
direction="on",
+ visible="yes",
linebreak="cm",
unicodeslot=0xFFF9,
},
@@ -108423,6 +108546,7 @@ characters.data={
category="cf",
description="INTERLINEAR ANNOTATION SEPARATOR",
direction="on",
+ visible="yes",
linebreak="cm",
unicodeslot=0xFFFA,
},
@@ -108430,6 +108554,7 @@ characters.data={
category="cf",
description="INTERLINEAR ANNOTATION TERMINATOR",
direction="on",
+ visible="yes",
linebreak="cm",
unicodeslot=0xFFFB,
},
@@ -126093,6 +126218,7 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL V",
direction="l",
linebreak="al",
+--mathclass="variable",
specials={ "font", 0x0056 },
unicodeslot=0x1D449,
},
@@ -131209,8 +131335,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL ALPHA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Alpha",
specials={ "font", 0x0391 },
unicodeslot=0x1D6E2,
},
@@ -131219,8 +131343,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL BETA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Beta",
specials={ "font", 0x0392 },
unicodeslot=0x1D6E3,
},
@@ -131229,8 +131351,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL GAMMA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Gamma",
specials={ "font", 0x0393 },
unicodeslot=0x1D6E4,
},
@@ -131239,8 +131359,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL DELTA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Delta",
specials={ "font", 0x0394 },
unicodeslot=0x1D6E5,
},
@@ -131249,8 +131367,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL EPSILON",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Epsilon",
specials={ "font", 0x0395 },
unicodeslot=0x1D6E6,
},
@@ -131259,8 +131375,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL ZETA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Zeta",
specials={ "font", 0x0396 },
unicodeslot=0x1D6E7,
},
@@ -131269,8 +131383,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL ETA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Eta",
specials={ "font", 0x0397 },
unicodeslot=0x1D6E8,
},
@@ -131279,8 +131391,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL THETA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Theta",
specials={ "font", 0x0398 },
unicodeslot=0x1D6E9,
},
@@ -131289,8 +131399,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL IOTA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Iota",
specials={ "font", 0x0399 },
unicodeslot=0x1D6EA,
},
@@ -131299,8 +131407,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL KAPPA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Kappa",
specials={ "font", 0x039A },
unicodeslot=0x1D6EB,
},
@@ -131309,8 +131415,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL LAMDA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Lambda",
specials={ "font", 0x039B },
unicodeslot=0x1D6EC,
},
@@ -131319,8 +131423,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL MU",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Mu",
specials={ "font", 0x039C },
unicodeslot=0x1D6ED,
},
@@ -131329,8 +131431,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL NU",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Nu",
specials={ "font", 0x039D },
unicodeslot=0x1D6EE,
},
@@ -131339,8 +131439,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL XI",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Xi",
specials={ "font", 0x039E },
unicodeslot=0x1D6EF,
},
@@ -131349,8 +131447,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL OMICRON",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Omicron",
specials={ "font", 0x039F },
unicodeslot=0x1D6F0,
},
@@ -131359,8 +131455,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL PI",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Pi",
specials={ "font", 0x03A0 },
unicodeslot=0x1D6F1,
},
@@ -131369,8 +131463,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL RHO",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Rho",
specials={ "font", 0x03A1 },
unicodeslot=0x1D6F2,
},
@@ -131379,8 +131471,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL THETA SYMBOL",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="varTheta",
specials={ "font", 0x03F4 },
unicodeslot=0x1D6F3,
},
@@ -131389,8 +131479,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL SIGMA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Sigma",
specials={ "font", 0x03A3 },
unicodeslot=0x1D6F4,
},
@@ -131399,8 +131487,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL TAU",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Tau",
specials={ "font", 0x03A4 },
unicodeslot=0x1D6F5,
},
@@ -131409,8 +131495,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL UPSILON",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Upsilon",
specials={ "font", 0x03A5 },
unicodeslot=0x1D6F6,
},
@@ -131419,8 +131503,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL PHI",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Phi",
specials={ "font", 0x03A6 },
unicodeslot=0x1D6F7,
},
@@ -131429,8 +131511,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL CHI",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Chi",
specials={ "font", 0x03A7 },
unicodeslot=0x1D6F8,
},
@@ -131439,8 +131519,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL PSI",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Psi",
specials={ "font", 0x03A8 },
unicodeslot=0x1D6F9,
},
@@ -131449,8 +131527,6 @@ characters.data={
description="MATHEMATICAL ITALIC CAPITAL OMEGA",
direction="l",
linebreak="al",
- mathclass="variable",
- mathname="Omega",
specials={ "font", 0x03A9 },
unicodeslot=0x1D6FA,
},
@@ -131469,8 +131545,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL ALPHA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="alpha",
specials={ "font", 0x03B1 },
unicodeslot=0x1D6FC,
},
@@ -131479,8 +131553,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL BETA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="beta",
specials={ "font", 0x03B2 },
unicodeslot=0x1D6FD,
},
@@ -131489,8 +131561,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL GAMMA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="gamma",
specials={ "font", 0x03B3 },
unicodeslot=0x1D6FE,
},
@@ -131499,8 +131569,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL DELTA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="delta",
specials={ "font", 0x03B4 },
unicodeslot=0x1D6FF,
},
@@ -131509,8 +131577,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL EPSILON",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="varepsilon",
specials={ "font", 0x03B5 },
unicodeslot=0x1D700,
},
@@ -131519,8 +131585,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL ZETA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="zeta",
specials={ "font", 0x03B6 },
unicodeslot=0x1D701,
},
@@ -131529,8 +131593,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL ETA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="eta",
specials={ "font", 0x03B7 },
unicodeslot=0x1D702,
},
@@ -131539,8 +131601,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL THETA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="theta",
specials={ "font", 0x03B8 },
unicodeslot=0x1D703,
},
@@ -131549,8 +131609,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL IOTA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="iota",
specials={ "font", 0x03B9 },
unicodeslot=0x1D704,
},
@@ -131559,8 +131617,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL KAPPA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="kappa",
specials={ "font", 0x03BA },
unicodeslot=0x1D705,
},
@@ -131569,8 +131625,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL LAMDA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="lambda",
specials={ "font", 0x03BB },
unicodeslot=0x1D706,
},
@@ -131579,8 +131633,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL MU",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="mu",
specials={ "font", 0x03BC },
unicodeslot=0x1D707,
},
@@ -131589,8 +131641,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL NU",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="nu",
specials={ "font", 0x03BD },
unicodeslot=0x1D708,
},
@@ -131599,8 +131649,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL XI",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="xi",
specials={ "font", 0x03BE },
unicodeslot=0x1D709,
},
@@ -131609,8 +131657,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL OMICRON",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="omicron",
specials={ "font", 0x03BF },
unicodeslot=0x1D70A,
},
@@ -131619,8 +131665,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL PI",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="pi",
specials={ "font", 0x03C0 },
unicodeslot=0x1D70B,
},
@@ -131629,8 +131673,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL RHO",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="rho",
specials={ "font", 0x03C1 },
unicodeslot=0x1D70C,
},
@@ -131639,8 +131681,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL FINAL SIGMA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="varsigma",
specials={ "font", 0x03C2 },
unicodeslot=0x1D70D,
},
@@ -131649,8 +131689,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL SIGMA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="sigma",
specials={ "font", 0x03C3 },
unicodeslot=0x1D70E,
},
@@ -131659,8 +131697,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL TAU",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="tau",
specials={ "font", 0x03C4 },
unicodeslot=0x1D70F,
},
@@ -131669,8 +131705,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL UPSILON",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="upsilon",
specials={ "font", 0x03C5 },
unicodeslot=0x1D710,
},
@@ -131679,8 +131713,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL PHI",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="varphi",
specials={ "font", 0x03C6 },
unicodeslot=0x1D711,
},
@@ -131689,8 +131721,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL CHI",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="chi",
specials={ "font", 0x03C7 },
unicodeslot=0x1D712,
},
@@ -131699,8 +131729,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL PSI",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="psi",
specials={ "font", 0x03C8 },
unicodeslot=0x1D713,
},
@@ -131709,8 +131737,6 @@ characters.data={
description="MATHEMATICAL ITALIC SMALL OMEGA",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="omega",
specials={ "font", 0x03C9 },
unicodeslot=0x1D714,
},
@@ -131727,8 +131753,6 @@ characters.data={
description="MATHEMATICAL ITALIC EPSILON SYMBOL",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="epsilon",
specials={ "font", 0x03F5 },
unicodeslot=0x1D716,
},
@@ -131757,8 +131781,6 @@ characters.data={
description="MATHEMATICAL ITALIC PHI SYMBOL",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="phi",
specials={ "font", 0x03D5 },
unicodeslot=0x1D719,
},
@@ -131767,7 +131789,7 @@ characters.data={
description="MATHEMATICAL ITALIC RHO SYMBOL",
direction="l",
linebreak="al",
- mathclass="default",
+ mathclass="variable",
mathname="varrho",
specials={ "font", 0x03F1 },
unicodeslot=0x1D71A,
@@ -131777,8 +131799,6 @@ characters.data={
description="MATHEMATICAL ITALIC PI SYMBOL",
direction="l",
linebreak="al",
- mathclass="default",
- mathname="varpi",
specials={ "font", 0x03D6 },
unicodeslot=0x1D71B,
},
diff --git a/Master/texmf-dist/tex/context/base/char-enc.lua b/Master/texmf-dist/tex/context/base/char-enc.lua
index a4e5ac77d58..45f404ee985 100644
--- a/Master/texmf-dist/tex/context/base/char-enc.lua
+++ b/Master/texmf-dist/tex/context/base/char-enc.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['char-syn'] = {
version = 1.001,
- comment = "companion to char-ini.tex",
+ comment = "companion to char-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
diff --git a/Master/texmf-dist/tex/context/base/char-ini.lua b/Master/texmf-dist/tex/context/base/char-ini.lua
index ff42d91eeaa..5c4a40bad51 100644
--- a/Master/texmf-dist/tex/context/base/char-ini.lua
+++ b/Master/texmf-dist/tex/context/base/char-ini.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['char-ini'] = {
version = 1.001,
- comment = "companion to char-ini.tex",
+ comment = "companion to char-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -11,7 +11,7 @@ xml = xml or { }
local utf = unicode.utf8
-local utfchar, utfbyte = utf.char, utf.byte
+local utfchar, utfbyte, utfvalues = utf.char, utf.byte, string.utfvalues
local concat = table.concat
local next, tonumber = next, tonumber
local texsprint, texprint = tex.sprint, tex.print
@@ -422,6 +422,7 @@ function characters.define(tobelettered, tobeactivated) -- catcodetables
end
end
elseif is_command[category] then
+ -- this might change: contextcommand ipv contextname
-- texprint(format("{\\catcode %s=13\\unexpanded\\gdef %s{\\%s}}",u,utfchar(u),contextname))
texsprint("{\\catcode",u,"=13\\unexpanded\\gdef ",utfchar(u),"{\\"..contextname,"}}") -- no texprint
activated[#activated+1] = "\\c"..u.."\\a"
@@ -607,28 +608,91 @@ function characters.n_is_of_category(n,category) -- by name (string)
return cd and cd.category == category
end
--- xml support
-
-characters.active_offset = 0x10000
-
-xml.entities = xml.entities or { }
-
-storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml
+-- xml support (moved)
function characters.remapentity(chr,slot)
texsprint(format("{\\catcode%s=13\\xdef%s{\\string%s}}",slot,utfchar(slot),chr))
end
-function characters.setmkiventities()
- local entities = xml.entities
- entities.lt = "<"
- entities.amp = "&"
- entities.gt = ">"
+characters.active_offset = 0x10000 -- there will be remapped in that byte range
+
+-- xml.entities = xml.entities or { }
+--
+-- storage.register("xml/entities",xml.entities,"xml.entities") -- this will move to lxml
+--
+-- function characters.setmkiventities()
+-- local entities = xml.entities
+-- entities.lt = "<"
+-- entities.amp = "&"
+-- entities.gt = ">"
+-- end
+--
+-- function characters.setmkiientities()
+-- local entities = xml.entities
+-- entities.lt = utfchar(characters.active_offset + utfbyte("<"))
+-- entities.amp = utfchar(characters.active_offset + utfbyte("&"))
+-- entities.gt = utfchar(characters.active_offset + utfbyte(">"))
+-- end
+
+-- some day we will make a table
+
+function characters.lower(str)
+ local new = { }
+ for u in utfvalues(str) do
+ new[#new+1] = utfchar(data[u].lccode or u)
+ end
+ return concat(new)
end
-function characters.setmkiientities()
- local entities = xml.entities
- entities.lt = utfchar(characters.active_offset + utfbyte("<"))
- entities.amp = utfchar(characters.active_offset + utfbyte("&"))
- entities.gt = utfchar(characters.active_offset + utfbyte(">"))
+function characters.upper(str)
+ local new = { }
+ for u in utfvalues(str) do
+ new[#new+1] = utfchar(data[u].uccode or u)
+ end
+ return concat(new)
end
+
+-- -- some day we might go this route, but it does not really save that much
+-- -- so not now (we can generate a lot using mtx-unicode that operates on the
+-- -- database)
+--
+-- -- category cjkwd direction linebreak
+--
+-- -- adobename comment contextcommand contextname description fallback lccode
+-- -- mathclass mathfiller mathname mathspec mathstretch mathsymbol mirror
+-- -- range shcode specials uccode uccodes unicodeslot
+--
+-- local data = {
+-- ['one']={
+-- common = {
+-- category="cc",
+-- direction="bn",
+-- linebreak="cm",
+-- },
+-- vector = {
+-- [0x0000] = {
+-- description="NULL",
+-- group='one',
+-- unicodeslot=0x0000,
+-- },
+-- {
+-- description="START OF HEADING",
+-- group='one',
+-- unicodeslot=0x0001,
+-- },
+-- }
+-- }
+-- }
+--
+-- local chardata, groupdata = { }, { }
+--
+-- for group, gdata in next, data do
+-- local common, vector = { __index = gdata.common }, gdata.vector
+-- for character, cdata in next, vector do
+-- chardata[character] = cdata
+-- setmetatable(cdata,common)
+-- end
+-- groupdata[group] = gdata
+-- end
+
+--~ characters.data, characters.groups = chardata, groupdata
diff --git a/Master/texmf-dist/tex/context/base/char-ini.mkiv b/Master/texmf-dist/tex/context/base/char-ini.mkiv
index daa20e72867..0d5e16bb04b 100644
--- a/Master/texmf-dist/tex/context/base/char-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/char-ini.mkiv
@@ -17,6 +17,7 @@
\registerctxluafile{char-ini}{1.001}
\registerctxluafile{char-cmp}{1.001} % maybe we will load this someplace else
\registerctxluafile{char-map}{1.001} % maybe we will load this someplace else
+\registerctxluafile{char-tex}{1.001}
\unprotect
@@ -69,6 +70,7 @@
\number\xmlcatcodesr,
}
)
+ catcodes.register("xmlcatcodes",\number\xmlcatcodes)
}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/char-map.lua b/Master/texmf-dist/tex/context/base/char-map.lua
index 0d8422bc2d3..3f8cc3b3d3c 100644
--- a/Master/texmf-dist/tex/context/base/char-map.lua
+++ b/Master/texmf-dist/tex/context/base/char-map.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['char-map'] = {
version = 1.001,
- comment = "companion to char-ini.tex",
+ comment = "companion to char-ini.mkiv",
author = "Hans Hagen & Arthur Reutenauer",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
diff --git a/Master/texmf-dist/tex/context/base/char-tex.lua b/Master/texmf-dist/tex/context/base/char-tex.lua
new file mode 100644
index 00000000000..ed9a244d781
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/char-tex.lua
@@ -0,0 +1,89 @@
+if not modules then modules = { } end modules ['char-tex'] = {
+ version = 1.001,
+ comment = "companion to char-ini.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+characters = characters or { }
+characters.tex = characters.tex or { }
+
+local find = string.find
+
+local accent_map = {
+ ['~'] = "̃" , -- ̃ Ẽ
+ ['"'] = "̈" , -- ̈ Ë
+ ["`"] = "̀" , -- ̀ È
+ ["'"] = "Ì" , -- Ì Ã‰
+ ["^"] = "̂" , -- ̂ Ê
+ -- Ì„ Ä’
+ -- ̆ Ĕ
+ -- ̇ Ė
+ -- ̉ Ẻ
+ -- ̌ Ě
+ -- Ì È„
+ -- ̑ Ȇ
+ -- ̣ Ẹ
+ -- ̧ Ȩ
+ -- ̨ Ę
+ -- Ì á¸˜
+ -- ̰ Ḛ
+}
+
+local accents = table.concat(table.keys(accent_map))
+
+local function remap_accents(a,c,braced)
+ local m = accent_map[a]
+ if m then
+ return c .. m
+ elseif braced then
+ return "\\" .. a .. "{" .. c .. "}"
+ else
+ return "\\" .. a .. c
+ end
+end
+
+local command_map = {
+ ["i"] = "ı"
+}
+
+local function remap_commands(c)
+ local m = command_map[c]
+ if m then
+ return m
+ else
+ return "\\" .. c
+ end
+end
+
+local P, C, R, S, Cs, Cc = lpeg.P, lpeg.C, lpeg.R, lpeg.S, lpeg.Cs, lpeg.Cc
+local U, lpegmatch = lpeg.patterns.utf8, lpeg.match
+
+local accents = (P('\\') * C(S(accents)) * (P("{") * C(U) * P("}" * Cc(true)) + C(U) * Cc(false))) / remap_accents
+local commands = (P('\\') * C(R("az","AZ")^1)) / remap_commands
+
+local convert_accents = Cs((accents + P(1))^0)
+local convert_commands = Cs((commands + P(1))^0)
+
+local no_l = P("{") / ""
+local no_r = P("}") / ""
+
+local convert_accents_strip = Cs((no_l * accents * no_r + accents + P(1))^0)
+local convert_commands_strip = Cs((no_l * commands * no_r + commands + P(1))^0)
+
+function characters.tex.toutf(str,strip)
+ if find(str,"\\") then -- we can start at teh found position
+ if strip then
+ str = lpegmatch(convert_commands_strip,str)
+ str = lpegmatch(convert_accents_strip,str)
+ else
+ str = lpegmatch(convert_commands,str)
+ str = lpegmatch(convert_accents,str)
+ end
+ end
+ return str
+end
+
+--~ print(characters.tex.toutf([[\"{e}]]),true)
+--~ print(characters.tex.toutf([[{\"{e}}]],true))
diff --git a/Master/texmf-dist/tex/context/base/char-utf.lua b/Master/texmf-dist/tex/context/base/char-utf.lua
index 7dd5d914f79..6dd85fdc87d 100644
--- a/Master/texmf-dist/tex/context/base/char-utf.lua
+++ b/Master/texmf-dist/tex/context/base/char-utf.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['char-utf'] = {
version = 1.001,
- comment = "companion to char-utf.tex",
+ comment = "companion to char-utf.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
diff --git a/Master/texmf-dist/tex/context/base/char-utf.mkiv b/Master/texmf-dist/tex/context/base/char-utf.mkiv
index d21cd842cc2..16b4029d8cb 100644
--- a/Master/texmf-dist/tex/context/base/char-utf.mkiv
+++ b/Master/texmf-dist/tex/context/base/char-utf.mkiv
@@ -41,7 +41,7 @@
%D \definecomposedutf 318 108 126 % lcaron
%D \stoptyping
-\def\definecomposedutf#1 #2 #3 %
+\unexpanded\def\definecomposedutf#1 #2 #3 %
{\ctxlua{characters.filters.utf.add_grapheme("#1","#2","#3")}}
\protect
diff --git a/Master/texmf-dist/tex/context/base/chem-ini.lua b/Master/texmf-dist/tex/context/base/chem-ini.lua
index 27b73484008..90874909207 100644
--- a/Master/texmf-dist/tex/context/base/chem-ini.lua
+++ b/Master/texmf-dist/tex/context/base/chem-ini.lua
@@ -1,12 +1,13 @@
if not modules then modules = { } end modules ['chem-ini'] = {
version = 1.001,
- comment = "companion to chem-ini.tex",
+ comment = "companion to chem-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local format, texsprint = string.format, tex.sprint
+local lpegmatch = lpeg.match
local trace_molecules = false trackers.register("chemistry.molecules", function(v) trace_molecules = v end)
@@ -60,15 +61,15 @@ local parser = lpeg.Cs((csname + lowhigh + highlow + low + high + sign + any
chemicals.moleculeparser = parser -- can be used to avoid functioncall
function chemicals.molecule(str)
- return parser:match(str)
+ return lpegmatch(parser,str)
end
function commands.molecule(str)
if trace_molecules then
- local rep = parser:match(str)
+ local rep = lpegmatch(parser,str)
logs.report("chemistry", "molecule %s => %s",str,rep)
texsprint(ctxcatcodes,rep)
else
- texsprint(ctxcatcodes,parser:match(str))
+ texsprint(ctxcatcodes,lpegmatch(parser,str))
end
end
diff --git a/Master/texmf-dist/tex/context/base/chem-ini.mkiv b/Master/texmf-dist/tex/context/base/chem-ini.mkiv
index da240dbace5..5184fe1a7a0 100644
--- a/Master/texmf-dist/tex/context/base/chem-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/chem-ini.mkiv
@@ -17,7 +17,7 @@
\unprotect
%D \macros
-%D {\molecule}
+%D {molecule}
%D
%D Quick and dirty:
%D
diff --git a/Master/texmf-dist/tex/context/base/chem-str.lua b/Master/texmf-dist/tex/context/base/chem-str.lua
index 8ab48fca2af..ad4cc6c1be4 100644
--- a/Master/texmf-dist/tex/context/base/chem-str.lua
+++ b/Master/texmf-dist/tex/context/base/chem-str.lua
@@ -1,6 +1,6 @@
if not modules then modules = { } end modules ['chem-str'] = {
version = 1.001,
- comment = "companion to chem-str.tex",
+ comment = "companion to chem-str.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -17,6 +17,7 @@ local format, gmatch, match, lower, gsub = string.format, string.gmatch, string.
local concat, insert, remove = table.concat, table.insert, table.remove
local apply = structure.processors.apply
local texsprint, ctxcatcodes = tex.sprint, tex.ctxcatcodes
+local lpegmatch = lpeg.match
local variables = interfaces.variables
@@ -59,7 +60,7 @@ local one_keys = {
sb = "line", db = "line", tb = "line",
ep = "line", es = "line", ed = "line", et = "line",
sd = "line", ldd = "line", rdd = "line",
- hb = "line", bb = "line", oe = "line",
+ hb = "line", bb = "line", oe = "line", bd = "line", bw = "line",
z = "text", cz = "text", zt = "text", zn = "number",
zbt = "text", zbn = "number", ztt = "text", ztn = "number",
mov = "transform", sub = "transform", dir = "transform", off = "transform",
@@ -141,10 +142,11 @@ local syntax = {
local definitions = { }
function chemicals.undefine(name)
- definitions[name] = nil
+ definitions[lower(name)] = nil
end
function chemicals.define(name,spec,text)
+ name = lower(name)
local dn = definitions[name]
if not dn then dn = { } definitions[name] = dn end
dn[#dn+1] = {
@@ -154,7 +156,7 @@ function chemicals.define(name,spec,text)
end
local metacode, kind, keys, bonds, max, txt, textsize, rot, pstack
-local molecule = chemicals.molecule -- or use chemicals.moleculeparser:match(...)
+local molecule = chemicals.molecule -- or use lpegmatch(chemicals.moleculeparser,...)
local function fetch(txt)
local st = stack[txt]
@@ -197,12 +199,12 @@ local pattern =
lpeg.Cc(false) * lpeg.Cc(false) * lpeg.Cc(false) * text
)
---~ local n, operation, index, upto, set, text = pattern:match("RZ1357")
+--~ local n, operation, index, upto, set, text = lpegmatch(pattern,"RZ1357")
---~ print(pattern:match("RZ=x")) 1 RZ false false false x
---~ print(pattern:match("RZ1=x")) 1 RZ 1 false false x
---~ print(pattern:match("RZ1..3=x")) 1 RZ 1 3 false x
---~ print(pattern:match("RZ13=x")) 1 RZ false false table x
+--~ print(lpegmatch(pattern,"RZ=x")) 1 RZ false false false x
+--~ print(lpegmatch(pattern,"RZ1=x")) 1 RZ 1 false false x
+--~ print(lpegmatch(pattern,"RZ1..3=x")) 1 RZ 1 3 false x
+--~ print(lpegmatch(pattern,"RZ13=x")) 1 RZ false false table x
local function process(spec,text,n,rulethickness,rulecolor,offset)
insert(stack,{ spec=spec, text=text, n=n })
@@ -216,7 +218,7 @@ local function process(spec,text,n,rulethickness,rulecolor,offset)
process(di.spec,di.text,1,rulethickness,rulecolor)
end
else
- local rep, operation, special, index, upto, set, text = pattern:match(s)
+ local rep, operation, special, index, upto, set, text = lpegmatch(pattern,s)
if operation == "pb" then
insert(pstack,kind)
metacode[#metacode+1] = syntax.pb.direct
@@ -441,7 +443,7 @@ function chemicals.stop()
if trace_structure then
logs.report("chemical", "metapost code:\n%s", mpcode)
end
- metapost.graphic(chemicals.instance,chemicals.format,mpcode,"")
+ metapost.graphic(chemicals.instance,chemicals.format,mpcode)
metacode = nil
end
diff --git a/Master/texmf-dist/tex/context/base/chem-str.mkiv b/Master/texmf-dist/tex/context/base/chem-str.mkiv
index 29c6fe939bd..1e17218c875 100644
--- a/Master/texmf-dist/tex/context/base/chem-str.mkiv
+++ b/Master/texmf-dist/tex/context/base/chem-str.mkiv
@@ -49,7 +49,7 @@
\unprotect
-\def\setupchemical
+\unexpanded\def\setupchemical
{\dosingleempty\dosetupchemical}
\def\dosetupchemical
@@ -57,7 +57,7 @@
\let\setupchemicals\setupchemical
-\def\setupchemicalframed
+\unexpanded\def\setupchemicalframed
{\dosingleempty\dosetupchemicalframed}
\def\dosetupchemicalframed
@@ -65,7 +65,7 @@
\def\chemicalparameter#1{\csname\??cm#1\endcsname}
-\def\definechemical
+\unexpanded\def\definechemical
{\dosingleargument\dodefinechemical} % global
\def\dodefinechemical[#1]#2%
@@ -76,7 +76,7 @@
#2% flush
\stopnointerference}
-\def\definechemicalsymbol
+\unexpanded\def\definechemicalsymbol
{\dodoubleempty\dodefinechemicalsymbol}
\def\dodefinechemicalsymbol[#1][#2]%
@@ -100,6 +100,9 @@
\def\dochemicaltext#1% in ppchtex we had a more clever alignment
{\dosetchemicaltext\strut#1} % maybe also \setstrut
+\def\dochemicaltext#1%
+ {\mathematics{\dosetchemicaltext\strut\ifcase\currentxfontsize\or\scriptstyle\or\scriptscriptstyle\fi#1}}
+
\newconditional\indisplaychemical
\unexpanded\def\startchemical
@@ -437,7 +440,7 @@
\newif\ifinchemicalformula
-\def\startchemicalformula
+\unexpanded\def\startchemicalformula
{\mathortext\vcenter\vbox\bgroup
\forgetall
\inchemicalformulatrue
@@ -450,7 +453,7 @@
\setfalse\formulachemicalhastop
\setfalse\formulachemicalhasbot }
-\def\stopchemicalformula
+\unexpanded\def\stopchemicalformula
{\tabskip1em\relax
\nointerlineskip
\ifconditional\formulachemicalhastop
diff --git a/Master/texmf-dist/tex/context/base/colo-ext.mkii b/Master/texmf-dist/tex/context/base/colo-ext.mkii
index 06facd34ee2..473c010e028 100644
--- a/Master/texmf-dist/tex/context/base/colo-ext.mkii
+++ b/Master/texmf-dist/tex/context/base/colo-ext.mkii
@@ -42,12 +42,14 @@
%D handling. Here we deal with a per-document setting.
\setupcolors
- [\c!overprint=\v!no]
+ [\c!intent=\v!none]
\def\starttextoverprint
- {\doifelse\@@cloverprint\v!yes
- {\let\stoptextoverprint\dostopoverprint\dostartoverprint}
- {\let\stoptextoverprint\donothing}}
+ {\doifelse\@@clintent\v!overprint
+ {\glet\stoptextoverprint \dostopoverprint
+ \glet\starttextoverprint\dostartoverprint
+ \dostartoverprint}
+ {\glet\stoptextoverprint\donothing}}
\let\stoptextoverprint\donothing
diff --git a/Master/texmf-dist/tex/context/base/colo-ext.mkiv b/Master/texmf-dist/tex/context/base/colo-ext.mkiv
index 1c1f0d1afff..b17608f59c1 100644
--- a/Master/texmf-dist/tex/context/base/colo-ext.mkiv
+++ b/Master/texmf-dist/tex/context/base/colo-ext.mkiv
@@ -41,17 +41,63 @@
%D or independent. For the moment we only support independent overprint
%D handling. Here we deal with a per-document setting.
+\unexpanded\def\startcolorintent[#1]%
+ {\pushattribute\colorintentattribute
+ \dotriggercolorintent{#1}}
+
+\unexpanded\def\stopcolorintent
+ {\popattribute\colorintentattribute}
+
+\unexpanded\def\startoverprint{\startcolorintent[\v!overprint]}
+\unexpanded\def\stopoverprint {\stopcolorintent}
+
+\unexpanded\def\startknockout {\startcolorintent[\v!knockout ]}
+\unexpanded\def\stopknockout {\stopcolorintent}
+
+\let\starttextcolorintent\relax
+\let\stoptextcolorintent \relax
+
\setupcolors
[\c!overprint=\v!no]
-\def\starttextoverprint
- {\doifelse\@@cloverprint\v!yes
- {\let\stoptextoverprint\stopoverprintproperty\startoverprintproperty}
- {\let\stoptextoverprint\donothing}}
+\appendtoks
+ \dosettextcolorintent
+\to \everysetupcolors
+
+\def\dosettextcolorintent
+ {\doifnot\@@clintent\v!none
+ {\xdef\starttextcolorintent{\noexpand\dotriggercolorintent{\@@clintent}}%
+ \glet\dosettextcolorintent\relax
+ \dotriggercolorintent\@@clintent}}
+
+\appendtoks \starttextcolorintent \to \everystarttextproperties
+\appendtoks \stoptextcolorintent \to \everystoptextproperties
+
+\setupcolors[\c!intent=\v!none]
+
+% A goodie that replaces the startMPcolor hackery
+%
+% \definecolor[red-t] [r=1,t=0.5,a=1]
+% \definecolor[green-t][g=1,t=0.5,a=1]
+% \defineintermediatecolor[mycolora][0.5,red,green]
+% \defineintermediatecolor[mycolorb][0.5,red-t,green-t]
+% \starttext
+% test {\mycolora OEPS} test
+% test {\mycolorb OEPS} test
+% \stoptext
+
+\unexpanded\def\defineintermediatecolor
+ {\dotripleempty\dodefineintermediatecolor}
-\let\stoptextoverprint\donothing
+\def\dodefineintermediatecolor[#1][#2][#3]% \dotripleempty adds {} inside []
+ {\dododefineintermediatecolor[#1][#2][#3]}
-\appendtoks \starttextoverprint \to \everystarttextproperties
-\appendtoks \stoptextoverprint \to \everystoptextproperties
+\def\dododefineintermediatecolor[#1][#2,#3,#4][#5]%
+ {\ifconditional\collectcolorsinlist\collectcolorinlist{#1}\fi
+ \ctxlua{colors.defineintermediatecolor("#1","#2",
+ \thecolorattribute{#3},\thecolorattribute{#4},
+ \thetransparencyattribute{#3},\thetransparencyattribute{#4},
+ "#5",false,\iffreezecolors true\else false\fi)}% not global
+ \dodefinecolorcommand\setvalue{#1}}
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/colo-hex.mkii b/Master/texmf-dist/tex/context/base/colo-hex.mkii
index 7cef6e8a2ad..db67f184102 100644
--- a/Master/texmf-dist/tex/context/base/colo-hex.mkii
+++ b/Master/texmf-dist/tex/context/base/colo-hex.mkii
@@ -11,8 +11,8 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\ifx\dodododefinecolor\undefined \else
- \endinput
+\ifdefined \hexcolorprefix
+ \expandafter \endinput
\fi
\writestatus{loading}{ConTeXt Color Macros / Hexadecimal}
diff --git a/Master/texmf-dist/tex/context/base/colo-hex.mkiv b/Master/texmf-dist/tex/context/base/colo-hex.mkiv
index dd8e039389b..f661b2445f1 100644
--- a/Master/texmf-dist/tex/context/base/colo-hex.mkiv
+++ b/Master/texmf-dist/tex/context/base/colo-hex.mkiv
@@ -23,4 +23,6 @@
% fill (point 0 of p -- point 3 of p -- point 2 of p --cycle) withcolor \MPcolor{hextestcolor} ; % top left part
% \stopMPpage
+\def\checkhexcolor[#1]{\doifcolorelse{#1}\donothing{\definecolor[#1][x=#1]}} % is this ok?
+
\endinput
diff --git a/Master/texmf-dist/tex/context/base/colo-ini.lua b/Master/texmf-dist/tex/context/base/colo-ini.lua
index a67df6a778e..342d6110dca 100644
--- a/Master/texmf-dist/tex/context/base/colo-ini.lua
+++ b/Master/texmf-dist/tex/context/base/colo-ini.lua
@@ -1,16 +1,19 @@
if not modules then modules = { } end modules ['colo-ini'] = {
version = 1.000,
- comment = "companion to colo-ini.tex",
+ comment = "companion to colo-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
+local type = type
local concat = table.concat
-local format, gmatch, gsub, lower, match = string.format, string.gmatch, string.gsub, string.lower, string.match
+local format, gmatch, gsub, lower, match, find = string.format, string.gmatch, string.gsub, string.lower, string.match, string.find
local texsprint = tex.sprint
local ctxcatcodes = tex.ctxcatcodes
+local trace_define = false trackers.register("colors.define",function(v) trace_define = v end)
+
local settings_to_hash_strict = aux.settings_to_hash_strict
colors = colors or { }
@@ -23,89 +26,93 @@ local a_transparency = attributes.private('transparency')
local a_colorspace = attributes.private('colormodel')
local a_background = attributes.private('background')
-local a_l_c_template = "\\setevalue{(ca:%s)}{%s}" ..
- "\\setevalue{(cs:%s)}{\\dosetattribute{color}{%s}}"
-local a_g_c_template = "\\setxvalue{(ca:%s)}{%s}" ..
- "\\setxvalue{(cs:%s)}{\\dosetattribute{color}{%s}}"
-local f_l_c_template = "\\setvalue {(ca:%s)}{\\doinheritca{%s}}" ..
- "\\setvalue {(cs:%s)}{\\doinheritcs{%s}}"
-local f_g_c_template = "\\setgvalue{(ca:%s)}{\\doinheritca{%s}}" ..
- "\\setgvalue{(cs:%s)}{\\doinheritcs{%s}}"
-local r_l_c_template = "\\localundefine{(ca:%s)}" ..
- "\\localundefine{(cs:%s)}"
-local r_g_c_template = "\\globalundefine{(ca:%s)}" ..
- "\\globalundefine{(cs:%s)}"
-
-local a_l_t_template = "\\setevalue{(ta:%s)}{%s}" ..
- "\\setevalue{(ts:%s)}{\\dosetattribute{transparency}{%s}}"
-local a_g_t_template = "\\setxvalue{(ta:%s)}{%s}" ..
- "\\setxvalue{(ts:%s)}{\\dosetattribute{transparency}{%s}}"
-local f_l_t_template = "\\setvalue {(ta:%s)}{\\doinheritta{%s}}" ..
- "\\setvalue {(ts:%s)}{\\doinheritts{%s}}"
-local f_g_t_template = "\\setgvalue{(ta:%s)}{\\doinheritta{%s}}" ..
- "\\setgvalue{(ts:%s)}{\\doinheritts{%s}}"
-local r_l_t_template = "\\localundefine{(ta:%s)}" ..
- "\\localundefine{(ts:%s)}"
-local r_g_t_template = "\\globalundefine{(ta:%s)}" ..
- "\\globalundefine{(ts:%s)}"
+local register_color = colors.register
+local attributes_list = attributes.list
local function definecolor(name, ca, global)
if ca and ca > 0 then
if global then
- texsprint(ctxcatcodes,format(a_g_c_template, name, ca, name, ca))
+ if trace_define then
+ commands.writestatus("color","define global color '%s' with attribute: %s",name,ca)
+ end
+ context.colordefagc(name,ca)
else
- texsprint(ctxcatcodes,format(a_l_c_template, name, ca, name, ca))
+ if trace_define then
+ commands.writestatus("color","define local color '%s' with attribute: %s",name,ca)
+ end
+ context.colordefalc(name,ca)
end
else
if global then
- texsprint(ctxcatcodes,format(r_g_c_template, name, name))
+ context.colordefrgc(name)
else
- texsprint(ctxcatcodes,format(r_l_c_template, name, name))
+ context.colordefrlc(name)
end
end
end
+
local function inheritcolor(name, ca, global)
if ca and ca ~= "" then
if global then
- texsprint(ctxcatcodes,format(f_g_c_template, name, ca, name, ca))
+ if trace_define then
+ commands.writestatus("color","inherit global color '%s' with attribute: %s",name,ca)
+ end
+ context.colordeffgc(name,ca)
else
- texsprint(ctxcatcodes,format(f_l_c_template, name, ca, name, ca))
+ if trace_define then
+ commands.writestatus("color","inherit local color '%s' with attribute: %s",name,ca)
+ end
+ context.colordefflc(name,ca)
end
else
if global then
- texsprint(ctxcatcodes,format(r_g_c_template, name, name))
+ context.colordefrgc(name)
else
- texsprint(ctxcatcodes,format(r_l_c_template, name, name))
+ context.colordefrlc(name)
end
end
end
+
local function definetransparent(name, ta, global)
if ta and ta > 0 then
if global then
- texsprint(ctxcatcodes,format(a_g_t_template, name, ta, name, ta))
+ if trace_define then
+ commands.writestatus("color","define global transparency '%s' with attribute: %s",name,ta)
+ end
+ context.colordefagt(name,ta)
else
- texsprint(ctxcatcodes,format(a_l_t_template, name, ta, name, ta))
+ if trace_define then
+ commands.writestatus("color","define local transparency '%s' with attribute: %s",name,ta)
+ end
+ context.colordefalt(name,ta)
end
else
if global then
- texsprint(ctxcatcodes,format(r_g_t_template, name, name))
+ context.colordefrgt(name)
else
- texsprint(ctxcatcodes,format(r_l_t_template, name, name))
+ context.colordefrlt(name)
end
end
end
+
local function inherittransparent(name, ta, global)
if ta and ta ~= "" then
if global then
- texsprint(ctxcatcodes,format(f_g_t_template, name, ta, name, ta))
+ if trace_define then
+ commands.writestatus("color","inherit global transparency '%s' with attribute: %s",name,ta)
+ end
+ context.colordeffgt(name,ta)
else
- texsprint(ctxcatcodes,format(f_l_t_template, name, ta, name, ta))
+ if trace_define then
+ commands.writestatus("color","inherit local transparency '%s' with attribute: %s",name,ta)
+ end
+ context.colordefflt(name,ta)
end
else
if global then
- texsprint(ctxcatcodes,format(r_g_t_template, name, name))
+ context.colordefrgt(name)
else
- texsprint(ctxcatcodes,format(r_l_t_template, name, name))
+ context.colordefrlt(name)
end
end
end
@@ -144,6 +151,9 @@ local function do_registerspotcolor(parent,name,parentnumber,e,f,d,p)
if v then
local kind = colors.default -- else problems with shading etc
if kind == 1 then kind = v[1] end
+ if e and e ~= "" then
+ registrations.spotcolorname(parent,e) -- before registration of the color
+ end
if kind == 2 then -- name noffractions names p's r g b
registrations.grayspotcolor(parent,f,d,p,v[2])
elseif kind == 3 then
@@ -151,9 +161,6 @@ local function do_registerspotcolor(parent,name,parentnumber,e,f,d,p)
elseif kind == 4 then
registrations.cmykspotcolor(parent,f,d,p,v[6],v[7],v[8],v[9])
end
- if e and e ~= "" then
- registrations.spotcolorname(parent,e)
- end
end
registered[parentnumber] = true
end
@@ -178,45 +185,64 @@ local function do_registermultitonecolor(parent,name,parentnumber,e,f,d,p) -- sa
end
function colors.definesimplegray(name,s)
- return colors.register(name,'gray',s) -- we still need to get rid of 'color'
+ return register_color(name,'gray',s) -- we still need to get rid of 'color'
end
function colors.defineprocesscolor(name,str,global,freeze) -- still inconsistent color vs transparent
- local r = match(str,"^#(.+)$") -- for old times sake (if we need to feed from xml or so)
- local t = (r and { h = r }) or settings_to_hash_strict(str)
- if t then
- if t.h then
- local r, g, b = match(t.h .. "000000","(..)(..)(..)") -- watch the 255
- definecolor(name, colors.register(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255 ), global)
- elseif t.r or t.g or t.b then
- definecolor(name, colors.register(name,'rgb', tonumber(t.r) or 0, tonumber(t.g) or 0, tonumber(t.b) or 0 ), global)
- elseif t.c or t.m or t.y or t.k then
- definecolor(name, colors.register(name,'cmyk',tonumber(t.c) or 0, tonumber(t.m) or 0, tonumber(t.y) or 0, tonumber(t.k) or 0), global)
+ local x = match(str,"^#(.+)$") -- for old times sake (if we need to feed from xml or so)
+ if x then
+ local r, g, b = match(x .. "000000","(..)(..)(..)") -- watch the 255
+ definecolor(name, register_color(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255), global)
+ else
+ local settings = settings_to_hash_strict(str)
+ if settings then
+ local r, g, b = settings.r, settings.g, settings.b
+ if r or g or b then
+ definecolor(name, register_color(name,'rgb', tonumber(r) or 0, tonumber(g) or 0, tonumber(b) or 0), global)
+ else
+ local c, m, y, k = settings.c, settings.m, settings.y, settings.k
+ if c or m or y or b then
+ definecolor(name, register_color(name,'cmyk',tonumber(c) or 0, tonumber(m) or 0, tonumber(y) or 0, tonumber(k) or 0), global)
+ else
+ local h, s, v = settings.h, settings.s, settings.v
+ if v then
+ r, g, b = colors.hsvtorgb(tonumber(h) or 0, tonumber(s) or 1, tonumber(v) or 1) -- maybe later native
+ definecolor(name, register_color(name,'rgb',r,g,b), global)
+ else
+ local x = settings.x or h
+ if x then
+ r, g, b = match(x .. "000000","(..)(..)(..)") -- watch the 255
+ definecolor(name, register_color(name,'rgb',(tonumber(r,16) or 0)/255,(tonumber(g,16) or 0)/255,(tonumber(b,16) or 0)/255), global)
+ else
+ definecolor(name, register_color(name,'gray',tonumber(s) or 0), global)
+ end
+ end
+ end
+ end
+ local a, t = settings.a, settings.t
+ if a and t then
+ definetransparent(name, transparencies.register(name,transparent[a] or tonumber(a) or 1,tonumber(t) or 1), global)
+ elseif colors.couple then
+ -- definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
+ definetransparent(name, 0, global) -- can be sped up
+ end
+ elseif freeze then
+ local ca = attributes_list[a_color] [str]
+ local ta = attributes_list[a_transparency][str]
+ if ca then
+ definecolor(name, ca, global)
+ end
+ if ta then
+ definetransparent(name, ta, global)
+ end
else
- definecolor(name, colors.register(name,'gray',tonumber(t.s) or 0), global)
- end
- if t.a and t.t then
- definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
- elseif colors.couple then
- -- definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
- definetransparent(name, 0, global) -- can be sped up
+ inheritcolor(name, str, global)
+ inherittransparent(name, str, global)
+ -- if global and str ~= "" then -- For Peter Rolf who wants access to the numbers in Lua. (Currently only global is supported.)
+ -- attributes_list[a_color] [name] = attributes_list[a_color] [str] or attributes.unsetvalue -- reset
+ -- attributes_list[a_transparency][name] = attributes_list[a_transparency][str] or attributes.unsetvalue
+ -- end
end
- elseif freeze then
- local ca = attributes.list[a_color] [str]
- local ta = attributes.list[a_transparency][str]
- if ca then
- definecolor(name, ca, global)
- end
- if ta then
- definetransparent(name, ta, global)
- end
- else
- inheritcolor(name, str, global)
- inherittransparent(name, str, global)
- -- if global and str ~= "" then -- For Peter Rolf who wants access to the numbers in Lua. (Currently only global is supported.)
- -- attributes.list[a_color] [name] = attributes.list[a_color] [str] or attributes.unsetvalue -- reset
- -- attributes.list[a_transparency][name] = attributes.list[a_transparency][str] or attributes.unsetvalue
- -- end
end
end
@@ -226,19 +252,20 @@ function colors.isblack(ca) -- maybe commands
end
function colors.definespotcolor(name,parent,str,global)
- if parent == "" or parent:find("=") then
+ if parent == "" or find(parent,"=") then
colors.registerspotcolor(name, parent)
elseif name ~= parent then
- local cp = attributes.list[a_color][parent]
+ local cp = attributes_list[a_color][parent]
if cp then
local t = settings_to_hash_strict(str)
if t then
- t.p = tonumber(t.p) or 1
- do_registerspotcolor(parent, name, cp, t.e, 1, "", t.p) -- p not really needed, only diagnostics
+ local tp = tonumber(t.p) or 1
+ do_registerspotcolor(parent, name, cp, t.e, 1, "", tp) -- p not really needed, only diagnostics
if name and name ~= "" then
- definecolor(name, colors.register(name,'spot', parent, 1, "", t.p), true)
- if t.a and t.t then
- definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
+ definecolor(name, register_color(name,'spot', parent, 1, "", tp), true)
+ local ta, tt = t.a, t.t
+ if ta and tt then
+ definetransparent(name, transparencies.register(name,transparent[ta] or tonumber(ta) or 1,tonumber(tt) or 1), global)
elseif colors.couple then
--~ definetransparent(name, transparencies.register(nil, 1, 1), global) -- can be sped up
definetransparent(name, 0, global) -- can be sped up
@@ -250,7 +277,7 @@ function colors.definespotcolor(name,parent,str,global)
end
function colors.registerspotcolor(parent, str)
- local cp = attributes.list[a_color][parent]
+ local cp = attributes_list[a_color][parent]
if cp then
local e = ""
if str then
@@ -275,11 +302,11 @@ function colors.definemultitonecolor(name,multispec,colorspec,selfspec)
dd, pp, nn = concat(dd,','), concat(pp,','), concat(nn,'_')
local parent = gsub(lower(nn),"[^%d%a%.]+","_")
colors.defineprocesscolor(parent,colorspec..","..selfspec,true,true)
- local cp = attributes.list[a_color][parent]
+ local cp = attributes_list[a_color][parent]
if cp then
do_registerspotcolor(parent, name, cp, "", nof, dd, pp)
do_registermultitonecolor(parent, name, cp, "", nof, dd, pp)
- definecolor(name, colors.register(name, 'spot', parent, nof, dd, pp), true)
+ definecolor(name, register_color(name, 'spot', parent, nof, dd, pp), true)
local t = settings_to_hash_strict(selfspec)
if t and t.a and t.t then
definetransparent(name, transparencies.register(name,transparent[t.a] or tonumber(t.a) or 1,tonumber(t.t) or 1), global)
@@ -350,7 +377,7 @@ function colors.formatgray(ca,separator)
return format("%0.3f",(cv and cv[2]) or 0)
end
-function colors.colorcomponents(ca)
+function colors.colorcomponents(ca) -- return list
local cv = colors.value(ca)
if cv then
local model = cv[1]
@@ -405,3 +432,49 @@ function colors.spotcolorvalue(ca,default)
end
return tostring(v)
end
+
+-- experiment (a bit of a hack, as we need to get the attribute number)
+
+local min = math.min
+
+-- a[b,c] -> b+a*(c-b)
+
+local function f(one,two,i,fraction)
+ local o, t = one[i], two[i]
+ local otf = o + fraction * (t - o)
+ if otf > 1 then
+ otf = 1
+ end
+ return otf
+end
+
+function colors.defineintermediatecolor(name,fraction,c_one,c_two,a_one,a_two,specs,global,freeze)
+ fraction = tonumber(fraction) or 1
+ local one, two = colors.value(c_one), colors.value(c_two)
+ if one and two then
+ local csone, cstwo = one[1], two[1]
+ if csone == cstwo then
+ -- actually we can set all 8 values at once here but this is cleaner as we avoid
+ -- problems with weighted gray conversions and work with original values
+ local ca
+ if csone == 2 then
+ ca = register_color(name,'gray',f(one,two,2,fraction))
+ elseif csone == 3 then
+ ca = register_color(name,'rgb',f(one,two,3,fraction),f(one,two,4,fraction),f(one,two,5,fraction))
+ elseif csone == 4 then
+ ca = register_color(name,'cmyk',f(one,two,6,fraction),f(one,two,7,fraction),f(one,two,8,fraction),f(one,two,9,fraction))
+ else
+ ca = register_color(name,'gray',f(one,two,2,fraction))
+ end
+ definecolor(name,ca,global,freeze)
+ end
+ end
+ local one, two = transparencies.value(a_one), transparencies.value(a_two)
+ local t = settings_to_hash_strict(specs)
+ local ta = tonumber((t and t.a) or (one and one[1]) or (two and two[1]))
+ local tt = tonumber((t and t.t) or (one and two and f(one,two,2,fraction)))
+ if ta and tt then
+--~ print(ta,tt)
+ definetransparent(name,transparencies.register(name,ta,tt),global)
+ end
+end
diff --git a/Master/texmf-dist/tex/context/base/colo-ini.mkiv b/Master/texmf-dist/tex/context/base/colo-ini.mkiv
index e7a84980578..1bceb5aa70a 100644
--- a/Master/texmf-dist/tex/context/base/colo-ini.mkiv
+++ b/Master/texmf-dist/tex/context/base/colo-ini.mkiv
@@ -59,6 +59,7 @@
\newif\ifSPOTsupported
\newif\ifpreferGRAY
\newif\ifGRAYprefered
+\newif\ifconvertGRAY \convertGRAYtrue
\newif\ifreduceCMYK
\newif\ifconverttoGRAY
\newif\ifweightGRAY \weightGRAYtrue
@@ -109,11 +110,11 @@
%D
%D \getbuffer \typebuffer
-\def\definecolor {\dodoubleargument\dodefinecolor}
-\def\defineglobalcolor {\dodoubleargument\dodefineglobalcolor}
-\def\definenamedcolor {\dodoubleargument\dodefinenamedcolor}
-\def\definespotcolor {\dotripleargument\dodefinespotcolor}
-\def\definemultitonecolor{\doquadrupleempty\dodefinemultitonecolor}
+\unexpanded\def\definecolor {\dodoubleargument\dodefinecolor}
+\unexpanded\def\defineglobalcolor {\dodoubleargument\dodefineglobalcolor}
+\unexpanded\def\definenamedcolor {\dodoubleargument\dodefinenamedcolor}
+\unexpanded\def\definespotcolor {\dotripleargument\dodefinespotcolor}
+\unexpanded\def\definemultitonecolor{\doquadrupleempty\dodefinemultitonecolor}
%D \macros
%D {startcolor,stopcolor,
@@ -143,15 +144,15 @@
\unexpanded\def\color [#1]{\groupedcommand{\doactivatecolor{#1}}{}}
\unexpanded\def\startcolor [#1]{\begingroup\doactivatecolor{#1}}
\unexpanded\def\stopcolor {\endgroup}
-\unexpanded\def\graycolor [#1]{\groupedcommand{\setcolormodel{gray}\getvalue{#1}}{}}
+\unexpanded\def\graycolor [#1]{\groupedcommand{\dosetcolormodel{gray}\getvalue{#1}}{}}
\unexpanded\def\colored [#1]{\groupedcommand{\definecolor[@colored@][#1]\doactivatecolor{@colored@}}{}}
\unexpanded\def\fastcolored [#1]#2{\begingroup\dodefinefastcolor[@colored@][#1]\doactivatecolor{@colored@}#2\endgroup}
\def\predefinecolor [#1]{\flushatshipout{\hbox{\color[#1]{}}}}
\def\predefineindexcolor[#1]{\flushatshipout{\hbox{\color[#1]{}}}}
- \def\startcolorpage {\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]}
- \def\stopcolorpage {\stopcolor}
- \def\startraster [#1]{\dosetrastercolor{#1}}
- \def\stopraster {}
+ \unexpanded\def\startcolorpage {\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]}
+ \unexpanded\def\stopcolorpage {\stopcolor}
+ \unexpanded\def\startraster [#1]{\dosetrastercolor{#1}}
+ \unexpanded\def\stopraster {}
\def\raster [#1]{\groupedcommand{\dosetrastercolor{#1}}{}}
\def\faststartcolor [#1]{\doactivatecolor{#1}}
\def\faststopcolor {}
@@ -159,11 +160,30 @@
\let\grey\graycolor
+%D Stacking:
+
+% \colormodelattribute \colorattribute \transparencyattribute
+
+\newcount\currentcolornesting
+
+\unexpanded\def\pushcolor[#1]%
+ {\global\advance\currentcolornesting\plusone
+ \expandafter\edef\csname\??cl:s:\number\currentcolornesting\endcsname
+ {\attribute\colormodelattribute \the\attribute\colormodelattribute
+ \attribute\colorattribute \the\attribute\colorattribute
+ \attribute\transparencyattribute\the\attribute\transparencyattribute
+ \space}% stack
+ \doactivatecolor{#1}}
+
+\unexpanded\def\popcolor
+ {\csname\??cl:s:\number\currentcolornesting\endcsname
+ \global\advance\currentcolornesting\minusone}
+
%D \macros
%D {startcurrentcolor,stopcurrentcolor}
-\def\startcurrentcolor{\startcolor[\outercolorname]}
-\def\stopcurrentcolor {\stopcolor}
+\unexpanded\def\startcurrentcolor{\startcolor[\outercolorname]}
+\unexpanded\def\stopcurrentcolor {\stopcolor}
%D \macros
%D {setupcolor}
@@ -188,7 +208,7 @@
\let\colorstyle\empty
-\def\setupcolor
+\unexpanded\def\setupcolor
{\dosingleargument\dosetupcolor}
\def\dosetupcolor[#1]%
@@ -213,7 +233,7 @@
%D
%D This command numbers to names:
-\def\definetransparency
+\unexpanded\def\definetransparency
{\dodoubleargument\dodefinetransparency}
\unexpanded\def\setupcolors
@@ -221,6 +241,8 @@
\let\showcolormessage\gobblethreearguments
+\newtoks\everysetupcolors
+
\def\dosetupcolors[#1]% some no longer make sense in MkIV
{\getparameters[\??cl][#1]%
\doifelse\@@clspot\v!yes
@@ -248,9 +270,12 @@
{\ifMPspotcolors \showcolormessage\m!colors {9}{\v!mp\v!spot}\MPspotcolorsfalse \fi}
{\ifMPspotcolors \else\showcolormessage\m!colors{10}{\v!mp\v!spot}\MPspotcolorstrue \fi}%
\preferGRAYfalse
+ \convertGRAYtrue
\processaction
[\@@clconversion]
[ \v!yes=>\preferGRAYtrue,
+ \v!no=>\convertGRAYfalse,
+ \v!never=>\convertGRAYfalse,
\v!always=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]%
\ifRGBsupported
\converttoGRAYfalse
@@ -273,7 +298,7 @@
{\incolorfalse\forcegrayMPcolorstrue}%
{\ifincolor\else\showcolormessage\m!colors1\colorstyle\fi\incolortrue\let\@@clstate\v!start}%
\dosetupcolormodel
- \initializemaintextcolor}
+ \the\everysetupcolors}
%D In this documentation we will not go into too much details
%D on palets. Curious users can find more information on this
@@ -340,7 +365,7 @@
%D This saves us some typing in for instance the modules that
%D deal with pretty verbatim typesetting.
-\def\definepalet
+\unexpanded\def\definepalet
{\dodoubleargument\dodefinepalet}
\def\dodefinepalet[#1][#2]%
@@ -383,7 +408,7 @@
\let\currentpalet\empty
-\def\setuppalet
+\unexpanded\def\setuppalet
{\dosingleempty\dosetuppalet}
\def\dosetuppalet[#1]%
@@ -447,7 +472,7 @@
%D defining each color separate, it also loads faster and takes
%D less bytes.
-\def\definecolorgroup
+\unexpanded\def\definecolorgroup
{\dotripleempty\dodefinecolorgroup}
\def\dododefinecolorgroupgray [#1][#2:#3]{\definecolor [#1:\the\colorcount][s=#2]}
@@ -689,32 +714,43 @@
\ifx\currentcolormodel\undefined \newcount\currentcolormodel \fi
-\def\setcolormodel#1%
- {\showcolormessage\m!colors1{#1}%
- \currentcolormodel\ctxlua{tex.print(colors.setmodel('#1',\ifweightGRAY true\else false\fi))}%
- \dosetattribute{colormodel}{\the\currentcolormodel}}
+% \def\setcolormodel#1%
+% {\showcolormessage\m!colors1{#1}%
+% \dosetcolormodel{#1}}
+
+\def\dosetcolormodel#1% no message
+ {\currentcolormodel\ctxlua{tex.print(colors.setmodel('#1',\ifweightGRAY true\else false\fi))}%
+ \attribute\colormodelattribute\currentcolormodel}
+
+\dosetcolormodel{all}
-\setcolormodel{all}
\def\dosetupcolormodel
{\ifincolor
\ifRGBsupported
\ifCMYKsupported
- \setcolormodel{all}%
+ \dosetcolormodel{all}%
\else
- \setcolormodel{rgb}%
+ \dosetcolormodel{rgb}%
\fi
\else
\ifCMYKsupported
- \setcolormodel{cmyk}%
+ \dosetcolormodel{cmyk}%
\else
- \setcolormodel{gray}%
+ \ifconvertGRAY
+ \dosetcolormodel{gray}%
+ \else
+ \dosetcolormodel{none}%
+ \fi
\fi
\fi
\else
- \setcolormodel{gray}%
- \fi
- }%\aftergroup\dosetupcolormodel}
+ \ifconvertGRAY
+ \dosetcolormodel{gray}%
+ \else
+ \dosetcolormodel{none}%
+ \fi
+ \fi}
\appendtoks
\dosetupcolormodel
@@ -749,7 +785,7 @@
\def\doactivatecolor
{\ifproductionrun
- \ctxlua{colors.enabled=true transparencies.enabled=true}% not that efficient but at least robust
+ \ctxlua{colors.enable() transparencies.enable()}% not that efficient but at least robust
\let\doactivatecolor\normaldoactivatecolor
\expandafter\doactivatecolor
\else
@@ -802,7 +838,7 @@
\ifx\@@rastervalue\empty
\let\@@rastervalue\@@rsscreen
\fi
- \dosetattribute\s!color{\ctxlua{tex.sprint(colors.definesimplegray("_raster_",\@@rastervalue))}}}
+ \attribute\colorattribute\ctxlua{tex.sprint(colors.definesimplegray("_raster_",\@@rastervalue))}\relax}
\def\dodefinefastcolor[#1][#2]% still not fast but ok
{\ctxlua{colors.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
@@ -874,19 +910,14 @@
\def\defaulttextcolor {black}
\def\@@themaintextcolor{themaintextcolor}
-\appendtoks\deactivatecolor\to\everybeforeoutput
-
-\def\startregistercolor[#1]% probably obsolete
- {\doifelsenothing{#1}
- {\let\stopregistercolor\relax}
- {\edef\stopregistercolor
- {\dosetattribute\s!color {\dogetattribute\s!color }%
- \dosetattribute\s!transparency{\dogetattribute\s!transparency}}%
- \doactivatecolor{#1}}}
+\appendtoks
+ \deactivatecolor
+ \ifx\maintextcolor\empty\else\doactivatecolor\maintextcolor\fi
+\to \everybeforeoutput
\def\registermaintextcolor{\ctxlua{colors.main = \thecolorattribute\maintextcolor}}
-\def\starttextcolor[#1]%
+\unexpanded\def\starttextcolor[#1]%
{\doifsomething{#1}
{\definecolor[\@@themaintextcolor][#1]%
\let\maintextcolor\@@themaintextcolor
@@ -904,6 +935,7 @@
\registermaintextcolor}
\appendtoks \initializemaintextcolor \to \everyjob
+\appendtoks \initializemaintextcolor \to \everysetupcolors
\def\dodefinepaletcolor#1#2#3%
{\doifassignmentelse{#3}% \definepalet[test][xx={y=.4}]
@@ -927,6 +959,23 @@
\def\doinheritta#1{\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname}
\def\doinheritts#1{\csname(ts:\ifcsname(ts:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ts:#1)\endcsname#1\fi\fi)\endcsname}
+%D Low level defs:
+
+\def\colordefalc#1#2{\setevalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }}
+\def\colordefagc#1#2{\setxvalue{(ca:#1)}{#2}\setvalue {(cs:#1)}{\attribute\colorattribute #2 }}
+\def\colordefalt#1#2{\setevalue{(ta:#1)}{#2}\setvalue {(ts:#1)}{\attribute\transparencyattribute#2 }}
+\def\colordefagt#1#2{\setxvalue{(ta:#1)}{#2}\setgvalue{(ts:#1)}{\attribute\transparencyattribute#2 }}
+
+\def\colordefflc#1#2{\setvalue {(ca:#1)}{\doinheritca{#2}}\setvalue {(cs:#1)}{\doinheritcs{#2}}}
+\def\colordeffgc#1#2{\setgvalue{(ca:#1)}{\doinheritca{#2}}\setvalue {(cs:#1)}{\doinheritcs{#2}}}
+\def\colordefflt#1#2{\setvalue {(ta:#1)}{\doinheritta{#2}}\setvalue {(ts:#1)}{\doinheritts{#2}}}
+\def\colordeffgt#1#2{\setgvalue{(ta:#1)}{\doinheritta{#2}}\setgvalue{(ts:#1)}{\doinheritts{#2}}}
+
+\def\colordefrlc #1{\localundefine {(ca:#1)}\localundefine {(cs:#1)}}
+\def\colordefrgc #1{\globalundefine{(ca:#1)}\globalundefine{(cs:#1)}}
+\def\colordefrlt #1{\localundefine {(ta:#1)}\localundefine {(ts:#1)}}
+\def\colordefrgt #1{\globalundefine{(ta:#1)}\globalundefine{(ts:#1)}}
+
%D \macros
%D {colorvalue, grayvalue}
%D
diff --git a/Master/texmf-dist/tex/context/base/colo-new.mkii b/Master/texmf-dist/tex/context/base/colo-new.mkii
deleted file mode 100644
index 5413d7a1208..00000000000
--- a/Master/texmf-dist/tex/context/base/colo-new.mkii
+++ /dev/null
@@ -1,1857 +0,0 @@
-%D \module
-%D [ file=colo-ini,
-%D version=1997.04.01,
-%D title=\CONTEXT\ Color Macros,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-\chardef\colorversion=1
-
-%D Color support is not present in \TEX. Colorful output can
-%D however be accomplished by using specials. This also means
-%D that this support depends on the \DVI\ driver used. At the
-%D moment this module was written, still no decent standard on
-%D color specials has been agreed upon. We therefore decided to
-%D implement a mechanism that is as independant as possible of
-%D drivers.
-%D
-%D Color support shares with fonts that is must be implemented
-%D in a way that permits processing of individual \DVI\ pages.
-%D Furthermore it should honour grouping. The first condition
-%D forces us to use a scheme that keeps track of colors at
-%D page boundaries. This can be done by means of \TEX's
-%D marking mechanism (\type{\mark}).
-%D
-%D When building pages, \TEX\ periodically looks at the
-%D accumulated typeset contents and breaks the page when
-%D suitable. At that moment, control is transfered to the
-%D output routine. This routine takes care of building the
-%D pagebody and for instance adds headers and footers. The page
-%D can be broken in the middle of some colored text, but
-%D headers and footers are often in black upon white or
-%D background. If colors are applied there, they definitely
-%D are used local, which means that they don't cross page
-%D borders.
-%D
-%D Boxes are handled as a whole, which means that when we
-%D apply colors inside a box, those colors don't cross page
-%D boundaries, unless of course boxes are split or unboxed.
-%D Especially in interactive texts, colors are often used in
-%D such a local way: in boxes (buttons and navigational tools)
-%D or in the pagebody (backgrounds).
-%D
-%D So we can distinguish local colors, that don't cross
-%D pages from global colors, of which we can end many pages
-%D later. The color macros will treat both types in a different
-%D way, thus gaining some speed.
-%D
-%D This module also deals with gray scales. Because similar
-%D colors can end up in the same gray scale when printed in
-%D black and white, we also implement a palet system that deals
-%D with these matters. Because of fundamental differences
-%D between color and gray scale printing, in \CONTEXT\ we also
-%D differ between these. For historic reasons |<|we first
-%D implemented gray scales using patterns of tiny periods|>|
-%D and therefore called them {\em rasters}. So don't be
-%D surprised if this term shows up.
-
-%D \macros
-%D {definecolor}
-%D
-%D We will enable users to specify colors in \cap{RGB} and
-%D \cap{CMYK} color spaces or gray scales using
-%D
-%D \showsetup{definecolor}
-%D
-%D For example:
-%D
-%D \starttyping
-%D \definecolor [SomeKindOfRed] [r=.8,g=.05,b=.05]
-%D \stoptyping
-%D
-%D Such color specifications are saved in a macro in the
-%D following way:
-%D
-%D \starttyping
-%D \setvalue{\??cr name}{R:r:g:b}
-%D \setvalue{\??cr name}{C:c:m:y:k}
-%D \setvalue{\??cr name}{S:s}
-%D \stoptyping
-%D
-%D Gray scales are specified with the \type{s} parameter,
-%D where the \type {s} is derived from {\em screen}.
-%D
-%D Starting with \PDF\ 1.4 (2001) \CONTEXT\ supports
-%D transparent colors. The transparency factor is represented
-%D by a \type {t} and the transparency method by an \type {a}
-%D (alternative). Later we will implement more control
-%D (probably by symbolic methods. So, currently the data is
-%D stored as follows:
-%D
-%D \starttyping
-%D \setvalue{\??cr name}{R:r:g:b:a:t}
-%D \setvalue{\??cr name}{C:c:m:y:k:a:t}
-%D \setvalue{\??cr name}{S:s:a:t}
-%D \stoptyping
-
-% r g b : rbg
-% c m y k : cmyk
-% s : gray
-% p n d f : spot
-% h : hexadecimal
-% t a : transparency
-% e : equivalent (spotcolors)
-
-\def\@@cl@@z{0}
-\def\@@cl@@o{1}
-
-\def\@@resetcolorparameters
- {\let\@@cl@@r\@@cl@@z \let\@@cl@@g\@@cl@@z \let\@@cl@@b\@@cl@@z
- \let\@@cl@@c\@@cl@@z \let\@@cl@@m\@@cl@@z \let\@@cl@@y\@@cl@@z \let\@@cl@@k\@@cl@@z
- \let\@@cl@@s\@@cl@@z
- \let\@@cl@@p\@@cl@@o \let\@@cl@@n\empty \let\@@cl@@d\empty \let\@@cl@@f\@@cl@@o
- \let\@@cl@@h\empty
- \let\@@cl@@e\empty
- \let\@@cl@@t\@@cl@@z \let\@@cl@@a\@@cl@@z}
-
-\@@resetcolorparameters
-
-\def\@@cl@@A{\@@cl@@a} % a hook for symbolic conversion, see below
-
-%D Handling a few nested \type{\cs}'s is no problem (\type
-%D {\@EA\@EAEAEA\@EA}) but we need a full expansion, so I
-%D tried one of the fully expandable primitives using a sort
-%D of delimited thing. I tried \type {\number} first, but this
-%D does not work, but \type {\romannumeral} does. Actually,
-%D \type{\romannumeral0} returns nothing, so it's a perfect
-%D candidate for this kind of hackery. This reminds me that I
-%D have to look into David Kastrup's Euro\TeX\ 2002 article
-%D because he is using \type {\romannumeral} for loops
-%D (repetitive \quote {m} stuff).
-
-% \def\x{\y}\def\y{\z}\def\z{0:1:1:1}
-%
-% \def\bla #1:#2:#3\end{}
-%
-% \@EA\bla\romannumeral\x\end
-
-\def\colorXpattern{0S:\@@cl@@z:\@@cl@@z:\@@cl@@z}
-\def\colorZpattern{0S:\@@cl@@z:\@@cl@@A:\@@cl@@t}
-\def\colorSpattern{0S:\@@cl@@s:\@@cl@@A:\@@cl@@t}
-\def\colorCpattern{0C:\@@cl@@c:\@@cl@@m:\@@cl@@y:\@@cl@@k:\@@cl@@A:\@@cl@@t}
-\def\colorRpattern{0R:\@@cl@@r:\@@cl@@g:\@@cl@@b:\@@cl@@A:\@@cl@@t}
-
-%def\colorPpattern{0P:\@@cl@@n:\@@cl@@p:\@@cl@@A:\@@cl@@t}
-
-\def\colorPpattern{0P:\@@cl@@n:\@@cl@@f:\@@cl@@d:\@@cl@@p:\@@cl@@A:\@@cl@@t}
-
-%D The extra 0 catches empty colors specs (needed for the
-%D \type {\MPcolor} and \type {\PDFcolor} conversion (\type
-%D {\@@cr} equals \type {\relax}!).
-
-\def\handlecolorwith#1{\@EA#1\romannumeral0}
-
-%D Next comes the main definition macro.
-
-\def\dodefinecolor {\dododefinecolor\relax \setvalue \setevalue1}
-\def\dodefineglobalcolor{\dododefinecolor\doglobal\setgvalue\setxvalue1}
-\def\dodefinenamedcolor {\dododefinecolor\doglobal\setvalue \setevalue0}
-
-\def\dododefinecolor#1#2#3#4[#5][#6]% #2==set(g)value #3==set[e|x]value
- {#1\addtocommalist{#5}\colorlist % optional
- \doifassignmentelse{#6}
- {\@@resetcolorparameters
- \getparameters[\??cl @@][#6]%
- \ifx\@@cl@@h\empty
- \doifelse{\@@cl@@r\@@cl@@g\@@cl@@b}{\@@cl@@z\@@cl@@z\@@cl@@z}
- {\doifelse{\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k}{\@@cl@@z\@@cl@@z\@@cl@@z\@@cl@@z}
- {\doifelse\@@cl@@s\@@cl@@z
- {\showmessage\m!colors8{{[#6]},#5}%
- #3{\??cr#5}{\colorZpattern}}
- {#3{\??cr#5}{\colorSpattern}}}
- {#3{\??cr#5}{\colorCpattern}}}
- {#3{\??cr#5}{\colorRpattern}}%
- \else
- \setxvalue{\??cr#5}{\colorHpattern}%
- \fi
- % new: e=external spot color name
- \ifx\@@cl@@e\empty \else
- \doregisterspotcolorname{#5}\@@cl@@e
- \fi}
- {\doifelsenothing\currentpalet
- \donefalse
- {\doifdefinedelse{\??cr\currentpalet#6}\donetrue\donefalse}%
- \ifdone
- \doifnot{#5}{#6}
- {#2{\??cr#5}{\paletcolorspec{#6}}}%
- \else
- \doifdefinedelse{\??cr#6}
- {\doifelse{#5}{#6}
- {% this way we can freeze \definecolor[somecolor][somecolor]
- % and still prevent cyclic definitions
- \iffreezecolors#3{\??cr#5}{\csname\??cr#6\endcsname}\fi}
- {\iffreezecolors\@EA#3\else\@EA#2\fi{\??cr#5}{\csname\??cr#6\endcsname}}}
- {\showmessage\m!colors3{#5 (def)}}%
- \fi}%
- \ifcase#4\or
- \unexpanded#2{#5}{\switchtocolor[#5]}% \unexpanded toegevoegd
- \fi}
-
-\def\paletcolorspec#1%
- {\csname\??cr\currentpalet#1\endcsname}
-
-%D Hex color support is not enabled by default. You need to say \type
-%D {\setupcolor [hex]} to get this working.
-
-\ifx\colorHpattern\undefined \let\colorHpattern\colorZpattern \fi
-
-%D New and experimental.
-
-\def\dodefinespotcolor[#1][#2][#3]% todo: always global
- {\doifnot{#1}{#2}
- {\@@resetcolorparameters
- \doglobal\addtocommalist{#1}\colorlist % optional
- \edef\@@cl@@n{#2}%
- \getparameters[\??cl @@][#3]%
- \doifnothing\@@cl@@p{\let\@@cl@@p\!!plusone}%
- \ifx\@@cl@@e\empty \else
- \doregisterspotcolorname{#2}\@@cl@@e
- \fi
- \doglobal\addtocommalist{#2}\allspotcolors
- \setxvalue{\??cr#1}{\colorPpattern}% was \setevalue
- \setgvalue{#1}{\switchtocolor[#1]}}} % was \setvalue
-
-\def\registerusedspotcolors
- {\ifx\allspotcolors\empty \else
- \bgroup
- \let\usedspotcolors\empty
- \def\docommand##1%
- {\doifdefined{\??cs##1}{\addtocommalist{##1}\usedspotcolors}}%
- \processcommacommand[\allspotcolors]\docommand
- \savecurrentvalue\usedspotcolors\usedspotcolors
- \egroup
- \fi}
-
-\def\registerusedcolorchannels
- {\bgroup
- \doifdefinedelse{\??cs c}
- {\def\usedcolorchannels{c,m,y,k}}%
- {\let\usedcolorchannels\empty}%
- \doifdefined{\??cs r}
- {\addtocommalist{r,g,b}\usedcolorchannels}%
- \doifdefined{\??cs s}
- {\ExpandBothAfter\doifnotinset{k}\usedcolorchannels
- {\addtocommalist{s}\usedcolorchannels}}%
- \savecurrentvalue\usedcolorchannels\usedcolorchannels
- \egroup}
-
-\prependtoks
- \registerusedspotcolors
- \registerusedcolorchannels
-\to \everylastshipout
-
-\def\registerusedspotcolor#1%
- {\global\@EA\chardef\csname\??cs#1\endcsname\zerocount}
-
-%D On top of spotcolors, we define multitone colors. You'd better know
-%D what you're doing because invalid definitions will lead to invalid
-%D documents (i.e.\ resources).
-
-% \definecolor [darkblue] [c=.5,m=.5]
-% \definecolor [darkyellow] [y=.5]
-%
-% \definemultitonecolor [whatever] [darkblue=.5,darkyellow=.5] [c=.25,m=.25,y=.25] [a=1,t=.5]
-% \definemultitonecolor [another] [darkblue=.5,darkyellow=.5] [c=.25,m=.25,y=.25]
-
-\def\dodefinemultitonecolor[#1][#2][#3][#4]%
- {\let\@@cl@@cl@@D\empty % n's
- \let\@@cl@@cl@@P\empty % p's
- \let\@@cl@@cl@@N\empty % name
- \scratchcounter\zerocount
- \processcommacommand[#2]\dododefinemultitonecolor
- \bgroup
- \lccode`\.=`\_%
- \lccode`\,=`\_%
- \lccode`\:=`\_%
- \lccode`\;=`\_%
- \lccode`\+=`\_%
- \lccode`\-=`\_%
- \lccode`\*=`\_%
- \lccode`\/=`\_%
-% \lccode`\_=`\_%
- % not needed, other attribute in driver:
- %
- % \@@resetcolorparameters
- % \getparameters[#4]%
- % \ifx\@@cl@@t\@@cl@@z\else
- % \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\@@cl@@t_\@@cl@@a}%
- % \fi
- \lowercase\@EA{\@EA\xdef\@EA\@@cleancolor\@EA{\@@cl@@cl@@N}}%
- \egroup
- \setxvalue{\??cl\@@cleancolor\s!check}{\noexpand\docheckmultitonecolor{\@@cl@@cl@@D}}%
- \expanded{\defineglobalcolor[\@@cleancolor][#3,#4]}%
- \expanded{\definespotcolor[#1][\@@cleancolor][#4,f=\the\scratchcounter,p={\@@cl@@cl@@P},d={\@@cl@@cl@@D}]}}
-
-\def\docheckmultitonecolor#1%
- {\flushatshipout
- {\let\checkmultitonecolor\gobbleoneargument
- \def\docommand##1{\hbox{\definecolor[\s!dummy-100][##1][p=1]\color[\s!dummy-100]}}%
- \processcommalist[#1]\docommand}}
-
-\def\checkmultitonecolor#1%
- {\csname\??cl#1\s!check\endcsname\letgvalue{\??cl#1\s!check}\relax}
-
-\def\dodefinespotcolor[#1][#2][#3]% todo: always global (REDEFINED)
- {\doifnot{#1}{#2}
- {\@@resetcolorparameters
- \doglobal\addtocommalist{#1}\colorlist % optional
- \edef\@@cl@@n{#2}%
- \getparameters[\??cl @@][#3]%
- \doifnothing \@@cl@@p{\let\@@cl@@p\!!plusone}%
- \doifsomething\@@cl@@e{\doregisterspotcolorname{#2}\@@cl@@e}%
- \doglobal\addtocommalist{#2}\allspotcolors
- \setxvalue{\??cr#1}{\colorPpattern}% was \setevalue
- \setgvalue{#1}{\switchtocolor[#1]}}}% was \setvalue
-
-\def\dododefinemultitonecolor#1%
- {\advance\scratchcounter\plusone
- \splitstring#1\at=\to\!!stringa\and\!!stringb
- \ifx\@@cl@@cl@@D\empty
- \let\@@cl@@cl@@D\!!stringa
- \let\@@cl@@cl@@P\!!stringb
- \normalizecolor\!!stringb
- \edef\@@cl@@cl@@N{\!!stringa_\!!stringb}%
- \else
- \edef\@@cl@@cl@@D{\@@cl@@cl@@D,\!!stringa}%
- \edef\@@cl@@cl@@P{\@@cl@@cl@@P,\!!stringb}%
- \normalizecolor\!!stringb
- \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\!!stringa_\!!stringb}%
- \fi}
-
-% \def\dododefinemultitonecolor#1% a/b safe
-% {\advance\scratchcounter\plusone
-% \splitstring#1\at=\to\@@cl@@one\and\@@cl@@two
-% \ifx\@@cl@@cl@@D\empty
-% \let\@@cl@@cl@@D\@@cl@@one
-% \let\@@cl@@cl@@P\@@cl@@two
-% \normalizecolor\@@cl@@two
-% \edef\@@cl@@cl@@N{\@@cl@@one_\@@cl@@two}%
-% \else
-% \edef\@@cl@@cl@@D{\@@cl@@cl@@D,\@@cl@@one}%
-% \edef\@@cl@@cl@@P{\@@cl@@cl@@P,\@@cl@@two}%
-% \normalizecolor\@@cl@@two
-% \edef\@@cl@@cl@@N{\@@cl@@cl@@N_\@@cl@@one_\@@cl@@two}%
-% \fi}
-
-%D The names of colors are stored in a comma separated list
-%D only for the purpose of showing them with \type {\showcolor}.
-%D
-%D \startbuffer
-%D \definecolor [SomeKindOfRed] [r=.8,g=.05,b=.05]
-%D \stopbuffer
-%D
-%D \typebuffer
-%D \getbuffer
-%D
-%D This color shows up as \color [SomeKindOfRed] {some kind
-%D of red}.
-%D
-%D \starttyping
-%D \setupcolors[state=start]
-%D
-%D \definecolor[mygreen][green]
-%D \definecolor[green][g=.5]
-%D
-%D \startcolor[mygreen]test\stopcolor
-%D
-%D \setupcolors[expansion=no]
-%D
-%D \definecolor[mygreen][green]
-%D \definecolor[green][g=.5]
-%D
-%D \startcolor[mygreen]test\stopcolor
-%D \stoptyping
-
-%D \macros
-%D {startcolormode,stopcolormode,permitcolormode}
-%D
-%D We use \type{\stopcolormode} to reset the color in
-%D whatever color space and do so by calling the corresponding
-%D special. Both commands can be used for fast color
-%D switching, like in colored verbatim,
-
-\newif\ifpermitcolormode \permitcolormodetrue
-
-\def\dowithcolor#1#2% #1=\action #2=color
- {\ifincolor\ifpermitcolormode
- \ifcsname\??cr\currentpalet#2\endcsname
- \handlecolorwith#1\csname\??cr\currentpalet#2\endcsname\od
- \else\ifcsname\??cr#2\endcsname
- \handlecolorwith#1\csname\??cr#2\endcsname\od
- \fi\fi
- \fi\fi}
-
-\def\startcolormode % includes \ifincolor\ifpermitcolormode
- {%\dostoptransparency % needed for: {test \trans test \notrans test}
- \conditionalstoptransparency
- \dowithcolor\execcolorRCSP}
-
-\def\stopcolormode
- {\ifincolor\ifpermitcolormode
- \supportedstoptransparency
- \dostopcolormode
- \fi\fi}
-
-\def\restorecolormode
- {\ifincolor\ifpermitcolormode
- \supportedstoptransparency
- \dostopcolormode
- \ifx\maintextcolor\empty \else
- \startcolormode\maintextcolor
- \fi
- \fi\fi}
-
-%D Color modes are entered using the next set of commands.
-%D The \type{\stop} alternatives are implemented in a way
-%D that permits non||grouped use.
-%D
-%D The, for this module redundant, check if we are in color
-%D mode is needed when we use these macros in other modules.
-
-\def\execcolorRCSP#1:%
- {\csname execcolor#1\endcsname}
-
-\def\execcolorR
- {\iffilterspotcolor
- \@EA\noexeccolorR
- \else
- \@EA\doexeccolorR
- \fi}
-
-\def\execcolorC
- {\iffilterspotcolor
- \@EA\noexeccolorC
- \else
- \@EA\doexeccolorC
- \fi}
-
-\def\execcolorS
- {\iffilterspotcolor
- \@EA\noexeccolorS
- \else
- \@EA\doexeccolorS
- \fi}
-
-\def\execcolorP
- {\iffilterspotcolor
- \@EA\doexeccolorPP
- \else\ifcase\currentcolorchannel
- \@EAEAEA\doexeccolorP
- \else
- \@EAEAEA\noexeccolorP
- \fi\fi}
-
-\def\doexeccolorR#1:#2:#3:%
- {\edef\@@cl@@r{#1}\edef\@@cl@@g{#2}\edef\@@cl@@b{#3}%
- \ifpreferGRAY\ifx\@@cl@@r\@@cr@@g\ifx\@@cl@@r\@@cl@@b
- \GRAYpreferedtrue
- \fi\fi\fi
- \ifincolor\else\RGBsupportedfalse\CMYKsupportedfalse\fi
- \ifGRAYprefered
- \registercolorchannel\c!s
- \let\@@cl@@s\@@cl@@r
- \normalizeGRAY
- \doexeccolorgray
- \else\ifRGBsupported
- \registercolorchannel\c!r
- \normalizeRGB
- \doexeccolorrgb
- \else\ifCMYKsupported
- \registercolorchannel\c!c
- \convertRGBtoCMYK\@@cl@@r\@@cl@@g\@@cl@@b
- \normalizeCMYK
- \doexeccolorcmyk
- \else
- \registercolorchannel\c!s
- \convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b
- \normalizeGRAY
- \doexeccolorgray
- \fi\fi\fi
- \exectransparency}
-
-\def\doexeccolorC#1:#2:#3:#4:%
- {\edef\@@cl@@c{#1}\edef\@@cl@@m{#2}\edef\@@cl@@y{#3}\edef\@@cl@@k{#4}%
- \ifpreferGRAY\ifx\@@cl@@k\@@cl@@z\ifx\@@cl@@c\@@cr@@m\ifx\@@cl@@c\@@cl@@y
- \GRAYpreferedtrue
- \fi\fi\fi\fi
- \ifincolor\else\RGBsupportedfalse\CMYKsupportedfalse\fi
- \ifGRAYprefered
- \registercolorchannel\c!s
- \let\@@cl@@s\@@cl@@c
- \normalizeGRAY
- \doexeccolorgray
- \else\ifCMYKsupported
- \registercolorchannel\c!c
- \ifreduceCMYK
- \convertCMYKtoCMY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \fi
- \normalizeCMYK
- \doexeccolorcmyk
- \else\ifRGBsupported
- \registercolorchannel\c!r
- \convertCMYKtoRGB\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \normalizeRGB
- \doexeccolorrgb
- \else
- \registercolorchannel\c!s
- \convertCMYKtoGRAY\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \normalizeGRAY
- \doexeccolorgray
- \fi\fi\fi
- \exectransparency}
-
-\def\doexeccolorS#1:%
- {\edef\@@cl@@s{#1}%
- \registercolorchannel\c!s
- \normalizeGRAY
- \doexeccolorgray
- \exectransparency}
-
-% \def\doexeccolorP#1:#2:%
-% {\edef\@@cl@@n{#1}%
-% \edef\@@cl@@p{#2}%
-% \registerusedspotcolor\@@cl@@n
-% \ifSPOTsupported
-% \dowithcolor\registerspotcolor\@@cl@@n
-% \dostartspotcolormode\@@cl@@n\@@cl@@p
-% \else
-% \doingspotcolortrue
-% \let\spotcolorfactor\@@cl@@p
-% \factorizecolortrue % using counter and array
-% \dowithcolor\execcolorRCSP\@@cl@@n
-% \factorizecolorfalse
-% \let\spotcolorfactor\@@cl@@o
-% \doingspotcolorfalse
-% \fi
-% \exectransparency}
-
-\def\doexeccolorP#1:#2:#3:#4:%
- {\edef\@@cl@@n{#1}% name
- \edef\@@cl@@f{#2}% fractions
- \edef\@@cl@@d{#3}% definitions
- \edef\@@cl@@p{#4}%
- \ifx\@@cl@@d\empty
- \let\@@cl@@d\@@cl@@n
- \fi
- \registerusedspotcolor\@@cl@@n
- \ifSPOTsupported
- \checkmultitonecolor\@@cl@@n
- \dowithcolor\registerspotcolor\@@cl@@n
- \dostartspotcolormode\@@cl@@n\@@cl@@p
- \else
- \doingspotcolortrue
- \normalizespotcolor\@@cl@@p
- \let\spotcolorfactor\@@cl@@p
- \factorizecolortrue % using counter and array
- \dowithcolor\execcolorRCSP\@@cl@@n
- \factorizecolorfalse
- \let\spotcolorfactor\@@cl@@o
- \doingspotcolorfalse
- \fi
- \exectransparency}
-
-\def\doexeccolorPindex#1:#2:#3:#4:%
- {\edef\@@cl@@n{#1}%
- \edef\@@cl@@f{#2}%
- \edef\@@cl@@d{#3}%
- \edef\@@cl@@p{#4}%
- \ifx\@@cl@@d\empty
- \let\@@cl@@d\@@cl@@n
- \fi
- \ifSPOTsupported
- \checkmultitonecolor\@@cl@@n
- \dowithcolor\registerindexcolor\@@cl@@n
- \fi
- \noexectransparency}
-
-\def\doexeccolorPP#1:#2:%
- {\edef\@@cl@@n{#1}%
- \edef\@@cl@@p{#2}%
- \registerusedspotcolor\@@cl@@n
- \ifx\@@cl@@n\currentspotcolor
- \normalizeSPOT
- \dostartgraycolormode\@@cl@@p % was spotcolormode
- \else
- \dovidecolor\@@cl@@p\@@cl@@o
- \fi
- \exectransparency}
-
-\def\doexeccolorrgb
- {\ifcase\currentcolorchannel
- \dostartrgbcolormode\@@cl@@r\@@cl@@g\@@cl@@b
- \or \or \or \or
- \or \dostartgraycolormode\@@cl@@r
- \or \dostartgraycolormode\@@cl@@g
- \or \dostartgraycolormode\@@cl@@b
- \fi}
-
-\def\doexeccolorcmyk
- {\ifcase\currentcolorchannel
- \dostartcmykcolormode\@@cl@@c\@@cl@@m\@@cl@@y\@@cl@@k
- \or \negatecolorcomponent\@@cl@@c\dostartgraycolormode\@@cl@@c
- \or \negatecolorcomponent\@@cl@@m\dostartgraycolormode\@@cl@@m
- \or \negatecolorcomponent\@@cl@@y\dostartgraycolormode\@@cl@@y
- \or \negatecolorcomponent\@@cl@@k\dostartgraycolormode\@@cl@@k
- \fi}
-
-\def\doexeccolorgray
- {\ifcase\currentcolorchannel
- \dostartgraycolormode\@@cl@@s
- \or \or \or
- \or \dostartgraycolormode\@@cl@@s
- \or \or \or
- \or \dostartgraycolormode\@@cl@@s
- \fi}
-
-%D When filtering colors, we need to either erase
-%D the background, or ignore the foreground.
-
-% \newif\ifhidesplitcolor \hidesplitcolortrue
-%
-% \def\noexeccolor#1\od
-% {\dostartgraycolormode\@@cl@@o}
-%
-% \let\noexeccolorS\noexeccolor
-% \let\noexeccolorP\noexeccolor
-
-%D Well, here comes some real trickery. When we have the 100\%
-%D spot color or black color, we don't want to erase the
-%D background. So, instead we hide the content by giving it
-%D zero transparency.
-
-% todo : #1#2#3 met #2 > of < and #3 een threshold
-
-\def\dohidecolor#1#2%
- {\ifhidesplitcolor
- \ifx#1#2%
- \dostartgraycolormode\@@cl@@o
- \else
- \doregisternonecolor
- \dostartnonecolormode
- \fi
- \else
- \dostartgraycolormode\@@cl@@o
- \fi}
-
-\def\dovidecolor#1#2%
- {\ifhidesplitcolor
- \ifx#1#2%
- \doregisternonecolor
- \dostartnonecolormode
- \else
- \dostartgraycolormode\@@cl@@o
- \fi
- \else
- \dostartgraycolormode\@@cl@@o
- \fi}
-
-% \def\fullytransparentcolor % fails on floats
-% {\dostartgraycolormode\@@cl@@o % better than z
-% %\global\@EA\chardef\csname\@@currenttransparent\endcsname\plusone
-% %\global\intransparenttrue
-% \dostarttransparency10}
-
-\def\noexeccolorR#1:#2:#3:#4\od
- {\edef\@@cl@@r{#1}\edef\@@cl@@g{#2}\edef\@@cl@@b{#3}%
- \dohidecolor\@@cl@@s\@@cl@@o}
-
-\def\noexeccolorC#1:#2:#3:#4:#5\od
- {\edef\@@cl@@c{#1}\edef\@@cl@@m{#2}\edef\@@cl@@y{#3}\edef\@@cl@@k{#4}%
- \dohidecolor\@@cl@@s\@@cl@@o}
-
-\def\noexeccolorS#1:#2\od
- {\edef\@@cl@@s{#1}%
- \dohidecolor\@@cl@@s\@@cl@@o}
-
-\def\noexeccolorP#1:#2:#3:#4:#5\od
- {\edef\@@cl@@p{#4}%
- \dohidecolor\@@cl@@p\@@cl@@z}
-
-%D For the sake of postprocessing (i.e.\ color separation)
-%D we can normalize colors, which comes down to giving equal
-%D values an equal accuracy and format. This feature is
-%D turned off by default due to a speed penalty. This macro
-%D also handles spot color percentages.
-
-\newif\iffactorizecolor
-\newif\ifnormalizecolor
-
-\def\spotcolorfactor{1}
-
-% \def\normalizecolor#1%
-% {\colordimen#1\thousandpoint
-% \colordimen\spotcolorfactor\colordimen
-% \colorcount\colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \edef#1{\realcolorvalue\colorcount}}
-
-\def\normalizecolor#1%
- {\colorcount\numexpr(\dimexpr\spotcolorfactor\dimexpr#1\thousandpoint\relax\relax+\medcard)/\maxcard\relax
- \edef#1{\realcolorvalue\colorcount}}
-
-% \def\normalizespotcolor#1%
-% {\colordimen-#1\thousandpoint
-% \advance\colordimen\thousandpoint
-% \colorcount\colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \edef#1{\realcolorvalue\colorcount}}
-
-\def\normalizespotcolor#1%
- {\colorcount\numexpr(\dimexpr\thousandpoint-#1\thousandpoint\relax+\medcard)/\maxcard\relax
- \edef#1{\realcolorvalue\colorcount}}
-
-\def\donormalizeRGB
- {\normalizecolor\@@cl@@r
- \normalizecolor\@@cl@@g
- \normalizecolor\@@cl@@b}
-
-\def\normalizeRGB
- {\ifnormalizecolor
- \donormalizeRGB
- \else\iffactorizecolor
- \donormalizeRGB
- \fi\fi}
-
-\def\donormalizeCMYK
- {\normalizecolor\@@cl@@c
- \normalizecolor\@@cl@@m
- \normalizecolor\@@cl@@y
- \normalizecolor\@@cl@@k}
-
-\def\normalizeCMYK
- {\ifnormalizecolor
- \donormalizeCMYK
- \else\iffactorizecolor
- \donormalizeCMYK
- \fi\fi}
-
-\def\donormalizeGRAY
- {\normalizecolor\@@cl@@s}
-
-\def\normalizeGRAY
- {\ifnormalizecolor
- \donormalizeGRAY
- \else\iffactorizecolor
- \donormalizeGRAY
- \fi\fi}
-
-\def\normalizeSPOT
- {\normalizespotcolor\@@cl@@p}
-
-%D We need to register spot colors (i.e.\ resources need to
-%D be created.
-
-\def\registerspotcolor#1:%
- {\ifcsname\??cl:\c!p:\@@cl@@n\endcsname
- \@EA\dontregisterspotcolor
- \else
- \letgvalue{\??cl:\c!p:\@@cl@@n}\empty
- %\@EA\@EA\csname registerspotcolor#1\endcsname
- \csname registerspotcolor#1\@EA\endcsname
- \fi}
-
-% todo: convert to rgb if needed, will will do this in mkiv
-
-\def\dontregisterspotcolor #1\od{}
-\def\registerspotcolorR #1:#2:#3:#4\od{\doregisterrgbspotcolor \@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}}
-\def\registerspotcolorC#1:#2:#3:#4:#5\od{\doregistercmykspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}{#4}}
-\def\registerspotcolorS #1:#2\od{\doregistergrayspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}}
-\def\registerspotcolorP #1:#2:#3\od{\doregistergrayspotcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#2}}
-
-%D Experimental feature:
-
-% \definecolor [darkblue] [c=1,m=.38,y=0,k=.64] % pantone pms 2965 uncoated m
-% \definecolor [darkyellow] [c=0,m=.28,y=1,k=.06] % pantone pms 124 uncoated m
-%
-% \definecolor [darkblue-50] [darkblue] [p=.5]
-% \definecolor [darkyellow-50] [darkyellow] [p=.5]
-% \definecolor [darkblue-80] [darkblue] [p=.8]
-% \definecolor [darkyellow-80] [darkyellow] [p=.8]
-%
-% \definecolor [darkblue,darkyellow] [r=.8]
-% \definecolor [darkdull-5030] [darkblue,darkyellow] [p={.5,.3}]
-%
-% \setupcolors[state=start]
-%
-% \blackrule[width=4cm,height=3cm,color=darkblue-50]
-% \blackrule[width=4cm,height=3cm,color=darkblue-80]
-% \blackrule[width=4cm,height=3cm,color=darkyellow-50]
-% \blackrule[width=4cm,height=3cm,color=darkyellow-80]
-% \blackrule[width=4cm,height=3cm,color=darkdull-5030]
-
-%D Experimental too (special purpose code).
-
-\def\registerindexcolor#1:%
- {\ifcsname\??cl:i:\@@cl@@n\endcsname
- \@EA\dontregisterindexcolor
- \else
- \letgvalue{\??cl:i:\@@cl@@n}\empty % signal
- \showmessage\m!colors{12}\@@cl@@n
- \@EA\@EA\csname registerindexcolor#1\endcsname
- \fi}
-
-\let\dontregisterindexcolor\dontregisterspotcolor
-
-\def\registerindexcolorR #1:#2:#3:#4\od{\doregisterrgbindexcolor \@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}}
-\def\registerindexcolorC#1:#2:#3:#4:#5\od{\doregistercmykindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}{#2}{#3}{#4}}
-\def\registerindexcolorS #1:#2\od{\doregistergrayindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#1}}
-\def\registerindexcolorP #1:#2:#3\od{\doregistergrayindexcolor\@@cl@@n\@@cl@@f\@@cl@@d\@@cl@@p{#2}}
-
-\def\predefinecolor[#1]%
- {\bgroup
- \flushatshipout{\hbox{\localcolortrue\color[#1]{}}}% real ones
- \egroup}
-
-\def\predefineindexcolor[#1]%
- {\bgroup
- \flushatshipout{\hbox{\localcolortrue\color[#1]{}}}% real ones
- \let\doexeccolorP\doexeccolorPindex
- \flushatshipout{\hbox{\localcolortrue\color[#1]{}}}% index one
- \egroup}
-
-% \def\checkpredefinedcolor[#1]%
-% {\ifcase\internalspotcolorsize{#1}\relax
-% \@EA\predefinecolor\or\@EA\predefinecolor\else\@EA\predefineindexcolor
-% \fi[#1]}
-
-\let\checkpredefinedcolor\predefineindexcolor % we need an index in order to negate bitmaps
-
-%D Transparency is handled similar for all three color modes. We
-%D can turn transparency off with the following switch:
-
-\newif\iftransparencysupported \transparencysupportedtrue % only mkii
-
-\def\exectransparency
- {\iftransparencysupported
- \expandafter\doexectransparency
- \else
- \expandafter\noexectransparency
- \fi}
-
-\def\doexectransparency#1:#2\od
- {\ifcase#1\space
- \global\intransparentfalse
- \else
- \global\intransparentfalse
- %\dostarttransparency{#1}{#2}%
- \supportedstarttransparency{#1}{#2}%
- \global\intransparenttrue
- \fi}
-
-\def\noexectransparency#1\od
- {}
-
-%D Experimental: minimize transparency resets.
-
-\newif\ifintransparent
-\newif\ifoptimizetransparency \optimizetransparencytrue % under test
-
-\let\supportedstoptransparency\relax
-
-\def\conditionalstoptransparency
- {\ifoptimizetransparency
- \ifintransparent
- \global\intransparentfalse
- \supportedstoptransparency
- \fi
- \else
- \supportedstoptransparency
- \fi}
-
-\def\supportedstarttransparency
- {\iftransparencysupported
- \globallet\supportedstoptransparency\dostoptransparency
- \expandafter\dostarttransparency
- \else
- \expandafter\gobbletwoarguments
- \fi}
-
-%D We now use the \type {\@@cl@@A} hook to implement
-%D symbolic names. These are converted into numbers
-%D at definition time (which saves runtime).
-
-\def\dodefinetransparency[#1][#2]%
- {\@EA\chardef\csname\??cl-#1\endcsname#2\relax}
-
-\def\transparencynumber#1%
- {\number\executeifdefined{\??cl-#1}{#1}}
-
-%D Now we hook 'm into the patterns:
-
-\def\@@cl@@A{\transparencynumber\@@cl@@a}
-
-%D The next macro can be used to return to the (normal)
-%D page color. This macro is used in the same way as
-%D \type {\color}.
-
-\def\startregistercolor[#1]%
- {\permitcolormodefalse\startcolor[#1]\permitcolormodetrue}
-
-\def\stopregistercolor
- {\permitcolormodefalse\stopcolor\permitcolormodetrue}
-
-\def\starttextcolor[#1]%
- {\doifsomething{#1}
- {\bgroup
- \def\stoptextcolor % also goes ok with \page after
- {\let\maintextcolor\empty % this one because the top of
- \stopregistercolor % page sets the color right (side
- \egroup}% % effect)
- \def\starttextcolor[##1]%
- {\bgroup
- % \@@themaintextcolor==##1 is catched in \definecolor
- \definecolor[\@@themaintextcolor][##1]%
- \let\stoptextcolor\egroup}%
- \startregistercolor[\@@themaintextcolor]%
- \definecolor[\@@themaintextcolor][#1]%
- \let\maintextcolor\@@themaintextcolor}}
-
-\let\stoptextcolor\relax
-
-%D The following hook permits proper support at the text
-%D level. This definition actually belongs in another
-%D module. (May need a different \MKIV\ implementation.)
-
-% \ifx\initializemaintextcolor\undefined
-
- \let\@@clprevcolor\empty
-
- \def\initializemaintextcolor
- {% saveguard for setting text color to empty after
- % it has been set
- \doifnothing\@@cltextcolor
- {\ifx\@@clprevcolor\empty\else
- \let\@@cltextcolor\defaulttextcolor
- \fi}%
- \doifelsenothing\@@cltextcolor
- {\let\maintextcolor\empty}
- {\edef\@@clprevcolor{\@@cltextcolor}%
- \let\maintextcolor\@@themaintextcolor
- \doifelsenothing\@@cltextcolor % another saveguard
- {\definecolor[\@@themaintextcolor][\defaulttextcolor]}%
- {\definecolor[\@@themaintextcolor][\@@cltextcolor]}%
- \doinitializemaintextcolor}}
-
- \def\doinitializemaintextcolor
- {\appendtoks\starttextcolor[\@@themaintextcolor]\to\everystarttext
- \appendtoks\stoptextcolor \to\everystoptext
- \let\doinitializemaintextcolor\relax}
-
-% \fi
-
-\def\localstarttextcolor
- {\ifx\maintextcolor\empty
- \startcolormode\defaulttextcolor
- \else
- \startcolormode\maintextcolor
- \fi}
-
-% \def\localstoptextcolor
-% {\stopcolormode}
-%
-% better:
-
-\def\localstoptextcolor
- {\restorecolormode}
-
-\def\restoretextcolor
- {\ifx\maintextcolor\empty
- \expandafter\dorestoretextcolor
- \else
- % obey main text color
- \fi}
-
-\def\dorestoretextcolor
- {\color[\defaulttextcolor]}
-
-%D We use some reserved names for local color components.
-%D Consistent use of these scratch variables saves us
-%D unneccessary hash entries.
-%D
-%D \starttyping
-%D \@@cl@@r \@@cl@@g \@@cl@@b
-%D \@@cl@@c \@@cl@@m \@@cl@@y \@@cl@@k
-%D \@@cl@@s
-%D \stoptyping
-%D
-%D We implement several conversion routines.
-%D
-%D \starttyping
-%D \convertRGBtoCMYK {r} {g} {b}
-%D \convertRGBtoGRAY {r} {g} {b}
-%D \convertCMYKtoRGB {c} {m} {y} {k}
-%D \convertCMYKtoGRAY {c} {m} {y} {k}
-%D \convertCMYKtoCMY {c} {m} {y} {k}
-%D \stoptyping
-%D
-%D The relation between \cap{Gray}, \cap{RGB} and \cap{CMYK}
-%D is:
-%D
-%D \placeformula[-]
-%D \startformula
-%D G = .30r + .59g + .11b
-%D = 1.0 - \min(1.0,\ .30c + .59m + .11y + k)
-%D \stopformula
-%D
-%D When converting from \cap{CMYK} to \cap{RGB} we use the
-%D formula:
-%D
-%D \placeformula[-]
-%D \startformula
-%D \eqalign
-%D {r &= 1.0 - \min(1.0,\ c+k) \cr
-%D g &= 1.0 - \min(1.0,\ m+k) \cr
-%D b &= 1.0 - \min(1.0,\ y+k)}
-%D \stopformula
-%D
-%D In the conversion routine the color components are calculated
-%D in three digits precision.
-
-\def\realcolorvalue#1%
- {\ifnum#1>\zerocount % important, first encountered in --modu supp-mpe
- \ifnum#1<\plusten 0.00\the#1\else
- \ifnum#1<\plushundred 0.0\the#1\else
- \ifnum#1<\plusthousand 0.\the#1\else
- 1\fi\fi\fi
- \else 0\fi}
-
-% \def\doconvertCMYKtoRGB#1\k#2\to#3%
-% {\ifdim#2\points>#1\points% >= problem, repaired 2/12/2002
-% \let#3\@@cl@@z % k >= color
-% \else
-% \colordimen\onepoint
-% \advance\colordimen -#1\points
-% \advance\colordimen -#2\points
-% \multiply\colordimen \plusthousand
-% \colorcount\colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \edef#3{\realcolorvalue\colorcount}%
-% \fi}
-
-\def\doconvertCMYKtoRGB#1\k#2\to#3%
- {\colorcount\numexpr(\dimexpr\plusthousand\dimexpr\onepoint-#1\points-#2\points\relax\relax+\medcard)/\maxcard\relax
- \ifnum\colorcount>\zeropoint
- \edef#3{\realcolorvalue\colorcount}%
- \else
- \let#3\@@cl@@z
- \fi}
-
-\def\convertCMYKtoRGB#1#2#3#4%
- {\doconvertCMYKtoRGB#1\k#4\to\@@cl@@r
- \doconvertCMYKtoRGB#2\k#4\to\@@cl@@g
- \doconvertCMYKtoRGB#3\k#4\to\@@cl@@b}
-
-% \def\doconvertRGBtoCMYK#1\to#2%
-% {\colordimen#1\points
-% \multiply\colordimen \plusthousand
-% \colorcount\colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \colorcount-\colorcount
-% \advance\colorcount \plusthousand
-% \edef#2{\realcolorvalue\colorcount}}
-
-\def\doconvertRGBtoCMYK#1\to#2%
- {\colorcount\numexpr\plusthousand-(\dimexpr\plusthousand\dimexpr#1\points\relax\relax+\medcard)/\maxcard\relax
- \edef#2{\realcolorvalue\colorcount}}
-
-\def\convertRGBtoCMYK#1#2#3%
- {\doconvertRGBtoCMYK#1\to\@@cl@@c
- \doconvertRGBtoCMYK#2\to\@@cl@@m
- \doconvertRGBtoCMYK#3\to\@@cl@@y
- \let\@@cl@@k\@@cl@@z}
-
-%D The following switch is mainly meant for (hidden)
-%D documentation purposes.
-
-\def\nGRAYfactor{333.333}
-\def\rGRAYfactor{\ifweightGRAY300\else\nGRAYfactor\fi}
-\def\gGRAYfactor{\ifweightGRAY590\else\nGRAYfactor\fi}
-\def\bGRAYfactor{\ifweightGRAY110\else\nGRAYfactor\fi}
-
-% \def\convertRGBtoGRAY#1#2#3%
-% {\colordimen#1\points
-% \colordimen\rGRAYfactor\colordimen
-% \colorcount\colordimen
-% \colordimen#2\points
-% \colordimen\gGRAYfactor\colordimen
-% \advance\colorcount \colordimen
-% \colordimen#3\points
-% \colordimen\bGRAYfactor\colordimen
-% \advance\colorcount \colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \edef\@@cl@@s{\realcolorvalue\colorcount}}
-
-\def\convertRGBtoGRAY#1#2#3%
- {\colorcount\numexpr
- (\dimexpr\rGRAYfactor\dimexpr#1\points\relax\relax+
- \dimexpr\gGRAYfactor\dimexpr#2\points\relax\relax+
- \dimexpr\bGRAYfactor\dimexpr#3\points\relax\relax+
- \medcard)/\maxcard
- \relax
- \edef\@@cl@@s{\realcolorvalue\colorcount}}
-
-\def\convertCMYKtoGRAY#1#2#3#4%
- {\convertCMYKtoRGB{#1}{#2}{#3}{#4}%
- \convertRGBtoGRAY\@@cl@@r\@@cl@@g\@@cl@@b}
-
-% \def\doconvertCMYKtoCMY#1\k#2\to#3%
-% {\colordimen#1\points
-% \advance\colordimen #2\points\relax
-% \ifdim\colordimen>\onepoint
-% \colordimen\onepoint
-% %\else
-% % \colordimen\colordimen
-% \fi
-% \multiply\colordimen \plusthousand
-% \colorcount\colordimen
-% \advance\colorcount \medcard
-% \divide\colorcount \maxcard
-% \edef#3{\realcolorvalue\colorcount}}
-
-\def\doconvertCMYKtoCMY#1\k#2\to#3%
- {\colorcount\numexpr(\dimexpr\plusthousand\dimexpr#1\points+#2\points\relax\relax+\medcard)/\maxcard\relax
- \ifnum\colorcount>\plusthousand
- \let#3\@@cl@@o
- \else
- \edef#3{\realcolorvalue\colorcount}%
- \fi}
-
-\def\convertCMYKtoCMY#1#2#3#4%
- {\doconvertCMYKtoCMY#1\k#4\to\@@cl@@c
- \doconvertCMYKtoCMY#2\k#4\to\@@cl@@m
- \doconvertCMYKtoCMY#3\k#4\to\@@cl@@y
- \let\@@cl@@k\@@cl@@z}
-
-%D Before we present the color macros, we first define the
-%D setup command. This command takes care of setting up the
-%D booleans that control local and global behavior (more on
-%D that later) and conversion to other color spaces.
-
-\let\currentspotcolor \empty
-\let\previousspotcolor\empty
-
-%D The tests depend on the use of constants. If we use the \MKIV\
-%D method we can share more.
-
-\def\doifcolorelse#1%
- {\ifcsname\??cr\ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi#1\endcsname
- \expandafter\firstoftwoarguments
- \else
- \expandafter\secondoftwoarguments
- \fi}
-
-\def\doifcolor#1%
- {\ifcsname\??cr\ifcsname\??cr\currentpalet#1\endcsname\currentpalet\fi#1\endcsname
- \expandafter\firstofoneargument
- \else
- \expandafter\gobbleoneargument
- \fi}
-
-%D There are a couple of different color switching macros,
-%D the local ones can be used to speed up things (only in \MKII).
-
-\def\localstartcolor
- {\ifincolor
- \localcolortrue
- \expandafter\doglobalstartcolor
- \else
- \expandafter\noglobalstartcolor
- \fi}
-
-\def\localstopcolor
- {\ifincolor
- \doglobalstopcolor
- \else
- \noglobalstopcolor
- \fi}
-
-\unexpanded\def\startcolor
- {\ifincolor
- \expandafter\doglobalstartcolor
- \else
- \expandafter\noglobalstartcolor
- \fi}
-
-\unexpanded\def\stopcolor
- {\ifincolor
- \doglobalstopcolor
- \else
- \noglobalstopcolor
- \fi}
-
-%D This macros call the global color switching ones. Starting
-%D a global, i.e. a possible page boundary crossing, color
-%D mode also sets a \type{\mark} in \TEX's internal list.
-
-\newcount\colorlevel
-
-\letvalue{\??cl0C}\empty % saved color
-\letvalue{\??cl0S}\empty % stop command
-
-%D We keep a positive color stack for foreground colors, and
-%D a negative one for backgrounds. Not that brilliant a
-%D solution, but it suits. The signs are swapped when the
-%D page ornaments are typeset.
-
-\let\@@colorplus \plusone
-\let\@@colorminus\minusone
-
-\def\@@currentcolorname {\??cl\the\colorlevel C}
-\def\@@currentcolorstop {\??cl\the\colorlevel S}
-%def\@@currenttransparent{\??cl\the\colorlevel T}
-
-\letvalue{\??cl*\s!black}\s!black
-
-\def\currentcolorname
- {\csname
- \ifcsname\@@currentcolorname\endcsname
- \expandafter\ifx\csname\@@currentcolorname\endcsname\empty
- \??cl*\s!black
- \else
- \@@currentcolorname
- \fi
- \else
- \??cl*\s!black
- \fi
- \endcsname}
-
-\def\outercolorname
- {\ifcsname\@@currentcolorname\endcsname
- \expandafter\ifx\csname\@@currentcolorname\endcsname\empty
- \s!black
- \else
- currentcolor%
- \fi
- \else
- \s!black
- \fi}
-
-% not the following, because we need a different tag in order to trick the stack
-%
-% \def\outercolorname{\executeifdefined\@@currentcolorname\s!black}
-%
-% \def\startcurrentcolor{\expanded{\startcolor[\s!black]\noexpand\startcolor[\outercolorname]}}
-% \def\stopcurrentcolor {\stopcolor\stopcolor}
-%
-% test case:
-%
-% \setupcolors[state=start,textcolor=red]
-% \starttext
-% red
-% \color[green]{green
-% \startMPcode
-% label(\sometxt{green\color[blue]{blue}green}, origin) withcolor red;
-% draw fullcircle scaled 1cm xscaled 2;
-% \stopMPcode
-% green}
-% red
-% \stoptext
-
-\def\dodoglobalstartcolor
- {\global\@EA\let\@EA\@@currentcolor\csname\@@currentcolorname\endcsname
- \global\advance\colorlevel \@@colorplus
- \global\@EA\let\csname\@@currentcolorname\endcsname\@@askedcolor
- %\debuggerinfo\m!colors
- % {start \@@askedcolor\space at level \the\colorlevel}%
- \ifx\@@askedcolor\empty
- \global\@EA\let\csname\@@currentcolorname\endcsname\@@currentcolor
- \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
- \else\ifx\@@askedcolor\@@currentcolor
- \global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
- \else
- \doifcolorelse\@@askedcolor
- {%\docolormark\@@askedcolor
- \ifpermitcolormode\docolormark\@@askedcolor\fi
- \global\@EA\let\csname\@@currentcolorstop\endcsname\dodoglobalstopcolor
- \startcolormode\@@askedcolor}
- {\global\@EA\let\csname\@@currentcolorstop\endcsname\donoglobalstopcolor
- \showmessage\m!colors3\@@askedcolor\empty}%
- \fi\fi}
-
-\def\doglobalstartcolor[#1]%
- {\edef\@@askedcolor{#1}%
- \ifcase\colorlevel\relax
- \ifx\@@askedcolor\empty
- \global\@EA\let\csname\@@currentcolorstop\endcsname\empty
- \else
- \dodoglobalstartcolor
- \fi
- \else
- \dodoglobalstartcolor
- \fi
- \ignorespaces}
-
-\def\noglobalstartcolor[#1]%
- {}
-
-\def\dodoglobalstopcolor
- {\ifcase\colorlevel \else
- \donoglobalstopcolor
- \global\@EA\let\@EA\@@previouscolor\csname\@@currentcolorname\endcsname
- \ifcase\colorlevel\relax
- \ifpermitcolormode
- \docolormark\empty
- \conditionalstoptransparency
- \dostopcolormode
- \fi
- \else % let's do a bit redundant testing here
- \docolormark\@@previouscolor
- \ifx\@@previouscolor\empty
- \ifpermitcolormode
- \conditionalstoptransparency
- \dostopcolormode
- \fi
- \else
- \doifcolorelse\@@previouscolor
- {\ifx\@@currentcolor\@@previouscolor\else
- % alternatively we could let \startcolormode handle this
- \ifpermitcolormode
- \conditionalstoptransparency % really needed
- % more safe but less efficient: \dostopcolormode
- \fi
- \startcolormode\@@previouscolor
- \fi}
- {\ifpermitcolormode
- \conditionalstoptransparency
- \dostopcolormode
- \fi}%
- \fi
- \fi
- \fi}
-
-\def\donoglobalstopcolor
- {\ifcase\colorlevel \else
- \global\@EA\let\@EA\@@currentcolor\csname\@@currentcolorname\endcsname
- %\debuggerinfo{\m!colors}
- % {stop \@@currentcolor\normalspace at level \the\colorlevel}%
- \global\advance\colorlevel \@@colorminus
- \fi}
-
-\def\doglobalstopcolor
- {\csname\@@currentcolorstop\endcsname}
-
-\let\noglobalstopcolor\relax
-
-\let\faststartcolor\doglobalstartcolor
-\let\faststopcolor \doglobalstopcolor
-
-%D We don't use grouping and save each stop alternative. This
-%D permits be especially useful in for instance local color
-%D support in verbatim. Using \type{\bgroup}||\type{\egroup}
-%D pairs could interfere with calling commands
-
-%D This color mechanism takes care of nested colors, like in:
-%D
-%D \startbuffer
-%D \color[green]{groen \color[green]{groen \color[red]{rood}} groen}
-%D \color[green]{groen \color[]{groen \color[red]{rood}} groen}
-%D \color[green]{groen \color[red]{rood \color[red]{rood}} groen}
-%D \color[green]{groen \color[green]{groen \color[]{groen}} groen}
-%D \color[green]{groen \color[red]{rood} groen}
-%D \color[green]{groen \color[]{groen} groen}
-%D \color[]{zwart \color[red]{rood} zwart}
-%D \color[]{zwart}
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D or
-%D
-%D \startvoorbeeld
-%D \startlines
-%D \getbuffer
-%D \stoplines
-%D \stopvoorbeeld
-%D
-%D Crossing page boundaries is of course also handled.
-%D Undefined or empty color specifications are treated as
-%D efficient as possible.
-%D
-%D \startbuffer
-%D \startcolor[green]
-%D [green] \input tufte [green] \par
-%D \startcolor[]
-%D [green] \input knuth [green] \par
-%D \startcolor[red]
-%D [red] \input tufte [red] \par
-%D \startcolor[yellow]
-%D [yellow] \input knuth [yellow] \par
-%D \stopcolor
-%D [red] \input tufte [red] \par
-%D \stopcolor
-%D [green] \input knuth [green] \par
-%D \stopcolor
-%D [green] \input tufte [green] \par
-%D \stopcolor
-%D \stopbuffer
-%D
-%D \startpacked
-%D \getbuffer
-%D \stoppacked
-%D
-%D These quotes are typeset by saying:
-%D
-%D \typebuffer
-
-%D We already mentioned that colors interfere with building
-%D the pagebody. This means that when the page is composed,
-%D the colors temporary have to be reset. After the page is
-%D shipped out, we have to revive the current color.
-%D
-%D We use \type{\mark}s to keep track of colors across page
-%D boundaries. Unfortunately standard \TEX\ supports only one mark,
-%D and using this one for color support only would be a waste.
-%D We therefore use an adapted version of J.~Fox's multiple mark
-%D mechanism as (re|)|implemented in \module{supp-mrk}.
-
-\doifdefinedelse{rawnewmark}
- {\rawnewmark\colormark}
- {\let\colormark\gobbleoneargument}
-
-%D Using this mark mechanism with lots of colors has one
-%D major drawback: \TEX's memory tends to overflow when
-%D very colorful text is stored in a global box. Even worse is that
-%D the processing time grows considerably. We therefore support
-%D local as well as global color switching.
-%D
-%D Of the next macros, \type {\popcolor} is to be used after
-%D the actual \type {\shipout} and \type {\startcolorpage} and
-%D \type {\stopcolorpage} are called when entering and leaving
-%D the \type {\pagebody} builder. In case of emergencies
-%D \type {\pushcolor} can be used to undo the current color,
-%D for instance when insertions are appended to the page.
-%D
-%D Out of efficiency we only use marks when needed. The next
-%D macro tries to find out if indeed a mark should be set.
-%D This macro uses the boolean \type {\ifinpagebody}, which can
-%D be defined and set in the module that handles the pagebody.
-
-\def\docolormark#1%
- {\iflocalcolor \else \ifinpagebody \else \ifinframed \else
- \dodocolormark{#1}%
- \fi \fi \fi}
-
-\let\lastcolormark=\empty
-
-\def\dodocolormark#1%
- {\edef\newcolormark{#1}%
- \ifx\newcolormark\lastcolormark\else
- \global\let\lastcolormark\newcolormark
- \@EA\rawsetmark\@EA\colormark\@EA{\lastcolormark}%
- \fi}
-
-%D \macros
-%D {pushcolor, popcolor}
-%D
-%D Pushing the current state in the output routine simply comes
-%D to resetting the color to black, while popping restores the
-%D color state to that of before the break.
-
-\def\topofpagecolor{\rawgetbotmark\colormark} % see postponing
-
-\def\pushcolor
- {\stopcolormode}
-
-\def\popcolor
- {\doifsomething{\rawgetbotmark\colormark}
- {%\debuggerinfo\m!colors{popping \getbotmark\colormark}%
- \startcolormode{\rawgetbotmark\colormark}}}
-
-\def\popsplitcolor
- {\getsplitmarks\colormark % hier wel
- \doifsomething{\rawgetsplitbotmark\colormark}
- {%\debuggerinfo\m!colors{split popping \getsplitbotmark\colormark}%
- \startcolormode{\rawgetsplitbotmark\colormark}}}
-
-\appendtoks\pushcolor \to\everypushproperties
-\appendtoks\popcolor \to\everypopproperties
-\appendtoks\popsplitcolor\to\everypopsplitproperties
-
-% Private macro: only needed in test cases (like multiple
-% seperations in one file); no user command!
-
-\def\resynccolor
- {\ifcase\pagetotal % \ifdim\pagetotal=\zeropoint
- \popcolor
- \else\ifx\@@currentcolor\empty
- \ifx\maintextcolor\empty\else
- \startcolormode\maintextcolor
- \fi
- \else
- \startcolormode\@@currentcolor
- \fi\fi}
-
-% weird stuff
-
-\def\pushpostponedpagecolor
- {\edef\savedtopofpagecolor{\topofpagecolor}%
- \doifsomething\savedtopofpagecolor\restorecolormode} % \stopcolormode
-
-\def\poppostponedpagecolor
- {\doifsomething\savedtopofpagecolor\startcolormode\savedtopofpagecolor}
-
-%D \macros
-%D {startcolorpage, stopcolorpage}
-%D
-%D Local use can be forced with the next two macros. Nesting
-%D is still supported but colors are no longer marked.
-%D
-%D The next implementation makes (simple) color separation more
-%D easy. It also supports nested colors in page backgrounds
-%D and texts.
-
-\def\startcolorpage
- {\bgroup
- \let\@@colorplus \minusone
- \let\@@colorminus\plusone
- \let\docolormark\gobbleoneargument
- \edef\savedcolorlevel{\the\colorlevel}%
- \global\colorlevel\zerocount % before \localstartcolor of
- \ifx\maintextcolor\empty % course, ugly bug removed
- \localstartcolor[\defaulttextcolor]%
- \else
- \localstartcolor[\maintextcolor]%
- \fi}
-
-\def\stopcolorpage
- {\localstopcolor
- \global\colorlevel\savedcolorlevel
- \egroup}
-
-\appendtoks \startcolorpage\to\everystarttextproperties
-\prependtoks\stopcolorpage \to\everystoptextproperties
-
-%D We want color support to be similar to font support and
-%D therefore implement \type{\color} using grouping.
-%D
-%D When \type {\somecolor} is issued, we can savely assume
-%D grouping. Using \type {\groupedcommand} here (i.e.\ the
-%D definition of \type {\color}) is unsafe because in
-%D interferes with for instance switching attributes.
-
-\unexpanded\def\color[#1]%
- {\groupedcommand{\startcolor[#1]}\stopcolor}
-
-%D This implementation enables use of defined colors like:
-%D
-%D \starttyping
-%D Look at the {\brightgreen bright} side of life and get
-%D yourself no \red{red} head!
-%D \stoptyping
-
-%D Also wrong, test in combinations: \type{...{}{\red test}}
-%D
-%D \def\switchtocolor[#1]%
-%D {\startcolor[#1]\aftergroup\stopcolor}
-
-\def\switchtocolor[#1]% grouping is realy needed, else migration
- {\bgroup\startcolor[#1]\aftergroup\stopcolor\aftergroup\egroup}
-
-\unexpanded\def\color[#1]%
- {\groupedcommand{\startcolor[#1]}\stopcolor}
-
-\unexpanded\def\graycolor[#1]% not \gray because this is a color
- {\groupedcommand{\RGBsupportedfalse\CMYKsupportedfalse\SPOTsupportedfalse\startcolor[#1]}\stopcolor}
-
-%D We can speed the following macros a bit up, but this
-%D hardly pays off; they are only used in the manual.
-
-\def\realcolorformat#1%
- {\ifnum#1<\plusten 0.00\the#1\else
- \ifnum#1<\plushundred 0.0\the#1\else
- \ifnum#1<\plusthousand 0.\the#1\else
- 1.000\fi\fi\fi}
-
-\def\dodoformatcolor#1%
- {\colordimen#1\points\relax
- \ifdim\colordimen>\onepoint
- \colordimen\onepoint
- \fi
- \multiply\colordimen \plusthousand
- \colorcount\colordimen
- \advance\colorcount \medcard
- \divide\colorcount \maxcard \relax
- \realcolorformat\colorcount}
-
-\def\doformatcolorR#1:#2:#3:#4:#5\od
- {\dodoformatcolor{#1}\colorformatseparator
- \dodoformatcolor{#2}\colorformatseparator
- \dodoformatcolor{#3}}
-
-\def\doformatcolorC#1:#2:#3:#4:#5:#6\od
- {\dodoformatcolor{#1}\colorformatseparator
- \dodoformatcolor{#2}\colorformatseparator
- \dodoformatcolor{#3}\colorformatseparator
- \dodoformatcolor{#4}}
-
-\def\doformatcolorS#1:#2:#3\od
- {\dodoformatcolor{#1}}
-
-\def\doformatcolorP#1:#2:#3:#4:#5:#6\od
- {#1\colorformatseparator
- \dodoformatcolor{#2}\colorformatseparator
- \dodoformatcolor{#3}\colorformatseparator
- \dodoformatcolor{#4}\colorformatseparator}
-
-\def\doformatcolor#1:%
- {\csname doformatcolor#1\endcsname}
-
-\def\colorvalue
- {\dowithcolor\doformatcolor}
-
-\def\doformatgrayR#1:#2:#3:#4:#5\od
- {\convertRGBtoGRAY{#1}{#2}{#3}%
- \dodoformatcolor\@@cl@@s}
-
-\def\doformatgrayC#1:#2:#3:#4:#5:#6\od
- {\convertCMYKtoGRAY{#1}{#2}{#3}{#4}%
- \dodoformatcolor\@@cl@@s}
-
-\def\doformatgrayS#1:#2:#3\od
- {\dodoformatcolor{#1}}
-
-% \def\doformatgrayP#1:#2:#3:#4:#5:#6\od
-% {\convertSPOTtoGRAY{#1}{#2}{#3}{#4}%
-% \dodoformatcolor\@@cl@@s}
-
-\def\doformatgrayP#1:#2:#3:#4:#5:#6\od
- {todo}
-
-\def\doformatgray#1:%
- {\csname doformatgray#1\endcsname}
-
-\def\grayvalue
- {\dowithcolor\doformatgray}
-
-%D \macros
-%D {localstartraster,localstopraster,
-%D startraster,stopraster}
-%D
-%D The previous conversions are not linear and treat each color
-%D component according to human perception curves. Pure gray
-%D (we call them rasters) has equal color components. In
-%D \CONTEXT\ rasters are only used as backgrounds and these
-%D don't cross page boundaries in the way color does. Therefore
-%D we don't need stacks and marks. Just to be compatible with
-%D color support we offer both 'global' and 'local' commands.
-%D
-%D \starttyping
-%D \def\localstartraster[#1]%
-%D {\doifelsenothing{#1}
-%D {\dostartgraymode\@@rsscreen}
-%D {\dostartgraymode{#1}}}
-%D
-%D \def\localstopraster
-%D {\dostopgraymode}
-%D
-%D \let\startraster\localstartraster
-%D \let\stopraster \localstopraster
-%D \stoptyping
-%D
-%D The next alternative is slower, since it works on top of the
-%D color (stack) mechanism, but it does provide nesting.
-
-\def\dosetrastercolor#1%
- {\edef\@@cl@@s{#1}%
- \ifx\@@cl@@s\empty
- \let\@@cl@@s\@@rsscreen
- \fi
- \let\@@cl@@t\@@cl@@z % else we get rogue
- \let\@@cl@@a\@@cl@@z % transpancies
- \setevalue{\??cr\??rs}{\colorSpattern}}
-
-% beware, don't add extra grouping, else color in tables
-% fails
-
-\def\localstartraster[#1]%
- {\ifincolor\dosetrastercolor{#1}\localstartcolor[\??rs]\fi}
-
-\def\startraster[#1]%
- {\ifincolor\dosetrastercolor{#1}\startcolor[\??rs]\fi}
-
-\def\localstopraster{\ifincolor\localstopcolor\fi}
-\def\stopraster {\ifincolor\stopcolor\fi}
-
-\def\raster[#1]{\groupedcommand{\startraster[#1]}{\stopraster}}
-
-%D Palets use an auxiliary macro:
-
-\def\dodefinepaletcolor#1#2#3%
- {\doifassignmentelse{#3}
- {% == \definepalet[test][xx={y=.4}]
- \definecolor[\??pa#1:#2][#3]%
- \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{\??cr#1:#2}{\csname\??cr\??pa#1:#2\endcsname}}
- {% == \definepalet[test][xx=green]
- \doifdefinedelse{\??cr#3}
- {\iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{\??cr#1:#2}{\csname\??cr#3\endcsname}}
- {\letvalue{\??cr#1:#2}\colorXpattern}}}
-
-%D \MP\ related conversions:
-
-\def\scaledMPcolor#1#2%
- {\ifMPgraphics
- \handlecolorwith\doMPcolor
- \csname\??cr
- \ifcsname\??cr\currentpalet#2\endcsname\currentpalet\fi
- #2\endcsname
- :::::::\end#1\end
- \else
- #2%
- \fi}
-
-\def\MPcolor{\scaledMPcolor1}
-
-%D Before we had transparency available, the following
-%D conversion macro was available:
-%D
-%D \starttyping
-%D \def\doMPcolor#1:#2:#3:#4:#5:#6:#7:#8\end
-%D {\if #1R(#2,#3,#4)%
-%D \else\if#1C\ifMPcmykcolors cmyk(#2,#3,#4,#5)\else(1-#2-#5,1-#3-#5,1-#4-#5)\fi
-%D \else\if#1S(#2,#2,#2)%
-%D \else (0,0,0)%
-%D \fi\fi\fi}
-%D \stoptyping
-%D
-%D In order to be useful, this macro is to be fully
-%D expandabele.
-
-\def\doMPcolor#1:% #1 can be \relax ! ! ! i.e. an empty color
- {\csname MPc\@EA\ifx\csname MPc\string#1\endcsname\relax B\else#1\fi\endcsname}
-
-\def\MPcR{\doMPrgb}
-\def\MPcC{\ifMPcmykcolors\@EA\doMPcmykY\else\@EA\doMPcmykN\fi}
-\def\MPcS{\doMPgray}
-\def\MPcP{\ifMPspotcolors\@EA\doMPspotY\else\@EA\doMPspotN\fi}
-\def\MPcB{\doMPblack}
-
-\def\transparentMP {transparent}
-\def\cmykMP {scaledcmyk}
-\def\cmykASrgbMP {scaledcmykasrgb} % not really needed any more
-\def\rgbMP {scaledrgb}
-\def\grayMP {scaledgray}
-\def\spotMP {spotcolor}
-
-\def\doMPtransparent#1#2:#3:#4\end
- {\ifcase#2\space(#1)\else\transparentMP(#2,#3,(#1))\fi}
-
-\def\doMPgray#1:#2\end#3\end
- {\doMPtransparent{\grayMP(#1,#3)}#2\end}
-
-\def\doMPrgb#1:#2:#3:#4\end#5\end
- {\doMPtransparent{\rgbMP(#1,#2,#3,#5)}#4\end}
-
-\def\doMPcmykY#1:#2:#3:#4:#5\end#6\end
- {\doMPtransparent{\cmykMP(#1,#2,#3,#4,#6)}#5\end}
-
-\def\doMPcmykN#1:#2:#3:#4:#5\end#6\end
- {\doMPtransparent{\cmykASrgbMP(#1,#2,#3,#4,#6)}#5\end}
-
-\def\doMPspotY#1:#2:#3:#4:#5\end#6\end % best make #3 same as #1 when empty
- {\doMPtransparent{multitonecolor("#1",#2,"#3","#4")}#5\end}
-
-\def\doMPspotN#1:#2:#3:#4:#5\end#6\end
- {\scaledMPcolor{#4}{#1}}
-
-\def\doMPblack#1\end#2\end
- {\unknownMPcolor}
-
-\def\unknownMPcolor
- {(0,0,0)}
-
-\let\processMP\spotMP % for some time, will become obsolete, brrr
-
-%D \PDF\ related conversions:
-
-\def\PDFcolor #1{\handlecolorwith\doPDFcolor \csname\??cr#1\endcsname:::::::\end}
-\def\PDFcolorvalue#1{\handlecolorwith\doPDFcolorvalue\csname\??cr#1\endcsname:::::::\end}
-\def\FDFcolor #1{\handlecolorwith\doFDFcolor \csname\??cr#1\endcsname:::::::\end}
-
-\def\doPDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
- {\if #1R#2 #3 #4 rg%
- \else\if#1C#2 #3 #4 #5 k%
- \else\if#1S#2 g%
- \else\if#1P#5 g%
- \else 0 g%
- \fi\fi\fi\fi}
-
-\def\doPDFcolorvalue#1:#2:#3:#4:#5:#6:#7:#8\end
- {\if #1R#2 #3 #4%
- \else\if#1C#2 #3 #4 #5%
- \else\if#1S#2%
- \else\if#1P#5%
- \else 0%
- \fi\fi\fi\fi}
-
-\def\doFDFcolor#1:#2:#3:#4:#5:#6:#7:#8\end
- {[\if #1R#2 #3 #4%
- \else\if#1C#2 #3 #4 #5%
- \else\if#1S#2%
- \else\if#1P#5%
- \else 0%
- \fi\fi\fi\fi]}
-
-\def\internalspotcolorname#1{\handlecolorwith\dointernalspotcolorname\csname\??cr#1\endcsname:::::::\end}
-\def\internalspotcolorsize#1{\handlecolorwith\dointernalspotcolorsize\csname\??cr#1\endcsname:::::::\end}
-
-\def\dointernalspotcolorname#1:#2:#3:#4:#5:#6:#7:#8\end{\if#1P\ifcase0#3 #1\else#2\fi\else#1\fi}
-\def\dointernalspotcolorsize#1:#2:#3:#4:#5:#6:#7:#8\end{\if#1P\ifcase0#3 0\else#3\fi\else 0\fi}
-
-%D Slow but ok \unknown
-
-\def\colorcomponents#1%
- {\startnointerference
- \localcolortrue
- \def\doexeccolorR ##1:##2:##3:##4:##5\od{\gdef\thecolorcomponents{r=\twodigitrounding{##1} g=\twodigitrounding{##2} b=\twodigitrounding{##3}}}%
- \def\doexeccolorC##1:##2:##3:##4:##5:##6\od{\gdef\thecolorcomponents{c=\twodigitrounding{##1} m=\twodigitrounding{##2} y=\twodigitrounding{##3} k=\twodigitrounding{##4}}}%
- \def\doexeccolorS ##1:##2:##3\od{\gdef\thecolorcomponents{s=\twodigitrounding{##1}}}%
- \def\doexeccolorP##1:##2:##3:##4:##5:##6\od{\gdef\thecolorcomponents{p=\twodigitrounding{##4} n=##1}}%
- \let\doexeccolorPindex\doexeccolorP
- \backgroundline[#1]{}%
- \stopnointerference
- \thecolorcomponents}
-
-\def\transparencycomponents#1%
- {\startnointerference
- \localcolortrue
- \def\doexeccolorR ##1:##2:##3:##4:##5\od{\gdef\thetransparencycomponents{a=\twodigitrounding{##4} t=\twodigitrounding{##5}}}%
- \def\doexeccolorC##1:##2:##3:##4:##5:##6\od{\gdef\thetransparencycomponents{a=\twodigitrounding{##5} t=\twodigitrounding{##6}}}%
- \def\doexeccolorS ##1:##2:##3\od{\gdef\thetransparencycomponents{a=\twodigitrounding{##2} t=\twodigitrounding{##3}}}%
- \def\doexeccolorP##1:##2:##3:##4:##5:##6\od{\gdef\thetransparencycomponents{a=\twodigitrounding{##5} t=\twodigitrounding{##6}}}%
- \let\doexeccolorPindex\doexeccolorP
- \backgroundline[#1]{}%
- \stopnointerference
- \thecolorcomponents}
-
-%D \macros
-%D {everyshapebox}
-%D
-%D A terrible hack, needed because we cannot have marks in
-%D shape boxes.
-
-\appendtoks \localcolortrue \to \everyshapebox
-
-\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/colo-new.mkiv b/Master/texmf-dist/tex/context/base/colo-new.mkiv
deleted file mode 100644
index d054095fe97..00000000000
--- a/Master/texmf-dist/tex/context/base/colo-new.mkiv
+++ /dev/null
@@ -1,331 +0,0 @@
-%D \module
-%D [ file=colo-ini,
-%D version=2007.08.08,
-%D title=\CONTEXT\ Color Macros,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\unprotect
-
-\chardef\colorversion=2
-
-% todo: palets in definecolor
-% todo: {\red xx} vs \red{xx}
-
-% check: registerusedspotcolors
-% check: registerusedcolorchannels
-% check: \currentcolorname
-% check: \outercolorname
-% check: \chardef\currentcolorchannel=0
-% check: \startcolormode
-% check: \newif\iffilterspotcolor \filterspotcolorfalse
-% check: \newif\ifdoingspotcolor \doingspotcolorfalse
-% check: \registercolorchannel
-
-% \def\mptexcolor#1{"\dogetattributeid\s!color \somecolorattribute{#1} A"}
-%
-% \startMPpage
-% fill fullcircle scaled 10cm ;
-% fill fullcircle scaled 5cm withprescript \mptexcolor{red} withpostscript \mptexcolor{black} ;
-% fill fullcircle scaled 3cm ;
-% draw btex test etex withprescript \mptexcolor{blue} ;
-% \stopMPpage
-
-\registerctxluafile{colo-new}{1.000}
-
-\ifx\currentcolormodel\undefined \newcount\currentcolormodel \fi
-
-\def\setcolormodel#1%
- {\currentcolormodel\ctxlua{tex.print(colors.setmodel('colormodel','#1'))}%
- \dosetattribute{colormodel}{\the\currentcolormodel}}
-
-\setcolormodel{all}
-
-\def\dosetupcolormodel
- {\ifincolor
- \ifRGBsupported
- \ifCMYKsupported
- \setcolormodel{all}%
- \else
- \setcolormodel{rgb}%
- \fi
- \else
- \ifCMYKsupported
- \setcolormodel{cmyk}%
- \else
- \setcolormodel{gray}%
- \fi
- \fi
- \else
- \setcolormodel{gray}%
- \fi}
-
-\appendtoks
- \dosetupcolormodel
-\to \everyjob
-
-% Currently in mkiv transparency is implemented independent of color. This costs
-% a bit more processing time but gives the possibility to apply transparency
-% independently in the future. Is this useful? If not we may as well combine them
-% again in the future. By coupling we are downward compatible. When we decouple we
-% need to do more tricky housekeeping (e.g. persist color independent transparencies
-% when color bound ones are nil.
-
-% Since we couple definitions, we could stick to one test. Todo. Same for mpcolor.
-
-% \def\doactivatecolor#1% : in currentpalet, maybe not, ugly
-% {\ifcsname(cs:\currentpalet#1)\endcsname
-% \csname(cs:\currentpalet#1)\endcsname
-% \csname(ts:\currentpalet#1)\endcsname
-% \else
-% \csname(cs:#1)\endcsname
-% \csname(ts:#1)\endcsname
-% \fi}
-
-% \def\doactivatecolor#1% : in currentpalet, maybe not, ugly
-% {\csname(cs:\ifcsname(cs:\currentpalet#1)\endcsname\currentpalet\fi#1)\endcsname}
-% \csname(ts:\ifcsname(ts:\currentpalet#1)\endcsname\currentpalet\fi#1)\endcsname}
-%
-% more robust test, else we get \relaxed non-colors which may confuse e.g. mpcolor
-
-\letvalue{(cs:-}\empty
-\letvalue{(ts:-}\empty
-
-% \def\doactivatecolor#1% : in currentpalet, maybe not, ugly
-% {\csname(cs:\ifcsname(cs:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(cs:#1)\endcsname#1\else-\fi\fi)\endcsname
-% \csname(ts:\ifcsname(ts:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ts:#1)\endcsname#1\else-\fi\fi)\endcsname}
-
-\def\doactivatecolor#1% : in currentpalet, maybe not, ugly
- {\ifcsname(cs:\currentpalet#1)\endcsname
- \csname(cs:\currentpalet#1)\endcsname
- \csname(ts:\currentpalet#1)\endcsname
- \else\ifcsname(cs:#1)\endcsname
- \csname(cs:#1)\endcsname
- \csname(ts:#1)\endcsname
- \fi\fi}
-
-\let\normaldoactivatecolor\doactivatecolor
-
-% if it becomes a bottleneck we can set up a more complex system with one shared
-% attribute for colorspace, color and transparency
-
-\def\doactivatecolor
- {\ifproductionrun
- \ctxlua{colors.enabled=true transparencies.enabled=true}% not that efficient but at least robust
- \let\doactivatecolor\normaldoactivatecolor
- \expandafter\doactivatecolor
- \else
- \expandafter\normaldoactivatecolor
- \fi}
-
-\def\deactivatecolor
- {\doresetattribute\s!color
- \doresetattribute\s!transparency}
-
-\def\dodefinecolorcommand#1#2%
- {\unexpanded#1{#2}{\doactivatecolor{#2}}}
-
-\def\dodefinecolor[#1][#2]%
- {\addtocommalist{#1}\colorlist
- \ctxlua{ctx.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
- \dodefinecolorcommand\setvalue{#1}}
-
-\def\dodefineglobalcolor[#1][#2]%
- {\doglobal\addtocommalist{#1}\colorlist
- \ctxlua{ctx.defineprocesscolor("#1","#2",true,\iffreezecolors true\else false\fi)}%
- \dodefinecolorcommand\setgvalue{#1}}
-
-\def\dodefinenamedcolor[#1][#2]%
- {\doglobal\addtocommalist{#1}\colorlist
- \ctxlua{ctx.defineprocesscolor("#1","#2",false,\iffreezecolors true\else false\fi)}%
- \dodefinecolorcommand\setvalue{#1}}
-
-\def\dodefinespotcolor[#1][#2][#3]%
- {\doglobal\addtocommalist{#1}\colorlist % optional
- \doglobal\addtocommalist{#2}\allspotcolors
- \ctxlua{ctx.definespotcolor("#1","#2","#3",true)}%
- \dodefinecolorcommand\setxvalue{#1}}
-
-\def\dodefinemultitonecolor[#1][#2][#3][#4]%
- {\ctxlua{ctx.definemultitonecolor("#1","#2","#3","#4",true)}%
- \dodefinecolorcommand\setxvalue{#1}}
-
-\def\dodefinetransparency[#1][#2]%
- {\ctxlua{ctx.definetransparency("#1",#2)}}
-
-\def\dosetrastercolor#1% slow, we need a fast one
- {\edef\@@rastervalue{#1}%
- \ifx\@@rastervalue\empty
- \let\@@rastervalue\@@rsscreen
- \fi
- \dosetattribute\s!color{\ctxlua{tex.sprint(ctx.definesimplegray("_raster_",\@@rastervalue))}}}
-
-\def\doifcolorelse#1%
- {\ifcsname(ca:\currentpalet#1)\endcsname
- \@EA\firstoftwoarguments
- \else\ifcsname(ca:#1)\endcsname
- \@EAEAEA\firstoftwoarguments
- \else
- \@EAEAEA\secondoftwoarguments
- \fi\fi}
-
-\def\doifcolor#1%
- {\ifcsname(ca:\currentpalet#1)\endcsname
- \@EA\firstofoneargument
- \else\ifcsname(ca:#1)\endcsname
- \@EAEAEA\firstofoneargument
- \else
- \@EAEAEA\gobbleoneargument
- \fi\fi}
-
-% currentcolor, then we can push pop in register
-
- \def\switchtocolor [#1]{\getvalue{#1}}
-\unexpanded\def\color [#1]{\groupedcommand{\doactivatecolor{#1}}{}}
-\unexpanded\def\startcolor [#1]{\begingroup\doactivatecolor{#1}}
-\unexpanded\def\stopcolor {\endgroup}
-\unexpanded\def\graycolor [#1]{\groupedcommand{\setcolormodel{gray}\getvalue{#1}}{}}
- \def\predefinecolor [#1]{\flushatshipout{\hbox{\color[#1]{}}}}
- \def\predefineindexcolor[#1]{\flushatshipout{\hbox{\color[#1]{}}}}
- \def\startcolorpage {\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]}
- \def\stopcolorpage {\stopcolor}
- \def\localstartraster [#1]{\dosetrastercolor{#1}}
- \def\localstopraster {}
- \def\startraster [#1]{\dosetrastercolor{#1}}
- \def\stopraster {}
- \def\raster [#1]{\groupedcommand{\dosetrastercolor{#1}}{}}
- \def\faststartcolor [#1]{\doactivatecolor{#1}}
- \def\faststopcolor {}
-
-\def\startregistercolor[#1]%
- {\doifelsenothing{#1}
- {\let\stopregistercolor\relax}
- {\edef\stopregistercolor
- {\dosetattribute\s!color {\dogetattribute\s!color }%
- \dosetattribute\s!transparency{\dogetattribute\s!transparency}}%
- \doactivatecolor{#1}}}
-
-\let\resynccolor \relax % ?
-\let\pushcolor \relax
-\let\popcolor \relax
-\let\popsplitcolor\relax
-
-\def\restorecolormode
- {\ifincolor
- \deactivatecolor
- \ifx\maintextcolor\empty \else
- \doactivatecolor\maintextcolor
- \fi
- \fi}
-
-\def\pushpostponedpagecolor
- {\edef\savedtopofpagecolor{\topofpagecolor}%
- \doifsomething\savedtopofpagecolor\restorecolormode}
-
-\def\poppostponedpagecolor
- {\doifsomething\savedtopofpagecolor\doactivatecolor\savedtopofpagecolor}
-
-% \def\pushcolor
-% {\edef\popcolor
-% {\dosetattribute\s!color {\dogetattribute\s!color }%
-% \dosetattribute\s!transparency{\dogetattribute\s!transparency}}%
-% \let\popsplitcolor\popcolor
-% \deactivatecolor}
-
-\appendtoks\deactivatecolor\to\everybeforeoutput % maybe we don't need push pop now
-
-\def\startregistercolor[#1]%
- {\doifelsenothing{#1}
- {\let\stopregistercolor\relax}
- {\edef\stopregistercolor
- {\dosetattribute\s!color {\dogetattribute\s!color }%
- \dosetattribute\s!transparency{\dogetattribute\s!transparency}}%
- \doactivatecolor{#1}}}
-
-\let\grey \graycolor
-\let\localstartcolor \startcolor
-\let\localstopcolor \stopcolor
-\let\globalstartcolor\startcolor
-\let\globalstopcolor \stopcolor
-
-\def\registermaintextcolor{\ctxlua{colors.main = \thecolorattribute\maintextcolor}}
-
-\def\starttextcolor[#1]%
- {\doifsomething{#1}
- {\definecolor[\@@themaintextcolor][#1]%
- \let\maintextcolor\@@themaintextcolor
- \doactivatecolor\maintextcolor
- \registermaintextcolor}}
-
-\let\stoptextcolor\relax
-
-\def\initializemaintextcolor
- {\doifelsenothing\@@cltextcolor
- {\definecolor[\@@themaintextcolor][\defaulttextcolor]}
- {\definecolor[\@@themaintextcolor][\@@cltextcolor]}%
- \let\maintextcolor\@@themaintextcolor
- \doactivatecolor\maintextcolor
- \registermaintextcolor}
-
-\appendtoks \initializemaintextcolor \to \everyjob
-
-\def\localstarttextcolor{\expanded{\startcolor[\ifx\maintextcolor\empty\defaulttextcolor\else\maintextcolor\fi]}}
-\let\localstoptextcolor \stopcolor
-\let\restoretextcolor \firstofoneargument
-
-\def\dodefinepaletcolor#1#2#3%
- {\doifassignmentelse{#3}% \definepalet[test][xx={y=.4}]
- {\definecolor[\??pa#1:#2][#3]%
- \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(cs:#1:#2)}{\csname(cs:\??pa#1:#2)\endcsname}%
- \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(ca:#1:#2)}{\csname(ca:\??pa#1:#2)\endcsname}}
- {\doifdefinedelse{(cs:#3)}% \definepalet[test][xx=green]
- {\iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(cs:#1:#2)}{\csname(cs:#3)\endcsname}%
- \iffreezecolors\@EA\setevalue\else\@EA\setvalue\fi{(ca:#1:#2)}{\csname(ca:#3)\endcsname}}
- {\letvalue{(cs:#1:#2)}\undefined
- \letvalue{(ca:#1:#2)}\undefined}}}
-
-\setvalue{(cs:)}{} \setvalue{(ca:)}{0}
-\setvalue{(ts:)}{} \setvalue{(ta:)}{0}
-
-\def\doinheritca#1{\csname(ca:\ifcsname(ca:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ca:#1)\endcsname#1\fi\fi)\endcsname}
-\def\doinheritcs#1{\csname(cs:\ifcsname(cs:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(cs:#1)\endcsname#1\fi\fi)\endcsname}
-\def\doinheritta#1{\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname}
-\def\doinheritts#1{\csname(ts:\ifcsname(ts:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ts:#1)\endcsname#1\fi\fi)\endcsname}
-
-\def\MPcolor#1{\ctxlua{tex.sprint(ctx.mpcolor(\number\currentcolormodel,\number\doinheritca{#1},\number\doinheritta{#1}))}}
-
-\def\currentcolorname{\s!black} % todo
-\def\outercolorname {\s!black} % todo
-
-\def\thecolorattribute #1{\number\csname(ca:\ifcsname(ca:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ca:#1)\endcsname#1\fi\fi)\endcsname}
-\def\thetransparencyattribute#1{\number\csname(ta:\ifcsname(ta:\currentpalet#1)\endcsname\currentpalet#1\else\ifcsname(ta:#1)\endcsname#1\fi\fi)\endcsname}
-
-\def\PDFcolor #1{\ctxlua{tex.sprint(ctx.pdfcolor (\number\currentcolormodel, \thecolorattribute{#1}))}}
-\def\PDFcolorvalue#1{\ctxlua{tex.sprint(ctx.pdfcolorvalue(\number\currentcolormodel, \thecolorattribute{#1}))}}
-\def\FDFcolor #1{\ctxlua{tex.sprint(ctx.fdfcolor (\number\currentcolormodel, \thecolorattribute{#1}))}}
-
-\def\internalspotcolorname#1{\ctxlua{tex.sprint(ctx.spotcolorname (\thecolorattribute{#1}))}}
-\def\internalspotcolorsize#1{\ctxlua{tex.sprint(ctx.spotcolorvalue(\thecolorattribute{#1}))}}
-
-\def\colorcomponents #1{\ctxlua{tex.sprint(ctx.colorcomponents (\thecolorattribute {#1}))}}
-\def\transparencycomponents#1{\ctxlua{tex.sprint(ctx.transparencycomponents(\thetransparencyattribute{#1}))}}
-
-\def\colorvalue#1{\ctxlua{tex.sprint(ctx.formatcolor(\thecolorattribute{#1},"\colorformatseparator"))}}
-\def\grayvalue #1{\ctxlua{tex.sprint(ctx.formatgray (\thecolorattribute{#1},"\colorformatseparator"))}}
-
-% hack, till we have adapted backend: (move it there)
-
-\def\presetPDFtransparencybynumber#1#2#3%
- {\initializetransparency
- \ifcase#1\else
- \global\PDFcurrenttransparency\numexpr#1+\minusone\relax
- \presetPDFtransparency{#2}{#3}%
- \fi}
-
-\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/colo-new.tex b/Master/texmf-dist/tex/context/base/colo-new.tex
deleted file mode 100644
index 04b2ef716f7..00000000000
--- a/Master/texmf-dist/tex/context/base/colo-new.tex
+++ /dev/null
@@ -1,1051 +0,0 @@
-%D \module
-%D [ file=colo-ini,
-%D version=2007.08.08,
-%D title=\CONTEXT\ Color Macros,
-%D subtitle=Initialization,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-%D We need to clean this up further but first we hav eto make sure that mkiv
-%D code works ok.
-
-\writestatus{loading}{Context Color Macros / initialization}
-
-%D This module implements color. Since \MKII\ and \MKIV\ use a completely
-%D different approach, this module only implements a few generic mechanisms.
-
-\startmessages dutch library: colors
- title: kleur
- 1: systeem -- is globaal actief
- 2: systeem -- is lokaal actief
- 3: -- is niet gedefinieerd --
- 4: systeem -- wordt geladen
- 5: onbekend systeem --
- 6: palet -- is beschikbaar
- 7: palet -- is niet beschikbaar
- 8: specificatie -- bij -- wordt zwart
- 9: -- kleurruimte wordt niet ondersteund
- 10: -- kleurruimte wordt ondersteund
- 11: kleur wordt vertaald in grijs
- 12: -- is geregistreerd
-\stopmessages
-
-\startmessages english library: colors
- title: color
- 1: system -- is global activated
- 2: system -- is local activated
- 3: -- is not defined --
- 4: system -- is loaded
- 5: unknown system --
- 6: palette -- is available
- 7: palette -- is not available
- 8: specification -- at color -- becomes black
- 9: -- color space is not supported
- 10: -- color space is supported
- 11: color is converted to gray
- 12: -- is registered
-\stopmessages
-
-\startmessages german library: colors
- title: farbe
- 1: system -- ist global aktiviert
- 2: system -- ist lokal aktiviert
- 3: -- ist undefiniert --
- 4: system -- ist geladen
- 5: unbekanntes System --
- 6: palette -- ist verfuegbar
- 7: palette -- ist nicht verfuegbar
- 8: Spezifikation -- bei Farbe -- wird schwarz
- 9: -- Farbraum wird nicht unterstuetzt
- 10: -- Farbraum wird unterstuetzt
- 11: Farbe wird in Grau umgewandelt
- 12: -- is registered
-\stopmessages
-
-\startmessages czech library: colors
- title: barva
- 1: system -- je globalne aktivovana
- 2: system -- je lokalne activovana
- 3: -- neni definovana --
- 4: system -- je nacten
- 5: neznamy system --
- 6: palette -- je k dispozici
- 7: palette -- neni k dispozici
- 8: specifikace -- v barve -- bude cerna
- 9: -- prostor barev neni podporovan
- 10: -- prostor barev je podporovan
- 11: barva je prevedena na sed
- 12: -- is registered
-\stopmessages
-
-\startmessages italian library: colors
- title: colore
- 1: sistema -- attivato globalmente
- 2: sistema -- attivato localmente
- 3: -- non definito --
- 4: sistema -- caricato
- 5: sistema -- sconosciuto
- 6: tavolozza -- resa disponibile
- 7: tavolozza -- non disponibile
- 8: specifica -- del colore -- convertita in nero
- 9: spazio dei colori -- non supportato
- 10: spazio dei colori -- supportato
- 11: il colore ø convertito in grigio
- 12: -- is registered
-\stopmessages
-
-\startmessages norwegian library: colors
- title: farge
- 1: system -- er aktivert globalt
- 2: system -- er aktivert lokalt
- 3: -- er udefinert --
- 4: system -- er lest inn
- 5: ukjent system --
- 6: palett -- er tilgjengelig
- 7: palett -- er ikke tilgjengelig
- 8: spesifikasjon -- for farge -- gir kun svart
- 9: -- fargerom er ikke støttet
- 10: -- fargerom er støttet
- 11: fargen vil bli vist som grø
- 12: -- is registered
-\stopmessages
-
-\startmessages romanian library: colors
- title: culori
- 1: sistem -- este activata global
- 2: sistem -- este activata local
- 3: -- nu este definita --
- 4: sistem -- este incarcata
- 5: sistem -- necunoscuta
- 6: paleta -- este disponibila
- 7: palette -- nu este disponibila
- 8: specificatia -- la culoarea -- devine neagra
- 9: spatiul de culoare -- nu este suportat
- 10: spatiul de culoare -- este suportat
- 11: culoarea este convertita la gri
- 12: -- is registered
-\stopmessages
-
-\startmessages french library: colors
- title: couleurs
- 1: le système -- est globalement activé
- 2: le système -- est localement activé
- 3: -- n'est pas défini --
- 4: le système -- est chargé
- 5: système -- inconnu
- 6: la palette -- est disponible
- 7: le palette -- n'est pas disponible
- 8: la spécification -- de la couleur -- devient noire
- 9: l'espace de couleur -- n'est pas supporté
- 10: -- l'espace de couleur est supporté
- 11: la couleur est convertie en niveau de gris
- 12: -- est enregistré
-\stopmessages
-
-\unprotect
-
-\chardef\colorversion=1 % temp, needed for tracing purposes, mkiv transition
-
-%D We use a couple of local registers. That way we don't have
-%D to group when converting colors. By the way, this is not
-%D really faster. We can sqeeze half a second runtime for 50K
-%D switches on a 1G machine, but the macros will become rather
-%D ugly then. To mention one such improvement: no colon
-%D after the key character (.25 sec).
-
-\newdimen\colordimen
-\newcount\colorcount
-
-%D When typesetting for paper, we prefer using the \cap{CMYK}
-%D color space, but for on||screen viewing we prefer \cap{RGB}
-%D (the previous implementation supported only this scheme).
-%D Independant of such specifications, we support some automatic
-%D conversions:
-%D
-%D \startitemize[packed]
-%D \item convert all colors to \cap{RGB}
-%D \item convert all colors to \cap{CMYK}
-%D \item convert all colors to gray scales
-%D \stopitemize
-%D
-%D We also support optimization of colors to gray scales.
-%D
-%D \startitemize[continue]
-%D \item reduce gray colors to gray scales
-%D \item reduce \cap{CMY} components to \cap{K}
-%D \stopitemize
-%D
-%D These options are communicated by means of:
-
-\newif\ifRGBsupported
-\newif\ifCMYKsupported
-\newif\ifSPOTsupported
-\newif\ifpreferGRAY
-\newif\ifGRAYprefered
-\newif\ifreduceCMYK
-\newif\ifconverttoGRAY
-\newif\ifweightGRAY \weightGRAYtrue
-
-\newif\ifconvertMPcolors
-\newif\ifreduceMPcolors
-\newif\ifforcegrayMPcolors
-
-%D The last boolean controls reduction of \cap{CMYK} to
-%D \cap{CMY} colors. When set to true, the black component
-%D is added to the other ones.
-%D
-%D Prefering gray is not the same as converting to gray.
-%D Conversion treats each color components in a different way,
-%D while prefering is just a reduction and thus a
-%D space||saving option.
-
-\newif\iffreezecolors \freezecolorsfalse
-\newif\ifincolor % true if colors enabled
-\newif\iflocalcolor
-
-\let\colorlist \empty
-\let\currentspotcolor \empty
-\let\allspotcolors \empty
-\let\usedspotcolors \empty
-\let\usedcolorchannels\empty
-\let\currentpalet \empty
-
-%D \macros
-%D {definecolor,defineglobalcolor,definenamedcolor,definespotcolor,definemultitonecolor}
-%D
-%D \startbuffer
-%D \definecolor [blue] [c=1,m=.38,y=0,k=.64] % pantone pms 2965 uncoated m
-%D \definecolor [yellow] [c=0,m=.28,y=1,k=.06] % pantone pms 124 uncoated m
-%D
-%D \definespotcolor [blue-100] [blue] [p=1]
-%D \definespotcolor [yellow-100] [yellow] [p=1]
-%D
-%D \definemultitonecolor [pdftoolscolor] [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1]
-%D
-%D \useexternalfigure[demofig][mill.png][object=no]
-%D
-%D \startcombination[4*1]
-%D {\externalfigure[demofig]} {no color}
-%D {\externalfigure[demofig][color=pdftoolscolor]} {indexed duotone}
-%D {\externalfigure[demofig][color=blue-100]} {spot color}
-%D {\externalfigure[demofig][color=yellow-100]} {spot color}
-%D \stopcombination
-%D \stopbuffer
-%D
-%D \getbuffer \typebuffer
-
-\def\definecolor {\dodoubleargument\dodefinecolor}
-\def\defineglobalcolor {\dodoubleargument\dodefineglobalcolor}
-\def\definenamedcolor {\dodoubleargument\dodefinenamedcolor}
-\def\definespotcolor {\dotripleargument\dodefinespotcolor}
-\def\definemultitonecolor{\doquadrupleempty\dodefinemultitonecolor}
-
-% check: registerusedspotcolors
-% check: registerusedcolorchannels
-
-%D \macros
-%D {doifcolorelse, doifcolor}
-%D
-%D Switching to a color is done by means of the following
-%D command. Later on we will explain the use of palets. We
-%D define ourselves a color conditional first.
-
-\ifx\doifcolorelse\undefined
- \let\doifcolorelse\secondoftwoarguments
- \let\doifcolor \gobbleoneargument
-\fi
-
-%D \macros
-%D {localstartcolor,localstopcolor}
-%D
-%D Simple color support, that is without nesting, is provided
-%D by:
-
-\ifx\localstartcolor\undefined
- \let\localstartcolor\undefined
- \let\localstopcolor \undefined
-\fi
-
-%D \macros
-%D {faststartcolor,faststopcolor}
-%D
-%D No checking for arguments and such:
-
-\ifx\faststartcolor\undefined
- \def\faststartcolor[#1]{}
- \def\faststopcolor {}
-\fi
-
-%D These local ones may go away in future versions.
-
-%D \macros
-%D {startcolor,stopcolor}
-%D
-%D The more save method, the one that saves the current color
-%D state and returns to this state afterward, is activated by:
-%D
-%D \showsetup{startcolor}
-
-\ifx\startcolor\undefined
- \let\startcolor\undefined
- \let\stopcolor \undefined
-\fi
-
-%D \macros
-%D {startcurrentcolor,stopcurrentcolor}
-
-\def\startcurrentcolor{\startcolor[\outercolorname]}
-\def\stopcurrentcolor {\stopcolor}
-
-%D \macros
-%D {color,graycolor}
-%D
-%D This leaves the simple color command:
-%D
-%D \showsetup{color}
-%D \showsetup{graycolor}
-
-\ifx\color\undefined
- \def\color [#1]{}
- \def\graycolor[#1]{}
- \def\gray {\graycolor}
-\fi
-
-%D \macros
-%D {localstartraster,localstopraster,
-%D startraster,stopraster,raster}
-%D
-%D The previous conversions are not linear and treat each color
-%D component according to human perception curves. Pure gray
-%D (we call them rasters) has equal color components. In
-%D \CONTEXT\ rasters are only used as backgrounds and these
-%D don't cross page boundaries in the way color does. Therefore
-%D we don't need stacks and marks. Just to be compatible with
-%D color support we offer both 'global' and 'local' commands.
-
-\ifx\startraster\undefined
- \def\startraster [#1]{}
- \def\stopraster {}
- \def\raster [#1]{}
- \def\localstartraster[#1]{}
- \def\localstopraster {}
-\fi
-
-%D \macros
-%D {colorvalue, grayvalue}
-%D
-%D We can typeset the color components using \type{\colorvalue} and
-%D \type{\grayvalue}. The commands:
-%D
-%D \startbuffer
-%D color value of SomeKindOfRed: \colorvalue{SomeKindOfRed} \crlf
-%D gray value of SomeKindOfRed: \grayvalue{SomeKindOfRed}
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D show us:
-%D
-%D \startvoorbeeld
-%D \getbuffer
-%D \stopvoorbeeld
-
-\def\colorformatseparator{ }
-
-\ifx\colorvalue\undefined
- \let\colorvalue\gobbleoneargument
- \let\grayvalue \gobbleoneargument
-\fi
-
-% check: \currentcolorname
-% check: \outercolorname
-
-%D \macros
-%D {setupcolor}
-%D
-%D Color definitions can be grouped in files with the name:
-%D
-%D \starttyping
-%D \f!colorprefix-identifier.tex
-%D \stoptyping
-%D
-%D where \type{\f!colorprefix} is \unprotect {\tttf \f!colorprefix}.
-%D Loading such a file is done by \protect
-%D
-%D \showsetup{setupcolor}
-%D
-%D Some default colors are specified in \type{colo-rgb.tex},
-%D which is loaded into the format by:
-%D
-%D \starttyping
-%D \setupcolor[rgb]
-%D \stoptyping
-
-\let\colorstyle\empty
-
-\def\setupcolor
- {\dosingleargument\dosetupcolor}
-
-\def\dosetupcolor[#1]%
- {\doifnot{#1}\colorstyle
- {\def\colorstyle{#1}%
- \processcommalist[#1]\dodosetupcolor}}
-
-\def\dodosetupcolor#1%
- {\makeshortfilename[\truefilename{\f!colorprefix#1}]%
- \startreadingfile
- \readsysfile\shortfilename
- {\showmessage\m!colors4\colorstyle}
- {\showmessage\m!colors5\colorstyle}%
- \stopreadingfile}
-
-\let\usecolors\setupcolor
-
-% check: \chardef\currentcolorchannel=0
-% check: \startcolormode
-% check: \newif\iffilterspotcolor \filterspotcolorfalse
-% check: \newif\ifdoingspotcolor \doingspotcolorfalse
-% check: \registercolorchannel
-
-%D \macros
-%D {definetransparency}
-%D
-%D This command numbers to names:
-
-\def\definetransparency
- {\dodoubleargument\dodefinetransparency}
-
-\def\setupcolors
- {\dosingleargument\dosetupcolors}
-
-\def\resetcolorsplitting
- {\chardef\currentcolorchannel\zerocount
- \let\currentspotcolor\empty
- \filterspotcolorfalse}
-
-\def\colorsplitsuffix{\ifcase\currentcolorchannel\else-\@@clsplit\fi}
-\def\colorsplitprefix{\ifcase\currentcolorchannel\else\@@clsplit-\fi}
-
-\def\setcolorsplitting
- {\resetsystemmode{\v!color\colorsplitsuffix}%
- \resetcolorsplitting
- \processaction
- [\@@clsplit]
- [ c=>\chardef\currentcolorchannel1,%
- m=>\chardef\currentcolorchannel2,%
- y=>\chardef\currentcolorchannel3,%
- k=>\chardef\currentcolorchannel4,%
- r=>\chardef\currentcolorchannel5,%
- g=>\chardef\currentcolorchannel6,%
- b=>\chardef\currentcolorchannel7,%
- s=>\chardef\currentcolorchannel8,%
- \v!no=>,% \currentcolorchannel0,% all colors
- \s!default=>,% \currentcolorchannel0,% all colors
- \s!unknown=>\filterspotcolortrue
- \edef\currentspotcolor{\commalistelement}]%
- \setsystemmode{\v!color\colorsplitsuffix}%
- \iffilterspotcolor \let\@@clrgb\v!no \fi}
-
-\ifx\dosetupcolormodel\undefined
- \let\dosetupcolormodel\relax
-\fi
-
-\def\dosetupcolors[#1]% some no longer make sense in MkIV
- {\getparameters[\??cl][#1]%
- \doifelse\@@clspot\v!yes
- \SPOTsupportedtrue
- \SPOTsupportedfalse
- \doifelsenothing\@@clsplit
- \resetcolorsplitting
- \setcolorsplitting
- \doifelse\@@clreduction\v!yes
- \reduceCMYKtrue
- \reduceCMYKfalse
- \doifelse\@@clexpansion\v!yes
- \freezecolorstrue
- \freezecolorsfalse
- \doifelse\@@clcriterium\v!all
- \hidesplitcolortrue
- \hidesplitcolorfalse
- \doifelse\@@clrgb\v!no
- {\ifRGBsupported \showmessage\m!colors {9}\v!rgb\RGBsupportedfalse\fi}
- {\ifRGBsupported\else\showmessage\m!colors{10}\v!rgb\RGBsupportedtrue \fi}%
- \doifelse\@@clcmyk\v!no
- {\ifCMYKsupported \showmessage\m!colors {9}\v!cmyk\CMYKsupportedfalse\fi}
- {\ifCMYKsupported\else\showmessage\m!colors{10}\v!cmyk\CMYKsupportedtrue \fi}%
- \doifelse\@@clmpcmyk\v!no
- {\ifMPcmykcolors \showmessage\m!colors {9}{\v!mp\v!cmyk}\MPcmykcolorsfalse\fi}
- {\ifMPcmykcolors\else\showmessage\m!colors{10}{\v!mp\v!cmyk}\MPcmykcolorstrue \fi}%
- \doifelse\@@clmpspot\v!no
- {\ifMPspotcolors \showmessage\m!colors {9}{\v!mp\v!spot}\MPspotcolorsfalse\fi}
- {\ifMPspotcolors\else\showmessage\m!colors{10}{\v!mp\v!spot}\MPspotcolorstrue \fi}%
- \preferGRAYfalse
- \processaction
- [\@@clconversion]
- [ \v!yes=>\preferGRAYtrue,
- \v!always=>\preferGRAYtrue\RGBsupportedfalse\CMYKsupportedfalse]%
- \ifRGBsupported
- \converttoGRAYfalse
- \forcegrayMPcolorsfalse
- \else\ifCMYKsupported
- \converttoGRAYfalse
- \forcegrayMPcolorsfalse
- \convertMPcolorstrue
- \ifreduceCMYK
- \reduceMPcolorstrue
- \fi
- \else
- \ifconverttoGRAY\else\showmessage\m!colors{11}\empty\fi
- \converttoGRAYtrue
- \forcegrayMPcolorstrue
- \convertMPcolorsfalse
- \reduceMPcolorsfalse
- \fi\fi
- \processaction
- [\@@clstate]
- [ \v!global=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
- \incolortrue\localcolorfalse,
- \v!local=>\ifincolor\else\showmessage\m!colors2\colorstyle\fi
- \incolortrue\localcolortrue,
- \v!start=>\ifincolor\else\showmessage\m!colors1\colorstyle\fi
- \incolortrue\localcolorfalse
- \let\@@clstate\v!global,
- \v!stop=>\incolorfalse\localcolorfalse
- \forcegrayMPcolorstrue]%
- \dosetupcolormodel
- \initializemaintextcolor}
-
-%D \macros
-%D {startregistercolor,stopregistercolor,permitcolormode}
-%D
-%D If you only want to register a color, the switch \type
-%D {\ifpermitcolormode} can be used. That way the nested
-%D colors know where to go back to.
-
-\ifx\startregistercolor\undefined
- \def\startregistercolor[#1]{}
- \def\stopregistercolor {}
-\fi
-
-%D We use these macros for implementing text colors
-%D (actually, the first application was in foreground
-%D colors).
-%D
-%D \starttyping
-%D \starttextcolor[red]
-%D \dorecurse{10}{\input tufte \color[green]{oeps} \par}
-%D \stoptextcolor
-%D \stoptyping
-%D
-%D This is more efficient than the alternative:
-%D
-%D \starttyping
-%D \setupbackgrounds[text][foregroundcolor=red]
-%D \startregistercolor[red]
-%D \dorecurse{10}{\input tufte \color[green]{oeps} \par}
-%D \stopregistercolor
-%D \stoptyping
-
-\def\maintextcolor {}
-\def\defaulttextcolor {black}
-\def\@@themaintextcolor{themaintextcolor}
-
-\ifx\initializemaintextcolor\undefined
- \def\starttextcolor [#1]{}
- \def\stoptextcolor {}
- \def\initializemaintextcolor {}
-\fi
-
-\ifx\restoretextcolor\undefined % to be redone
- \let\restoretextcolor \firstofoneargument
- \let\localstarttextcolor\relax
- \let\localstoptextcolor \relax
-\fi
-
-%D In this documentation we will not go into too much details
-%D on palets. Curious users can find more information on this
-%D topic in \from[use of color].
-%D
-%D At the moment we implemented color in \CONTEXT\ color
-%D printing was not yet on the desktop. In spite of this lack our
-%D graphics designer made colorfull illustrations. When printed
-%D on a black and white printer, distinctive colors can come
-%D out equally gray. We therefore decided to use only colors
-%D that were distinctive in colors as well as in black and
-%D white print.
-%D
-%D Although none of the graphic packages we used supported
-%D logical colors and global color redefition, we build this
-%D support into \CONTEXT. This enabled us to experiment and
-%D also prepared us for the future.
-
-%D \macros
-%D {definepalet}
-%D
-%D Colors are grouped in palets. The colors in such a palet can
-%D have colorful names, but best is to use names that specify
-%D their use, like {\em important} or {\em danger}. As a sort
-%D of example \CONTEXT\ has some palets predefined,
-%D like:\footnote{At the time I wrote the palet support, I was
-%D reading 'A hort history of time' of S.~Hawkins, so that's
-%D why we stuck to quarks.}
-%D
-%D \starttyping
-%D \definepalet
-%D [alfa]
-%D [ top=rood:7,
-%D bottom=groen:6,
-%D up=blauw:5,
-%D down=cyaan:4,
-%D strange=magenta:3,
-%D charm=geel:2]
-%D \stoptyping
-%D
-%D It's formal definition is:
-%D
-%D \showsetup{definepalet}
-%D
-%D Visualized, such a palet looks like:
-%D
-%D \startbuffer[palet]
-%D \showpalet [alfa] [horizontal,name,number,value]
-%D \stopbuffer
-%D
-%D \startlinecorrection
-%D \getbuffer[palet]
-%D \stoplinecorrection
-%D
-%D This bar shows both the color and gray alternatives of the
-%D palet components (not visible in black and white print).
-%D
-%D When needed, one can copy a palet by saying:
-%D
-%D \starttyping
-%D \definepalet [TEXcolorpretty] [colorpretty]
-%D \stoptyping
-%D
-%D This saves us some typing in for instance the modules that
-%D deal with pretty verbatim typesetting.
-
-\def\definepalet
- {\dodoubleargument\dodefinepalet}
-
-\def\dodefinepalet[#1][#2]%
- {\doifassignmentelse{#2}
- {%\showmessage\m!colors6{#1}%
- \letvalue{\??pa#1}\empty
- \setevalue{\??pa\??pa#1}{#2}%
- \def\dodododefinepalet[##1=##2]%
- {\doifvaluesomething{\??pa#1}
- {\setevalue{\??pa#1}{\csname\??pa#1\endcsname,}}%
- \setevalue{\??pa#1}{\csname\??pa#1\endcsname##1}%
- \dodefinepaletcolor{#1}{##1}{##2}}%
- \def\dododefinepalet##1%
- {\dodododefinepalet[##1]}%
- \processcommalist[#2]\dododefinepalet}
- {\doifdefined{\??pa#2}
- {\expanded{\dodefinepalet[#1][\csname\??pa\??pa#2\endcsname]}}}}
-
-\ifx\dodefinepaletcolor\undefined
- \let\dodefinepaletcolor\gobblethreearguments
-\fi
-
-\let\paletsize\!!zerocount
-
-\def\getpaletsize[#1]%
- {\getcommacommandsize[\csname\??pa\??pa#1\endcsname]%
- \edef\paletsize{\number\commalistsize}}
-
-%D Instead of refering to colors, one can also directly specify
-%D a color:
-%D
-%D \starttyping
-%D \definepalet[test][xx=green]
-%D \definepalet[test][xx={y=.4}]
-%D \stoptyping
-
-%D \macros
-%D {setuppalet}
-%D
-%D Colors are taken from the current palet, if defined.
-%D Setting the current palet is done by:
-%D
-%D \showsetup{setuppalet}
-
-\let\currentpalet\empty
-
-\def\setuppalet
- {\dosingleempty\dosetuppalet}
-
-\def\dosetuppalet[#1]%
- {\edef\currentpalet{#1}%
- \ifx\currentpalet\empty
- % seems to be a reset
- \else\ifcsname\??pa\currentpalet\endcsname
- \edef\currentpalet{#1:}%
- \else
- \showmessage\m!colors7\currentpalet
- \let\currentpalet\empty
- \fi\fi}
-
-%D \macros
-%D {showpalet}
-%D
-%D The previous visualization was typeset with:
-%D
-%D \typebuffer[palet]
-%D
-%D This commands is defined as:
-%D
-%D \showsetup{showpalet}
-
-\fetchruntimecommand \showpalet {\f!colorprefix\s!run}
-
-%D \macros
-%D {showcolorcomponents}
-%D
-%D \starttyping
-%D \showcolorcomponents[color-1,color-2]
-%D \stoptyping
-
-\fetchruntimecommand \showcolorcomponents {\f!colorprefix\s!run}
-
-%D \macros
-%D {definecolorgroup}
-%D
-%D The naming of the colors in this palet suggests some
-%D ordening, which in turn is suported by color grouping.
-%D
-%D \starttyping
-%D \definecolorgroup
-%D [red]
-%D [1.00:0.90:0.90,
-%D 1.00:0.80:0.80,
-%D 1.00:0.70:0.70,
-%D 1.00:0.55:0.55,
-%D 1.00:0.40:0.40,
-%D 1.00:0.25:0.25,
-%D 1.00:0.15:0.15,
-%D 0.90:0.00:0.00]
-%D \stoptyping
-%D
-%D In such a color group colors are numbered from~$1$ to~$n$.
-%D
-%D \showsetup{definecolorgroup}
-%D
-%D This kind of specification is not only more compact than
-%D defining each color separate, it also loads faster and takes
-%D less bytes.
-
-\def\definecolorgroup
- {\dotripleempty\dodefinecolorgroup}
-
-\def\dododefinecolorgroupgray [#1][#2:#3]{\definecolor [#1:\the\colorcount][s=#2]}
-\def\dododefinecolorgrouprgb [#1][#2:#3:#4:#5]{\definecolor [#1:\the\colorcount][r=#2,g=#3,b=#4]}
-\def\dododefinecolorgroupcmyk[#1][#2:#3:#4:#5:#6]{\definecolor [#1:\the\colorcount][c=#2,m=#3=,y=#4,k=#5]}
-\def\dododefinecolorgroupspot [#1][#2:#3:#4]{\definespotolor[#1:\the\colorcount][#2][p=#3]}
-
-\def\dododefinecolorgroup#1#2%
- {\advance\colorcount\plusone
- \getvalue{dododefinecolorgroup\currentcolorspace}[#1][#2:0:0:0:0]}
-
-\def\dodefinecolorgroup[#1][#2][#3]% obsolete, just use palets
- {\ifthirdargument
- \doifelsenothing{#2}{\let\currentcolorspace\v!rgb}{\def\currentcolorspace{#2}}%
- \colorcount\zerocount
- \processcommalist[#3]{\dododefinecolorgroup{#1}}%
- \else
- \doifinstringelse{:}{#2}
- {\definecolorgroup[#1][\v!rgb][#2]}
- {\doloop
- {\doifdefinedelse{\??cr#2:\recurselevel}
- {\setevalue{\??cr#1:\recurselevel}{\csname\??cr#2:\recurselevel\endcsname}}
- {\exitloop}}}%
- \fi}
-
-%D \macros
-%D {showcolorgroup}
-%D
-%D We can show the group by:
-%D
-%D \startbuffer
-%D \showcolorgroup [blue] [horizontal,name,number,value]
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D or in color:
-%D
-%D \startlinecorrection
-%D \getbuffer
-%D \stoplinecorrection
-%D
-%D which uses:
-%D
-%D \showsetup{showcolorgroup}
-
-\fetchruntimecommand \showcolorgroup {\f!colorprefix\s!run}
-
-%D There are ten predefined color groups, like
-%D \color[green]{\em groen}, \color[red]{\em rood},
-%D \color[blue]{\em blauw}, \color[cyan]{\em cyaan},
-%D \color[magenta]{\em magenta} and \color[yellow]{\em geel}.
-%D
-%D \startlinecorrection
-%D \hbox to \hsize
-%D {\hss
-%D \showcolorgroup [red] [vertical,name,number]\hss
-%D \showcolorgroup [green] [vertical,name]\hss
-%D \showcolorgroup [blue] [vertical,name]\hss
-%D \showcolorgroup [cyan] [vertical,name]\hss
-%D \showcolorgroup [magenta][vertical,name]\hss
-%D \showcolorgroup [yellow] [vertical,name]\hss}
-%D \stoplinecorrection
-%D
-%D These groups are used to define palets {\em alfa} upto {\em
-%D zeta}. As long as we don't use colors from the same row, we
-%D get ourselves distinctive palets. By activating such a palet
-%D one gains access to its members {\em top} to {\em charm} (of
-%D course one should use more suitable names than these).
-%D
-%D \startlinecorrection
-%D \hbox to \hsize
-%D {\showpalet [alfa] [vertical,name,number]\hss
-%D \showpalet [beta] [vertical,name]\hss
-%D \showpalet [gamma] [vertical,name]\hss
-%D \showpalet [delta] [vertical,name]\hss
-%D \showpalet [epsilon] [vertical,name]\hss
-%D \showpalet [zeta] [vertical,name]}
-%D \stoplinecorrection
-%D
-%D By using the keyword \type {value} the individual color
-%D components are shown too. When printed in color, these
-%D showcases show both the colors and the gray value.
-
-%D \macros
-%D {comparepalet}
-%D
-%D There are some more testing macros available:
-%D
-%D \startbuffer
-%D \comparepalet [alfa]
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D shows the palet colors against a background:
-%D
-%D \startlinecorrection
-%D \getbuffer
-%D \stoplinecorrection
-%D
-%D The formal definition is:
-%D
-%D \showsetup{comparepalet}
-
-\fetchruntimecommand \comparepalet {\f!colorprefix\s!run}
-
-%D \macros
-%D {comparecolorgroup}
-%D
-%D The similar command:
-%D
-%D \startbuffer
-%D \comparecolorgroup [blue]
-%D \stopbuffer
-%D
-%D \typebuffer
-%D
-%D shows color groups:
-%D
-%D \startlinecorrection
-%D \getbuffer
-%D \stoplinecorrection
-%D
-%D this commands are defined as:
-%D
-%D \showsetup{comparecolorgroup}
-
-\fetchruntimecommand \comparecolorgroup {\f!colorprefix\s!run}
-
-%D \macros
-%D {showcolor}
-%D
-%D But let's not forget that we also have the more traditional
-%D non||related colors. These show up after:
-%D
-%D \starttyping
-%D \showcolor [name]
-%D \stoptyping
-%D
-%D Where \type{name} for instance can be \type{rgb}.
-%D
-%D \showsetup{showcolor}
-
-\fetchruntimecommand \showcolor {\f!colorprefix\s!run}
-
-%D It would make sense to put the following code in \type
-%D {colo-mps}, but it it rather low level.
-
-%D \macros
-%D {negatecolorcomponent,negatedcolorcomponent}
-%D
-%D These speak for themselves. See \type {colo-ext} for usage.
-
-\def\negatecolorcomponent#1% #1 = \macro
- {\scratchdimen\onepoint\advance\scratchdimen-#1\onepoint
- \ifdim\scratchdimen<\zeropoint\scratchdimen\zeropoint\fi
- \edef#1{\withoutpt\the\scratchdimen}}
-
-\let\negatedcolorcomponent\firstofoneargument
-
-\def\negatedcolorcomponent#1%
- {\ifdim\dimexpr\onepoint-#1\onepoint\relax<\zeropoint
- \!!zerocount
- \else
- \expandafter\withoutpt\the\dimexpr\onepoint-#1\onepoint\relax
- \fi}
-
-\def\negatecolorcomponent#1% #1 = \macro
- {\edef#1{\negatedcolorcomponent{#1}}}
-
-%D \macros
-%D {ifMPgraphics, ifMPcmykcolors, MPcolor}
-%D
-%D A very special macro is \type{\MPcolor}. This one can be
-%D used to pass a \CONTEXT\ color to \METAPOST.
-%D
-%D \starttyping
-%D \MPcolor{my own red}
-%D \stoptyping
-%D
-%D This macro returns a \METAPOST\ triplet \type{(R,G,B)}.
-%D Unless \CMYK\ color support is turned on with \type
-%D {MPcmyk}, only \cap{RGB} colors and gray scales are
-%D supported.
-
-\newif\ifMPcmykcolors % \MPcmykcolorsfalse
-\newif\ifMPspotcolors % \MPspotcolorsfalse
-
-\ifx\MPcolor\undefined
- \def\MPcolor#1{(0,0,0)}
-\fi
-
-%D \macros
-%D {PDFcolor,FDFcolor}
-%D
-%D Similar alternatives are avaliable for \PDF:
-
-%D For the moment we keep the next downward compatibility
-%D switch, i.e.\ expanded colors. However, predefined colors
-%D and palets are no longer expanded (which is what I wanted
-%D in the first place).
-%D
-%D Well, in case we want to do color separation and use CMYK
-%D colors only, this is dangerous since unwanted remapping may
-%D take place. Especially when we redefine already defined
-%D colors in another color space (e.g. darkgreen is
-%D predefined in RGB color space, so a redefinition in CMYK
-%D coordinates before RGB mode is disabled, would give
-%D unexpected results due to the already frozen color spec.)
-%D
-%D So, from now on, colors are not frozen any more!
-
-% \appendtoks\setupcolors[\c!expansie=\v!ja]\to\everyjob
-
-\chardef\currentcolorchannel=0
-
-\newif\iffilterspotcolor \filterspotcolorfalse
-\newif\ifdoingspotcolor \doingspotcolorfalse
-
-\def\registercolorchannel#1%
- {\ifdoingspotcolor \else
- \global\expandafter\chardef\csname\??cs#1\endcsname\zerocount
- \fi}
-
-\newif\ifhidesplitcolor \hidesplitcolortrue
-
-%D The next macro is for instance used in figure splitting:
-
-\def\doifseparatingcolorselse
- {\iffilterspotcolor
- \@EA\firstoftwoarguments
- \else\ifcase\currentcolorchannel
- \@EAEAEA\secondoftwoarguments
- \else
- \@EAEAEA\firstoftwoarguments
- \fi\fi}
-
-\def\doifcolorchannelelse#1%
- {\doifseparatingcolorselse
- {\doifelsenothing{#1}
- \secondoftwoarguments
- {\doifelse{#1}\@@clsplit
- \firstoftwoarguments
- \secondoftwoarguments}}
- \secondoftwoarguments}
-
-\def\resetcolorseparation
- {\filterspotcolorfalse
- \chardef\currentcolorchannel\zerocount}
-
-%D These can be used in selecting specific files (like
-%D figuredatabases).
-
-% we already have:
-%
-% \def\colorsplitsuffix{\ifcase\currentcolorchannel\else-\@@clsplitsen\fi}
-% \def\colorsplitprefix{\ifcase\currentcolorchannel\else\@@clsplitsen-\fi}
-
-\def\colorchannelprefix{\doifseparatingcolorselse\@@clsplit\empty-}
-\def\colorchannelsuffix{-\doifseparatingcolorselse\@@clsplit\empty}
-
-%D We now load the low level macros:
-
-\loadmarkfile{colo-new}
-
-%D We default to the colors defined in \module{colo-rgb} and
-%D support both \cap{RGB} and \cap{CMYK} output. As you can
-%D see, color support is turned off by default. Reduction of
-%D gray colors to gray scales is turned on.
-
-\definecolor[black][s=0]
-\definecolor[white][s=1]
-
-\definetransparency [none] [0]
-\definetransparency [normal] [1]
-\definetransparency [multiply] [2]
-\definetransparency [screen] [3]
-\definetransparency [overlay] [4]
-\definetransparency [softlight] [5]
-\definetransparency [hardlight] [6]
-\definetransparency [colordodge] [7]
-\definetransparency [colorburn] [8]
-\definetransparency [darken] [9]
-\definetransparency [lighten] [10]
-\definetransparency [difference] [11]
-\definetransparency [exclusion] [12]
-
-\setupcolors
- [\c!state=\v!stop,
- \c!conversion=\v!yes,
- \c!reduction=\v!no,
- \c!rgb=\v!yes,
- \c!cmyk=\v!yes,
- \c!spot=\v!yes,
- \c!mp\c!cmyk=\@@clcmyk,
- \c!mp\c!spot=\@@clspot,
- \c!expansion=\v!no,
- \c!textcolor=,
- \c!split=\v!no,
- \c!criterium=\v!all]
-
-\setupcolor
- [\v!rgb]
-
-\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/colo-x11.tex b/Master/texmf-dist/tex/context/base/colo-x11.tex
new file mode 100644
index 00000000000..45d3aac6248
--- /dev/null
+++ b/Master/texmf-dist/tex/context/base/colo-x11.tex
@@ -0,0 +1,677 @@
+%D \module
+%D [ file=colo-x11,
+%D version=2009.11.13,
+%D title=\CONTEXT\ Color Macros,
+%D subtitle=X11,
+%D author=Alan Braslau]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D Standard X11 rgb colors (from \type {/usr/share/X11/rgb.txt}):
+
+\doifnotmode{mkiv} {
+ \input colo-hex.mkii
+}
+
+\definecolor [snow] [h=fffafa]
+\definecolor [ghostwhite] [h=f8f8ff]
+\definecolor [whitesmoke] [s=0.96]
+\definecolor [gainsboro] [s=0.86]
+\definecolor [floralwhite] [h=fffaf0]
+\definecolor [oldlace] [h=fdf5e6]
+\definecolor [linen] [h=faf0e6]
+\definecolor [antiquewhite] [h=faebd7]
+\definecolor [papayawhip] [h=ffefd5]
+\definecolor [blanchedalmond] [h=ffebcd]
+\definecolor [bisque] [h=ffe4c4]
+\definecolor [peachpuff] [h=ffdab9]
+\definecolor [navajowhite] [h=ffdead]
+\definecolor [moccasin] [h=ffe4b5]
+\definecolor [cornsilk] [h=fff8dc]
+\definecolor [ivory] [h=fffff0]
+\definecolor [lemonchiffon] [h=fffacd]
+\definecolor [seashell] [h=fff5ee]
+\definecolor [honeydew] [h=f0fff0]
+\definecolor [mintcream] [h=f5fffa]
+\definecolor [azure] [h=f0ffff]
+\definecolor [aliceblue] [h=f0f8ff]
+\definecolor [lavender] [h=e6e6fa]
+\definecolor [lavenderblush] [h=fff0f5]
+\definecolor [mistyrose] [h=ffe4e1]
+\definecolor [white] [s=1]
+\definecolor [black] [s=0]
+\definecolor [darkslategray] [h=2f4f4f]
+\definecolor [darkslategrey] [darkslategray]
+\definecolor [dimgray] [s=0.41]
+\definecolor [dimgrey] [dimgray]
+\definecolor [slategray] [h=708090]
+\definecolor [slategrey] [slategray]
+\definecolor [lightslategray] [h=778899]
+\definecolor [lightslategrey] [lightslategray]
+\definecolor [gray] [s=0.75]
+\definecolor [grey] [gray]
+\definecolor [lightgrey] [s=0.83]
+\definecolor [lightgray] [lightgrey]
+\definecolor [midnightblue] [h=191970]
+\definecolor [navy] [h=000080]
+\definecolor [navyblue] [navy]
+\definecolor [cornflowerblue] [h=6495ed]
+\definecolor [darkslateblue] [h=483d8b]
+\definecolor [slateblue] [h=6a5acd]
+\definecolor [mediumslateblue] [h=7b68ee]
+\definecolor [lightslateblue] [h=8470ff]
+\definecolor [mediumblue] [h=0000cd]
+\definecolor [royalblue] [h=4169e1]
+\definecolor [blue] [h=0000ff]
+\definecolor [dodgerblue] [h=1e90ff]
+\definecolor [deepskyblue] [h=00bfff]
+\definecolor [skyblue] [h=87ceeb]
+\definecolor [lightskyblue] [h=87cefa]
+\definecolor [steelblue] [h=4682b4]
+\definecolor [lightsteelblue] [h=b0c4de]
+\definecolor [lightblue] [h=add8e6]
+\definecolor [powderblue] [h=b0e0e6]
+\definecolor [paleturquoise] [h=afeeee]
+\definecolor [darkturquoise] [h=00ced1]
+\definecolor [mediumturquoise] [h=48d1cc]
+\definecolor [turquoise] [h=40e0d0]
+\definecolor [cyan] [h=00ffff]
+\definecolor [lightcyan] [h=e0ffff]
+\definecolor [cadetblue] [h=5f9ea0]
+\definecolor [mediumaquamarine] [h=66cdaa]
+\definecolor [aquamarine] [h=7fffd4]
+\definecolor [darkgreen] [h=006400]
+\definecolor [darkolivegreen] [h=556b2f]
+\definecolor [darkseagreen] [h=8fbc8f]
+\definecolor [seagreen] [h=2e8b57]
+\definecolor [mediumseagreen] [h=3cb371]
+\definecolor [lightseagreen] [h=20b2aa]
+\definecolor [palegreen] [h=98fb98]
+\definecolor [springgreen] [h=00ff7f]
+\definecolor [lawngreen] [h=7cfc00]
+\definecolor [green] [h=00ff00]
+\definecolor [chartreuse] [h=7fff00]
+\definecolor [mediumspringgreen] [h=00fa9a]
+\definecolor [greenyellow] [h=adff2f]
+\definecolor [limegreen] [h=32cd32]
+\definecolor [yellowgreen] [h=9acd32]
+\definecolor [forestgreen] [h=228b22]
+\definecolor [olivedrab] [h=6b8e23]
+\definecolor [darkkhaki] [h=bdb76b]
+\definecolor [khaki] [h=f0e68c]
+\definecolor [palegoldenrod] [h=eee8aa]
+\definecolor [lightgoldenrodyellow] [h=fafad2]
+\definecolor [lightyellow] [h=ffffe0]
+\definecolor [yellow] [h=ffff00]
+\definecolor [gold] [h=ffd700]
+\definecolor [lightgoldenrod] [h=eedd82]
+\definecolor [goldenrod] [h=daa520]
+\definecolor [darkgoldenrod] [h=b8860b]
+\definecolor [rosybrown] [h=bc8f8f]
+\definecolor [indianred] [h=cd5c5c]
+\definecolor [saddlebrown] [h=8b4513]
+\definecolor [sienna] [h=a0522d]
+\definecolor [peru] [h=cd853f]
+\definecolor [burlywood] [h=deb887]
+\definecolor [beige] [h=f5f5dc]
+\definecolor [wheat] [h=f5deb3]
+\definecolor [sandybrown] [h=f4a460]
+\definecolor [tan] [h=d2b48c]
+\definecolor [chocolate] [h=d2691e]
+\definecolor [firebrick] [h=b22222]
+\definecolor [brown] [h=a52a2a]
+\definecolor [darksalmon] [h=e9967a]
+\definecolor [salmon] [h=fa8072]
+\definecolor [lightsalmon] [h=ffa07a]
+\definecolor [orange] [h=ffa500]
+\definecolor [darkorange] [h=ff8c00]
+\definecolor [coral] [h=ff7f50]
+\definecolor [lightcoral] [h=f08080]
+\definecolor [tomato] [h=ff6347]
+\definecolor [orangered] [h=ff4500]
+\definecolor [red] [h=ff0000]
+\definecolor [hotpink] [h=ff69b4]
+\definecolor [deeppink] [h=ff1493]
+\definecolor [pink] [h=ffc0cb]
+\definecolor [lightpink] [h=ffb6c1]
+\definecolor [palevioletred] [h=db7093]
+\definecolor [maroon] [h=b03060]
+\definecolor [mediumvioletred] [h=c71585]
+\definecolor [violetred] [h=d02090]
+\definecolor [magenta] [h=ff00ff]
+\definecolor [violet] [h=ee82ee]
+\definecolor [plum] [h=dda0dd]
+\definecolor [orchid] [h=da70d6]
+\definecolor [mediumorchid] [h=ba55d3]
+\definecolor [darkorchid] [h=9932cc]
+\definecolor [darkviolet] [h=9400d3]
+\definecolor [blueviolet] [h=8a2be2]
+\definecolor [purple] [h=a020f0]
+\definecolor [mediumpurple] [h=9370db]
+\definecolor [thistle] [h=d8bfd8]
+\definecolor [snow1] [h=fffafa]
+\definecolor [snow2] [h=eee9e9]
+\definecolor [snow3] [h=cdc9c9]
+\definecolor [snow4] [h=8b8989]
+\definecolor [seashell1] [h=fff5ee]
+\definecolor [seashell2] [h=eee5de]
+\definecolor [seashell3] [h=cdc5bf]
+\definecolor [seashell4] [h=8b8682]
+\definecolor [antiquewhite1] [h=ffefdb]
+\definecolor [antiquewhite2] [h=eedfcc]
+\definecolor [antiquewhite3] [h=cdc0b0]
+\definecolor [antiquewhite4] [h=8b8378]
+\definecolor [bisque1] [h=ffe4c4]
+\definecolor [bisque2] [h=eed5b7]
+\definecolor [bisque3] [h=cdb79e]
+\definecolor [bisque4] [h=8b7d6b]
+\definecolor [peachpuff1] [h=ffdab9]
+\definecolor [peachpuff2] [h=eecbad]
+\definecolor [peachpuff3] [h=cdaf95]
+\definecolor [peachpuff4] [h=8b7765]
+\definecolor [navajowhite1] [h=ffdead]
+\definecolor [navajowhite2] [h=eecfa1]
+\definecolor [navajowhite3] [h=cdb38b]
+\definecolor [navajowhite4] [h=8b795e]
+\definecolor [lemonchiffon1] [h=fffacd]
+\definecolor [lemonchiffon2] [h=eee9bf]
+\definecolor [lemonchiffon3] [h=cdc9a5]
+\definecolor [lemonchiffon4] [h=8b8970]
+\definecolor [cornsilk1] [h=fff8dc]
+\definecolor [cornsilk2] [h=eee8cd]
+\definecolor [cornsilk3] [h=cdc8b1]
+\definecolor [cornsilk4] [h=8b8878]
+\definecolor [ivory1] [h=fffff0]
+\definecolor [ivory2] [h=eeeee0]
+\definecolor [ivory3] [h=cdcdc1]
+\definecolor [ivory4] [h=8b8b83]
+\definecolor [honeydew1] [h=f0fff0]
+\definecolor [honeydew2] [h=e0eee0]
+\definecolor [honeydew3] [h=c1cdc1]
+\definecolor [honeydew4] [h=838b83]
+\definecolor [lavenderblush1] [h=fff0f5]
+\definecolor [lavenderblush2] [h=eee0e5]
+\definecolor [lavenderblush3] [h=cdc1c5]
+\definecolor [lavenderblush4] [h=8b8386]
+\definecolor [mistyrose1] [h=ffe4e1]
+\definecolor [mistyrose2] [h=eed5d2]
+\definecolor [mistyrose3] [h=cdb7b5]
+\definecolor [mistyrose4] [h=8b7d7b]
+\definecolor [azure1] [h=f0ffff]
+\definecolor [azure2] [h=e0eeee]
+\definecolor [azure3] [h=c1cdcd]
+\definecolor [azure4] [h=838b8b]
+\definecolor [slateblue1] [h=836fff]
+\definecolor [slateblue2] [h=7a67ee]
+\definecolor [slateblue3] [h=6959cd]
+\definecolor [slateblue4] [h=473c8b]
+\definecolor [royalblue1] [h=4876ff]
+\definecolor [royalblue2] [h=436eee]
+\definecolor [royalblue3] [h=3a5fcd]
+\definecolor [royalblue4] [h=27408b]
+\definecolor [blue1] [h=0000ff]
+\definecolor [blue2] [h=0000ee]
+\definecolor [blue3] [h=0000cd]
+\definecolor [blue4] [h=00008b]
+\definecolor [dodgerblue1] [h=1e90ff]
+\definecolor [dodgerblue2] [h=1c86ee]
+\definecolor [dodgerblue3] [h=1874cd]
+\definecolor [dodgerblue4] [h=104e8b]
+\definecolor [steelblue1] [h=63b8ff]
+\definecolor [steelblue2] [h=5cacee]
+\definecolor [steelblue3] [h=4f94cd]
+\definecolor [steelblue4] [h=36648b]
+\definecolor [deepskyblue1] [h=00bfff]
+\definecolor [deepskyblue2] [h=00b2ee]
+\definecolor [deepskyblue3] [h=009acd]
+\definecolor [deepskyblue4] [h=00688b]
+\definecolor [skyblue1] [h=87ceff]
+\definecolor [skyblue2] [h=7ec0ee]
+\definecolor [skyblue3] [h=6ca6cd]
+\definecolor [skyblue4] [h=4a708b]
+\definecolor [lightskyblue1] [h=b0e2ff]
+\definecolor [lightskyblue2] [h=a4d3ee]
+\definecolor [lightskyblue3] [h=8db6cd]
+\definecolor [lightskyblue4] [h=607b8b]
+\definecolor [slategray1] [h=c6e2ff]
+\definecolor [slategray2] [h=b9d3ee]
+\definecolor [slategray3] [h=9fb6cd]
+\definecolor [slategray4] [h=6c7b8b]
+\definecolor [lightsteelblue1] [h=cae1ff]
+\definecolor [lightsteelblue2] [h=bcd2ee]
+\definecolor [lightsteelblue3] [h=a2b5cd]
+\definecolor [lightsteelblue4] [h=6e7b8b]
+\definecolor [lightblue1] [h=bfefff]
+\definecolor [lightblue2] [h=b2dfee]
+\definecolor [lightblue3] [h=9ac0cd]
+\definecolor [lightblue4] [h=68838b]
+\definecolor [lightcyan1] [h=e0ffff]
+\definecolor [lightcyan2] [h=d1eeee]
+\definecolor [lightcyan3] [h=b4cdcd]
+\definecolor [lightcyan4] [h=7a8b8b]
+\definecolor [paleturquoise1] [h=bbffff]
+\definecolor [paleturquoise2] [h=aeeeee]
+\definecolor [paleturquoise3] [h=96cdcd]
+\definecolor [paleturquoise4] [h=668b8b]
+\definecolor [cadetblue1] [h=98f5ff]
+\definecolor [cadetblue2] [h=8ee5ee]
+\definecolor [cadetblue3] [h=7ac5cd]
+\definecolor [cadetblue4] [h=53868b]
+\definecolor [turquoise1] [h=00f5ff]
+\definecolor [turquoise2] [h=00e5ee]
+\definecolor [turquoise3] [h=00c5cd]
+\definecolor [turquoise4] [h=00868b]
+\definecolor [cyan1] [h=00ffff]
+\definecolor [cyan2] [h=00eeee]
+\definecolor [cyan3] [h=00cdcd]
+\definecolor [cyan4] [h=008b8b]
+\definecolor [darkslategray1] [h=97ffff]
+\definecolor [darkslategray2] [h=8deeee]
+\definecolor [darkslategray3] [h=79cdcd]
+\definecolor [darkslategray4] [h=528b8b]
+\definecolor [aquamarine1] [h=7fffd4]
+\definecolor [aquamarine2] [h=76eec6]
+\definecolor [aquamarine3] [h=66cdaa]
+\definecolor [aquamarine4] [h=458b74]
+\definecolor [darkseagreen1] [h=c1ffc1]
+\definecolor [darkseagreen2] [h=b4eeb4]
+\definecolor [darkseagreen3] [h=9bcd9b]
+\definecolor [darkseagreen4] [h=698b69]
+\definecolor [seagreen1] [h=54ff9f]
+\definecolor [seagreen2] [h=4eee94]
+\definecolor [seagreen3] [h=43cd80]
+\definecolor [seagreen4] [h=2e8b57]
+\definecolor [palegreen1] [h=9aff9a]
+\definecolor [palegreen2] [h=90ee90]
+\definecolor [palegreen3] [h=7ccd7c]
+\definecolor [palegreen4] [h=548b54]
+\definecolor [springgreen1] [h=00ff7f]
+\definecolor [springgreen2] [h=00ee76]
+\definecolor [springgreen3] [h=00cd66]
+\definecolor [springgreen4] [h=008b45]
+\definecolor [green1] [h=00ff00]
+\definecolor [green2] [h=00ee00]
+\definecolor [green3] [h=00cd00]
+\definecolor [green4] [h=008b00]
+\definecolor [chartreuse1] [h=7fff00]
+\definecolor [chartreuse2] [h=76ee00]
+\definecolor [chartreuse3] [h=66cd00]
+\definecolor [chartreuse4] [h=458b00]
+\definecolor [olivedrab1] [h=c0ff3e]
+\definecolor [olivedrab2] [h=b3ee3a]
+\definecolor [olivedrab3] [h=9acd32]
+\definecolor [olivedrab4] [h=698b22]
+\definecolor [darkolivegreen1] [h=caff70]
+\definecolor [darkolivegreen2] [h=bcee68]
+\definecolor [darkolivegreen3] [h=a2cd5a]
+\definecolor [darkolivegreen4] [h=6e8b3d]
+\definecolor [khaki1] [h=fff68f]
+\definecolor [khaki2] [h=eee685]
+\definecolor [khaki3] [h=cdc673]
+\definecolor [khaki4] [h=8b864e]
+\definecolor [lightgoldenrod1] [h=ffec8b]
+\definecolor [lightgoldenrod2] [h=eedc82]
+\definecolor [lightgoldenrod3] [h=cdbe70]
+\definecolor [lightgoldenrod4] [h=8b814c]
+\definecolor [lightyellow1] [h=ffffe0]
+\definecolor [lightyellow2] [h=eeeed1]
+\definecolor [lightyellow3] [h=cdcdb4]
+\definecolor [lightyellow4] [h=8b8b7a]
+\definecolor [yellow1] [h=ffff00]
+\definecolor [yellow2] [h=eeee00]
+\definecolor [yellow3] [h=cdcd00]
+\definecolor [yellow4] [h=8b8b00]
+\definecolor [gold1] [h=ffd700]
+\definecolor [gold2] [h=eec900]
+\definecolor [gold3] [h=cdad00]
+\definecolor [gold4] [h=8b7500]
+\definecolor [goldenrod1] [h=ffc125]
+\definecolor [goldenrod2] [h=eeb422]
+\definecolor [goldenrod3] [h=cd9b1d]
+\definecolor [goldenrod4] [h=8b6914]
+\definecolor [darkgoldenrod1] [h=ffb90f]
+\definecolor [darkgoldenrod2] [h=eead0e]
+\definecolor [darkgoldenrod3] [h=cd950c]
+\definecolor [darkgoldenrod4] [h=8b6508]
+\definecolor [rosybrown1] [h=ffc1c1]
+\definecolor [rosybrown2] [h=eeb4b4]
+\definecolor [rosybrown3] [h=cd9b9b]
+\definecolor [rosybrown4] [h=8b6969]
+\definecolor [indianred1] [h=ff6a6a]
+\definecolor [indianred2] [h=ee6363]
+\definecolor [indianred3] [h=cd5555]
+\definecolor [indianred4] [h=8b3a3a]
+\definecolor [sienna1] [h=ff8247]
+\definecolor [sienna2] [h=ee7942]
+\definecolor [sienna3] [h=cd6839]
+\definecolor [sienna4] [h=8b4726]
+\definecolor [burlywood1] [h=ffd39b]
+\definecolor [burlywood2] [h=eec591]
+\definecolor [burlywood3] [h=cdaa7d]
+\definecolor [burlywood4] [h=8b7355]
+\definecolor [wheat1] [h=ffe7ba]
+\definecolor [wheat2] [h=eed8ae]
+\definecolor [wheat3] [h=cdba96]
+\definecolor [wheat4] [h=8b7e66]
+\definecolor [tan1] [h=ffa54f]
+\definecolor [tan2] [h=ee9a49]
+\definecolor [tan3] [h=cd853f]
+\definecolor [tan4] [h=8b5a2b]
+\definecolor [chocolate1] [h=ff7f24]
+\definecolor [chocolate2] [h=ee7621]
+\definecolor [chocolate3] [h=cd661d]
+\definecolor [chocolate4] [h=8b4513]
+\definecolor [firebrick1] [h=ff3030]
+\definecolor [firebrick2] [h=ee2c2c]
+\definecolor [firebrick3] [h=cd2626]
+\definecolor [firebrick4] [h=8b1a1a]
+\definecolor [brown1] [h=ff4040]
+\definecolor [brown2] [h=ee3b3b]
+\definecolor [brown3] [h=cd3333]
+\definecolor [brown4] [h=8b2323]
+\definecolor [salmon1] [h=ff8c69]
+\definecolor [salmon2] [h=ee8262]
+\definecolor [salmon3] [h=cd7054]
+\definecolor [salmon4] [h=8b4c39]
+\definecolor [lightsalmon1] [h=ffa07a]
+\definecolor [lightsalmon2] [h=ee9572]
+\definecolor [lightsalmon3] [h=cd8162]
+\definecolor [lightsalmon4] [h=8b5742]
+\definecolor [orange1] [h=ffa500]
+\definecolor [orange2] [h=ee9a00]
+\definecolor [orange3] [h=cd8500]
+\definecolor [orange4] [h=8b5a00]
+\definecolor [darkorange1] [h=ff7f00]
+\definecolor [darkorange2] [h=ee7600]
+\definecolor [darkorange3] [h=cd6600]
+\definecolor [darkorange4] [h=8b4500]
+\definecolor [coral1] [h=ff7256]
+\definecolor [coral2] [h=ee6a50]
+\definecolor [coral3] [h=cd5b45]
+\definecolor [coral4] [h=8b3e2f]
+\definecolor [tomato1] [h=ff6347]
+\definecolor [tomato2] [h=ee5c42]
+\definecolor [tomato3] [h=cd4f39]
+\definecolor [tomato4] [h=8b3626]
+\definecolor [orangered1] [h=ff4500]
+\definecolor [orangered2] [h=ee4000]
+\definecolor [orangered3] [h=cd3700]
+\definecolor [orangered4] [h=8b2500]
+\definecolor [red1] [h=ff0000]
+\definecolor [red2] [h=ee0000]
+\definecolor [red3] [h=cd0000]
+\definecolor [red4] [h=8b0000]
+\definecolor [debianred] [h=d70751]
+\definecolor [deeppink1] [h=ff1493]
+\definecolor [deeppink2] [h=ee1289]
+\definecolor [deeppink3] [h=cd1076]
+\definecolor [deeppink4] [h=8b0a50]
+\definecolor [hotpink1] [h=ff6eb4]
+\definecolor [hotpink2] [h=ee6aa7]
+\definecolor [hotpink3] [h=cd6090]
+\definecolor [hotpink4] [h=8b3a62]
+\definecolor [pink1] [h=ffb5c5]
+\definecolor [pink2] [h=eea9b8]
+\definecolor [pink3] [h=cd919e]
+\definecolor [pink4] [h=8b636c]
+\definecolor [lightpink1] [h=ffaeb9]
+\definecolor [lightpink2] [h=eea2ad]
+\definecolor [lightpink3] [h=cd8c95]
+\definecolor [lightpink4] [h=8b5f65]
+\definecolor [palevioletred1] [h=ff82ab]
+\definecolor [palevioletred2] [h=ee799f]
+\definecolor [palevioletred3] [h=cd6889]
+\definecolor [palevioletred4] [h=8b475d]
+\definecolor [maroon1] [h=ff34b3]
+\definecolor [maroon2] [h=ee30a7]
+\definecolor [maroon3] [h=cd2990]
+\definecolor [maroon4] [h=8b1c62]
+\definecolor [violetred1] [h=ff3e96]
+\definecolor [violetred2] [h=ee3a8c]
+\definecolor [violetred3] [h=cd3278]
+\definecolor [violetred4] [h=8b2252]
+\definecolor [magenta1] [h=ff00ff]
+\definecolor [magenta2] [h=ee00ee]
+\definecolor [magenta3] [h=cd00cd]
+\definecolor [magenta4] [h=8b008b]
+\definecolor [orchid1] [h=ff83fa]
+\definecolor [orchid2] [h=ee7ae9]
+\definecolor [orchid3] [h=cd69c9]
+\definecolor [orchid4] [h=8b4789]
+\definecolor [plum1] [h=ffbbff]
+\definecolor [plum2] [h=eeaeee]
+\definecolor [plum3] [h=cd96cd]
+\definecolor [plum4] [h=8b668b]
+\definecolor [mediumorchid1] [h=e066ff]
+\definecolor [mediumorchid2] [h=d15fee]
+\definecolor [mediumorchid3] [h=b452cd]
+\definecolor [mediumorchid4] [h=7a378b]
+\definecolor [darkorchid1] [h=bf3eff]
+\definecolor [darkorchid2] [h=b23aee]
+\definecolor [darkorchid3] [h=9a32cd]
+\definecolor [darkorchid4] [h=68228b]
+\definecolor [purple1] [h=9b30ff]
+\definecolor [purple2] [h=912cee]
+\definecolor [purple3] [h=7d26cd]
+\definecolor [purple4] [h=551a8b]
+\definecolor [mediumpurple1] [h=ab82ff]
+\definecolor [mediumpurple2] [h=9f79ee]
+\definecolor [mediumpurple3] [h=8968cd]
+\definecolor [mediumpurple4] [h=5d478b]
+\definecolor [thistle1] [h=ffe1ff]
+\definecolor [thistle2] [h=eed2ee]
+\definecolor [thistle3] [h=cdb5cd]
+\definecolor [thistle4] [h=8b7b8b]
+\definecolor [gray0] [s=0.00]
+\definecolor [grey0] [gray0]
+\definecolor [gray1] [s=0.01]
+\definecolor [grey1] [gray1]
+\definecolor [gray2] [s=0.02]
+\definecolor [grey2] [gray2]
+\definecolor [gray3] [s=0.03]
+\definecolor [grey3] [gray3]
+\definecolor [gray4] [s=0.04]
+\definecolor [grey4] [gray4]
+\definecolor [gray5] [s=0.05]
+\definecolor [grey5] [gray5]
+\definecolor [gray6] [s=0.06]
+\definecolor [grey6] [gray6]
+\definecolor [gray7] [s=0.07]
+\definecolor [grey7] [gray7]
+\definecolor [gray8] [s=0.08]
+\definecolor [grey8] [gray8]
+\definecolor [gray9] [s=0.09]
+\definecolor [grey9] [gray9]
+\definecolor [gray10] [s=0.10]
+\definecolor [grey10] [gray10]
+\definecolor [gray11] [s=0.11]
+\definecolor [grey11] [gray11]
+\definecolor [gray12] [s=0.12]
+\definecolor [grey12] [gray12]
+\definecolor [gray13] [s=0.13]
+\definecolor [grey13] [gray13]
+\definecolor [gray14] [s=0.14]
+\definecolor [grey14] [gray14]
+\definecolor [gray15] [s=0.15]
+\definecolor [grey15] [gray15]
+\definecolor [gray16] [s=0.16]
+\definecolor [grey16] [gray16]
+\definecolor [gray17] [s=0.17]
+\definecolor [grey17] [gray17]
+\definecolor [gray18] [s=0.18]
+\definecolor [grey18] [gray18]
+\definecolor [gray19] [s=0.19]
+\definecolor [grey19] [gray19]
+\definecolor [gray20] [s=0.20]
+\definecolor [grey20] [gray20]
+\definecolor [gray21] [s=0.21]
+\definecolor [grey21] [gray21]
+\definecolor [gray22] [s=0.22]
+\definecolor [grey22] [gray22]
+\definecolor [gray23] [s=0.23]
+\definecolor [grey23] [gray23]
+\definecolor [gray24] [s=0.24]
+\definecolor [grey24] [gray24]
+\definecolor [gray25] [s=0.25]
+\definecolor [grey25] [gray25]
+\definecolor [gray26] [s=0.26]
+\definecolor [grey26] [gray26]
+\definecolor [gray27] [s=0.27]
+\definecolor [grey27] [gray27]
+\definecolor [gray28] [s=0.28]
+\definecolor [grey28] [gray28]
+\definecolor [gray29] [s=0.29]
+\definecolor [grey29] [gray29]
+\definecolor [gray30] [s=0.30]
+\definecolor [grey30] [gray30]
+\definecolor [gray31] [s=0.31]
+\definecolor [grey31] [gray31]
+\definecolor [gray32] [s=0.32]
+\definecolor [grey32] [gray32]
+\definecolor [gray33] [s=0.33]
+\definecolor [grey33] [gray33]
+\definecolor [gray34] [s=0.34]
+\definecolor [grey34] [gray34]
+\definecolor [gray35] [s=0.35]
+\definecolor [grey35] [gray35]
+\definecolor [gray36] [s=0.36]
+\definecolor [grey36] [gray36]
+\definecolor [gray37] [s=0.37]
+\definecolor [grey37] [gray37]
+\definecolor [gray38] [s=0.38]
+\definecolor [grey38] [gray38]
+\definecolor [gray39] [s=0.39]
+\definecolor [grey39] [gray39]
+\definecolor [gray40] [s=0.40]
+\definecolor [grey40] [gray40]
+\definecolor [gray41] [s=0.41]
+\definecolor [grey41] [gray41]
+\definecolor [gray42] [s=0.42]
+\definecolor [grey42] [gray42]
+\definecolor [gray43] [s=0.43]
+\definecolor [grey43] [gray43]
+\definecolor [gray44] [s=0.44]
+\definecolor [grey44] [gray44]
+\definecolor [gray45] [s=0.45]
+\definecolor [grey45] [gray45]
+\definecolor [gray46] [s=0.46]
+\definecolor [grey46] [gray46]
+\definecolor [gray47] [s=0.47]
+\definecolor [grey47] [gray47]
+\definecolor [gray48] [s=0.48]
+\definecolor [grey48] [gray48]
+\definecolor [gray49] [s=0.49]
+\definecolor [grey49] [gray49]
+\definecolor [gray50] [s=0.50]
+\definecolor [grey50] [gray50]
+\definecolor [gray51] [s=0.51]
+\definecolor [grey51] [gray51]
+\definecolor [gray52] [s=0.52]
+\definecolor [grey52] [gray52]
+\definecolor [gray53] [s=0.53]
+\definecolor [grey53] [gray53]
+\definecolor [gray54] [s=0.54]
+\definecolor [grey54] [gray54]
+\definecolor [gray55] [s=0.55]
+\definecolor [grey55] [gray55]
+\definecolor [gray56] [s=0.56]
+\definecolor [grey56] [gray56]
+\definecolor [gray57] [s=0.57]
+\definecolor [grey57] [gray57]
+\definecolor [gray58] [s=0.58]
+\definecolor [grey58] [gray58]
+\definecolor [gray59] [s=0.59]
+\definecolor [grey59] [gray59]
+\definecolor [gray60] [s=0.60]
+\definecolor [grey60] [gray60]
+\definecolor [gray61] [s=0.61]
+\definecolor [grey61] [gray61]
+\definecolor [gray62] [s=0.62]
+\definecolor [grey62] [gray62]
+\definecolor [gray63] [s=0.63]
+\definecolor [grey63] [gray63]
+\definecolor [gray64] [s=0.64]
+\definecolor [grey64] [gray64]
+\definecolor [gray65] [s=0.65]
+\definecolor [grey65] [gray65]
+\definecolor [gray66] [s=0.66]
+\definecolor [grey66] [gray66]
+\definecolor [gray67] [s=0.67]
+\definecolor [grey67] [gray67]
+\definecolor [gray68] [s=0.68]
+\definecolor [grey68] [gray68]
+\definecolor [gray69] [s=0.69]
+\definecolor [grey69] [gray69]
+\definecolor [gray70] [s=0.70]
+\definecolor [grey70] [gray70]
+\definecolor [gray71] [s=0.71]
+\definecolor [grey71] [gray71]
+\definecolor [gray72] [s=0.72]
+\definecolor [grey72] [gray72]
+\definecolor [gray73] [s=0.73]
+\definecolor [grey73] [gray73]
+\definecolor [gray74] [s=0.74]
+\definecolor [grey74] [gray74]
+\definecolor [gray75] [s=0.75]
+\definecolor [grey75] [gray75]
+\definecolor [gray76] [s=0.76]
+\definecolor [grey76] [gray76]
+\definecolor [gray77] [s=0.77]
+\definecolor [grey77] [gray77]
+\definecolor [gray78] [s=0.78]
+\definecolor [grey78] [gray78]
+\definecolor [gray79] [s=0.79]
+\definecolor [grey79] [gray79]
+\definecolor [gray80] [s=0.80]
+\definecolor [grey80] [gray80]
+\definecolor [gray81] [s=0.81]
+\definecolor [grey81] [gray81]
+\definecolor [gray82] [s=0.82]
+\definecolor [grey82] [gray82]
+\definecolor [gray83] [s=0.83]
+\definecolor [grey83] [gray83]
+\definecolor [gray84] [s=0.84]
+\definecolor [grey84] [gray84]
+\definecolor [gray85] [s=0.85]
+\definecolor [grey85] [gray85]
+\definecolor [gray86] [s=0.86]
+\definecolor [grey86] [gray86]
+\definecolor [gray87] [s=0.87]
+\definecolor [grey87] [gray87]
+\definecolor [gray88] [s=0.88]
+\definecolor [grey88] [gray88]
+\definecolor [gray89] [s=0.89]
+\definecolor [grey89] [gray89]
+\definecolor [gray90] [s=0.90]
+\definecolor [grey90] [gray90]
+\definecolor [gray91] [s=0.91]
+\definecolor [grey91] [gray91]
+\definecolor [gray92] [s=0.92]
+\definecolor [grey92] [gray92]
+\definecolor [gray93] [s=0.93]
+\definecolor [grey93] [gray93]
+\definecolor [gray94] [s=0.94]
+\definecolor [grey94] [gray94]
+\definecolor [gray95] [s=0.95]
+\definecolor [grey95] [gray95]
+\definecolor [gray96] [s=0.96]
+\definecolor [grey96] [gray96]
+\definecolor [gray97] [s=0.97]
+\definecolor [grey97] [gray97]
+\definecolor [gray98] [s=0.98]
+\definecolor [grey98] [gray98]
+\definecolor [gray99] [s=0.99]
+\definecolor [grey99] [gray99]
+\definecolor [gray100] [s=1.00]
+\definecolor [grey100] [gray100]
+\definecolor [darkgrey] [s=0.66]
+\definecolor [darkgray] [darkgrey]
+\definecolor [darkblue] [h=00008b]
+\definecolor [darkcyan] [h=008b8b]
+\definecolor [darkmagenta] [h=8b008b]
+\definecolor [darkred] [h=8b0000]
+\definecolor [lightgreen] [h=90ee90]
+
+\endinput
diff --git a/Master/texmf-dist/tex/context/base/cont-cz.tex b/Master/texmf-dist/tex/context/base/cont-cz.tex
deleted file mode 100644
index b86b21e869a..00000000000
--- a/Master/texmf-dist/tex/context/base/cont-cz.tex
+++ /dev/null
@@ -1,35 +0,0 @@
-%D \module
-%D [ file=cont-cz,
-%D version=1998.12.02,
-%D title=\CONTEXT,
-%D subtitle=\CONTEXT\ Czech Format Generation,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{czech}
-
-\input context.tex
-
-\unprotect
-
-\setupcurrentlanguage[\s!cz]
-
-\loaduserspecifications
-
-\installlanguage [\s!en] [\c!state=\v!start]
-\installlanguage [\s!de] [\c!state=\v!start]
-\installlanguage [\s!sk] [\c!state=\v!start]
-\installlanguage [\s!cz] [\c!state=\v!start]
-
-% \setupbodyfont [cmr,ams,rm,12pt]
-%
-% \setupencoding[default=ec] \usetypescript[modern][\defaultencoding] \setupbodyfont[modern,rm,12pt]
-
-\setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt]
-
-\protect \errorstopmode \dump \endinput
diff --git a/Master/texmf-dist/tex/context/base/cont-fil.tex b/Master/texmf-dist/tex/context/base/cont-fil.tex
index 28b6b6f55b8..b295872ca0c 100644
--- a/Master/texmf-dist/tex/context/base/cont-fil.tex
+++ b/Master/texmf-dist/tex/context/base/cont-fil.tex
@@ -20,7 +20,8 @@
\definefilesynonym [eenheid] [units]
\definefilesynonym [einheit] [units]
-\definefilesynonym [pstricks] [pstric]
+\definefilesynonym [pstric] [pstricks]
+\definefilesynonym [pstrick] [pstricks]
\definefilesynonym [finance] [financ]
diff --git a/Master/texmf-dist/tex/context/base/cont-log.tex b/Master/texmf-dist/tex/context/base/cont-log.tex
index a22c1d2c4e2..9bfec299992 100644
--- a/Master/texmf-dist/tex/context/base/cont-log.tex
+++ b/Master/texmf-dist/tex/context/base/cont-log.tex
@@ -89,7 +89,7 @@
\kern-.11em\TeX}
\def\AMSswitch#1%
- {$\fam2\ifdim\bodyfontsize>1.1em\scriptstyle\fi#1$}
+ {$\cal\ifdim\bodyfontsize>1.1em\scriptstyle\fi#1$}
\unexpanded\def\AmSTeX
{\AMSswitch A%
@@ -210,6 +210,7 @@
\unexpanded\def\TABLE {\TaBlE}
\unexpanded\def\AMSTEX {\AmSTeX}
\unexpanded\def\LAMSTEX {\LamSTeX}
+\unexpanded\def\INRSTEX {inrs\TeX}
%D And this is how they show up: \TeX, \MetaFont, \MetaPost,
%D \PiCTeX, \TaBlE, \ConTeXt, \PPCHTeX, \AmSTeX, \LaTeX,
@@ -286,14 +287,15 @@
\fi
-\let\ETEX \eTeX
-\let\PDFTEX \pdfTeX
-\let\PDFETEX \pdfeTeX
-\let\LUATEX \luaTeX
-\let\XETEX \XeTeX
+\let\ETEX \eTeX
+\let\PDFTEX \pdfTeX
+\let\PDFETEX\pdfeTeX
+\let\LUATEX \luaTeX
+\let\LuaTeX \luaTeX
+\let\XETEX \XeTeX
-\def\MkApproved
- {\rotate
+\unexpanded\def\MkApproved
+ {\dontleavehmode\rotate
[\c!rotation={\ifnum\texengine=\luatexengine\ctxlua{tex.write(45-45*\the\luatexversion/100)}\else0\fi},
\c!align=\v!middle,
\c!foregroundstyle=\v!type,
@@ -306,4 +308,52 @@
\c!rulethickness=2pt]
{Mk\ifnum\texengine=\luatexengine IV\else II\fi\\approved}}
+
+% \unexpanded\def\luaTeX
+% {\dontleavehmode\begingroup
+% Lua%
+% \setbox0\hbox{oT}%
+% \setbox2\hbox{o\kern0ptT}%
+% \ifdim\wd0=\wd2
+% \setbox0\hbox dir TRT{To}%
+% \setbox2\hbox{T\kern0pto}%
+% \hskip\dimexpr\wd0-\wd2\relax
+% \fi
+% \TeX
+% \endgroup}
+%
+% a further iteration from the list, patched again
+
+% \ifx\fontalternative\c!it -\else
+% \ifx\fontalternative\c!sl -\else
+% \ifx\fontalternative\c!bi -\else
+% \ifx\fontalternative\c!bs -\fi\fi\fi\fi
+
+\def\LuaTeX
+ {\dontleavehmode
+ \begingroup
+ Lua%
+ % hope for kerning, try aT
+ \setbox0\hbox{aT}%
+ \setbox2\hbox{a\kern\zeropoint T}%
+ \ifdim\wd0=\wd2 % kerns can go two ways
+ % no aT kerning, try oT as a is not symmetrical
+ \setbox0\hbox{oT}%
+ \setbox2\hbox{o\kern\zeropoint T}%
+ \ifdim\wd0=\wd2 % kerns can go two ways
+ % no aT and oT kerning, try To
+ \setbox0\hbox{To}%
+ \setbox2\hbox{T\kern\zeropoint o}%
+ % maybe we need to compensate for the angle (sl/it/bs/bi)
+ \fi
+ \ifdim\wd0=\wd2\else
+ \kern\dimexpr\wd0-\wd2\relax
+ \fi
+ \fi
+ \TeX
+ \endgroup}
+
+\let\luaTeX \LuaTeX
+\let\LUATEX \LuaTeX
+
\protect \endinput
diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkii b/Master/texmf-dist/tex/context/base/cont-new.mkii
index 8b5bed657a5..2defba6d787 100644
--- a/Master/texmf-dist/tex/context/base/cont-new.mkii
+++ b/Master/texmf-dist/tex/context/base/cont-new.mkii
@@ -16,4 +16,7 @@
\long\def\startluacode#1\stopluacode{}
\long\def\ctxlua #1{}
+\def\enabletrackers [#1]{}
+\def\disabletrackers[#1]{}
+
\endinput
diff --git a/Master/texmf-dist/tex/context/base/cont-new.mkiv b/Master/texmf-dist/tex/context/base/cont-new.mkiv
index 35b716ed46f..6269e5a6160 100644
--- a/Master/texmf-dist/tex/context/base/cont-new.mkiv
+++ b/Master/texmf-dist/tex/context/base/cont-new.mkiv
@@ -11,25 +11,15 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-% 2009-07-15 / vista sp 2 / 2.2G duo dell M90 precision:
-%
-% \dorecurse{10000}{test \page} % 300 pps
-% \dorecurse {2000}{test \page} % 260 pps
-% \dorecurse {300}{test \page} % 135 pps
-
-% \ctxlua { fonts.define.method = 2 } % normally 3
-
-\enablemode[mkiv] \setsystemmode{mkiv}
-
% potential new defaults:
%
% \setbreakpoints[compound]
\unprotect
-% % % % % % needs testing but saves runtime
+\ctxlua{logs.report = commands.report} % this will become default
-\let\checknotes\relax % probably not needed, checking already done
+\def\immediatemessage#1{\ctxlua{commands.writestatus("message","#1")}}
% we need to figure this out (to be discussed)
@@ -43,106 +33,8 @@
\unexpanded\def\textplus
{\char"002B } % plus
-% \def\registerviewerlayer#1#2% global !
-% {\setxvalue{(vl:#1)}{\global\dosetattribute{viewerlayer}{\ctxlua{tex.print(viewerlayers.register('#2'))}}}}
-
-% \setevalue{(vl:)}{\global\doresetattribute{viewerlayer}}
-
-\let\\=\crlf % till we fixed all styles
-
-% \def\pagedir{\expandafter\gobblethreearguments}
-% \def\bodydir{\expandafter\gobblethreearguments}
-
-%D Since this can be a showstopper, we report the path at the beginning
-%D as well as at the end of a run.
-
-% \writestatus\m!lua{used config path - \ctxlua{tex.print(caches.configpath())}}
-% \writestatus\m!lua{used cache path - \ctxlua{tex.print(caches.path)}}
-
-\startluacode
- statistics.register("result saved in file", function()
- return string.format( "%s.%s", "\outputfilename", (tex.pdfoutput>0 and "pdf") or "dvi")
- end)
-\stopluacode
-
-%D For the moment we report some statistics. Later this will become an option,
-%D but for now we need this information.
-
-\def\nomkivstatistics{\ctxlua{statistics.enable = false}} % for taco
-
-\def\resettimer {\ctxlua{environment.starttime = os.clock()}}
-\def\elapsedtime {\ctxlua{tex.sprint(os.clock()-environment.starttime)}}
-\let\elapsedseconds \elapsedtime
+% till we fixed all styles
-% we will have a bunch of extra tracers (--dumphash --dumpdelta)
-
-\def\tracersdumphash {\ctxlua{tracers.register_dump_hash(false)}}
-\def\tracersdumpdelta{\ctxlua{tracers.register_dump_hash(true)}}
-
-\resettimer
-
-%D For me.
-
-\def\traceluausage
- {\dosingleempty\dotraceluausage}
-
-\def\dotraceluausage[#1]%
- {\ctxlua{debugger.enable()}%
- \appendtoks\ctxlua{debugger.disable() debugger.showstats(print,\doifnumberelse{#1}{#1}{5000})}\to\everybye}
-
-%D Fonts (experimental AFM loading}
-
-% \ctxlua {
-% remapper.define('encoding','^lm' ,'^(.*)$','lm-\letterpercent1')
-% remapper.define('encoding','^qbk','^(.*)$','q-\letterpercent1')
-% remapper.define('encoding','^qcs','^(.*)$','q-\letterpercent1')
-% remapper.define('encoding','^qpl','^(.*)$','q-\letterpercent1')
-% remapper.define('encoding','^qtm','^(.*)$','q-\letterpercent1')
-% }
-
-% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryximage
-% \appendtoksonce \loadallXfontmapfiles \to \pdfbackendeveryxform
-% \appendtoksonce \loadallXfontmapfiles \to \everystarttext
-% \appendtoksonce \loadallXfontmapfiles \to \everybeforepagebody
-
-% \def\loadallXfontmapfiles{\ctxlua{fonts.map.flush("pdftex")}}
-
-% \ctxlua{
-% do
-% local pth = "." .. io.fileseparator .. "tmp" .. io.fileseparator .. "\jobname"
-% texio.write_nl("CREATING "..pth)
-% os.execute("mkdir " .. pth)
-% end
-% resolvers.output_files = { }
-% callback.register('find_write_file', function(id,name)
-% resolvers.output_files[name] = file.join(".","tmp","\jobname",name)
-% texio.write_nl("REDIRECTING OUTPUT "..name.. " TO " .. resolvers.output_files[name])
-% return resolvers.output_files[name]
-% end)
-% callback.register('find_read_file', function(id,name)
-% local sname = string.gsub(name,"^\letterpercent./","")
-% if resolvers.output_files[sname] then
-% return resolvers.output_files[name]
-% elseif string.find(sname,"^\jobname[\letterpercent.\letterpercent-]") then
-% local n = file.join(".","tmp","\jobname",sname)
-% local f = io.open(n)
-% if f then
-% resolvers.output_files[name] = n
-% texio.write_nl("REDIRECTING INPUT "..sname.. " TO " .. n)
-% f:close()
-% return n
-% else
-% return resolvers.findtexfile(name)
-% end
-% else
-% return resolvers.findtexfile(name)
-% end
-% end)
-% }
-
-\definestartstop[randomized][\c!before=\dosetattribute{case}{8},\c!after=]
+\let\\=\crlf
\protect \endinput
-
-% \expanded{\defineactivecharacter \number"2000E} {\textdir TRT\relax}
-% \expanded{\defineactivecharacter \number"2000F} {\textdir TLT\relax}
diff --git a/Master/texmf-dist/tex/context/base/cont-new.tex b/Master/texmf-dist/tex/context/base/cont-new.tex
index 161d4c9182e..9c4fdba18f9 100644
--- a/Master/texmf-dist/tex/context/base/cont-new.tex
+++ b/Master/texmf-dist/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2009.08.19 17:10}
+\newcontextversion{2010.05.24 13:05}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/Master/texmf-dist/tex/context/base/cont-uk.tex b/Master/texmf-dist/tex/context/base/cont-uk.tex
deleted file mode 100644
index d900217e1dc..00000000000
--- a/Master/texmf-dist/tex/context/base/cont-uk.tex
+++ /dev/null
@@ -1,38 +0,0 @@
-%D \module
-%D [ file=cont-uk,
-%D version=1997.08.19,
-%D title=\CONTEXT,
-%D subtitle=\CONTEXT\ English Format Generation,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
-%C details.
-
-\catcode`\{=1 \catcode`\}=2 \def\defaultinterface{english}
-
-\input context.tex
-
-\unprotect
-
-\setupcurrentlanguage[\s!uk]
-
-\loaduserspecifications
-
-\installlanguage [\s!en] [\c!state=\v!start]
-\installlanguage [\s!uk] [\c!state=\v!start]
-\installlanguage [\s!de] [\c!state=\v!start]
-\installlanguage [\s!fr] [\c!state=\v!start]
-\installlanguage [\s!es] [\c!state=\v!start]
-\installlanguage [\s!nl] [\c!state=\v!start]
-\installlanguage [\s!it] [\c!state=\v!start]
-
-% \setupbodyfont [cmr,ams,rm,12pt]
-%
-% \setupencoding[default=ec] \usetypescript[modern][\defaultencoding] \setupbodyfont[modern,rm,12pt]
-
-\setupencoding[default=ec] \usetypescript[fallback][\defaultencoding] \setupbodyfont[rm,12pt]
-
-\protect \errorstopmode \dump \endinput
diff --git a/Master/texmf-dist/tex/context/base/context-base.lmx b/Master/texmf-dist/tex/context/base/context-base.lmx
index 5c96b497953..fd27927bf82 100644
--- a/Master/texmf-dist/tex/context/base/context-base.lmx
+++ b/Master/texmf-dist/tex/context/base/context-base.lmx
@@ -14,25 +14,63 @@
+ 0) and v('refreshurl') then ?>
+
+
+
+
+
+
+
+