From fa303732df1c87819ec5f4874ca3108ad99449a9 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 25 Jan 2010 11:09:00 +0100 Subject: beta 2010.01.25 11:09 --- tex/context/base/chem-str.lua | 2 +- tex/context/base/cont-new.tex | 2 +- tex/context/base/context.tex | 2 +- tex/context/base/enco-ini.mkii | 2 +- tex/context/base/enco-l7x.mkii | 236 ++++++++++++++++++++++++++++ tex/context/base/lpdf-ano.lua | 19 +++ tex/context/base/node-fin.mkiv | 2 + tex/context/base/ppchtex.mkii | 101 +++++++++++- tex/context/base/ppchtex.mkiv | 103 +++++++++++- tex/context/base/strc-des.mkiv | 36 ++--- tex/context/base/strc-lst.lua | 40 ++++- tex/context/base/strc-lst.mkiv | 25 ++- tex/context/base/strc-ref.lua | 34 +++- tex/context/base/strc-ref.mkiv | 56 +++++-- tex/generic/context/luatex-fonts-merged.lua | 2 +- 15 files changed, 603 insertions(+), 59 deletions(-) create mode 100644 tex/context/base/enco-l7x.mkii (limited to 'tex') diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua index 02fc585fc..8dc073d49 100644 --- a/tex/context/base/chem-str.lua +++ b/tex/context/base/chem-str.lua @@ -60,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", diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex index 3b7f2743c..6db8e683e 100644 --- a/tex/context/base/cont-new.tex +++ b/tex/context/base/cont-new.tex @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2010.01.22 19:05} +\newcontextversion{2010.01.25 11:09} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex index 70b45aa64..3f7110d53 100644 --- a/tex/context/base/context.tex +++ b/tex/context/base/context.tex @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2010.01.22 19:05} +\edef\contextversion{2010.01.25 11:09} %D For those who want to use this: diff --git a/tex/context/base/enco-ini.mkii b/tex/context/base/enco-ini.mkii index 1ac491e62..33825f94d 100644 --- a/tex/context/base/enco-ini.mkii +++ b/tex/context/base/enco-ini.mkii @@ -1129,7 +1129,7 @@ \ifnum\texengine=\xetexengine \setupencoding[\s!default=\s!default] \else - \useencoding[ans,il2,ec,tbo,pdf,pol,qx,t5,cyr,agr] % pol and il2 will go away, not needed in mkiv, uc removed + \useencoding[ans,il2,ec,tbo,pdf,pol,qx,t5,l7x,cyr,agr] % pol and il2 will go away, not needed in mkiv, uc removed \useencoding[032,033,037] % fallbacks for some unicode chars \setupencoding[\s!default=ec] % was: [\s!default=\s!default] \fi diff --git a/tex/context/base/enco-l7x.mkii b/tex/context/base/enco-l7x.mkii new file mode 100644 index 000000000..8f355317b --- /dev/null +++ b/tex/context/base/enco-l7x.mkii @@ -0,0 +1,236 @@ +%D \module +%D [ file=enco-l7x, +%D version=2010.01.22, +%D title=\CONTEXT\ Encoding Macros, +%D subtitle=\LATEX\ L7x Encoding, +%D author={Hans Hagen \& Mojca Miklavec}, +%D date=\currentdate, +%D copyright=PRAGMA-ADE] +%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 Encoding vector to support Latvian and Lithuanian. The first +%D part is taken from EC encoding, the rest has not been tested +%D extensively. + +\startmapping[l7x] + +\definecaseswap 25 `I % dotless i (TODO - probably wrong; maybe use \defineuppercasecom) +\definecaseswap 156 140 % oeligature +\definecaseswap 184 168 % ostroke +\definecaseswap 186 170 % rcommaaccent +\definecaseswap 191 175 % aeligature +\definecaseself 223 % ssharp (this is wrong, but no better way) + +\definecasemaps 192 to 222 lc +32 uc 0 +\definecasemaps 224 to 254 lc 0 uc -32 +\resetcaserange 215 to 215 % textmultiply +\resetcaserange 247 to 247 % textdiv + +\stopmapping + +\startencoding[l7x] + +\definecharacter textgrave 0 +\definecharacter textacute 1 +\definecharacter textcircumflex 2 +\definecharacter texttilde 3 +\definecharacter textdiaeresis 4 +\definecharacter texthungarumlaut 5 +\definecharacter textring 6 +\definecharacter textcaron 7 +\definecharacter textbreve 8 +\definecharacter textmacron 9 +\definecharacter textdotaccent 10 +\definecharacter textcedilla 11 +\definecharacter textogonek 12 +\definecharacter quotesinglebase 13 +\definecharacter guilsingleleft 14 +\definecharacter guilsingleright 15 +\definecharacter quotedblleft 16 +\definecharacter quotedblright 17 +\definecharacter quotedblbase 18 +\definecharacter leftguillemot 19 +\definecharacter rightguillemot 20 +\definecharacter endash 21 +\definecharacter emdash 22 +%definecharacter compoundwordmark 23 +%definecharacter perthousand 24 +\definecharacter dotlessi 25 % or when missing: {j} +\definecharacter dotlessj 26 +% ff 27 +% fi 28 +% fl 29 +% ffi 30 +% ffl 31 +%definecharacter textvisiblespace 32 +% exclam ! 33 +\definecharacter quotedbl 34 +% numbersign # 35 +% dollar $ 36 +\definecharacter percent 37 +% ampersand & 38 +%definecharacter quotesingle 39 % fake 'm TODO:enco-def!!!! +\definecharacter quoteright 39 +% parenleft ( 40 +% parenright ) 41 +% asterisk * 42 +% plus + 43 +% comma , 44 +\definecharacter softhyphen 45 +% period . 46 +% slash / 47 +% 0-9 48-57 +% colon : 58 +% semicolon ; 59 +% less < 60 +% equal = 61 +% greater > 62 +% question ? 63 +% at @ 64 +% A-Z 65-90 +% bracketleft [ 91 +\definecharacter textbackslash 92 +% bracketright ] 93 +\definecharacter textasciicircum 94 +\definecharacter textunderscore 95 +\definecharacter quoteleft 96 +% a-z 97-122 +\definecharacter textbraceleft 123 +\definecharacter textbraceright 125 +\definecharacter textasciitilde 126 +% .notdef 127 +\definecharacter texteuro 128 +% .notdef 129 +\definecharacter quotesinglebase 130 +\definecharacter textflorin 131 \definecharacter fhook 131 +\definecharacter quotedblbase 132 +\definecharacter textellipsis 133 +\definecharacter textdag 134 +\definecharacter textddag 135 +% .notdef 136 +\definecharacter perthousand 137 +% .notdef 138 +\definecharacter guilsingleleft 139 +\definecharacter OEligature 140 % TODO: also \OE??? +\definecharacter textdiaeresis 141 +\definecharacter textcaron 142 +\definecharacter textcedilla 143 +% .notdef 144 +\definecharacter quoteleft 145 +\definecharacter quoteright 146 +\definecharacter quotedblleft 147 +\definecharacter quotedblright 148 +\definecharacter textbullet 149 +\definecharacter endash 150 +\definecharacter emdash 151 +% .notdef 152 +\definecharacter trademark 153 +% .notdef 154 +\definecharacter guilsingleright 155 +\definecharacter oeligature 156 +\definecharacter textmacron 157 +\definecharacter textogonek 158 +% .notdef 159 +%definecharacter space 160 % TODO!!! +\definecharacter quotedblright 161 +\definecharacter textcent 162 +\definecharacter textsterling 163 +\definecharacter textcurrency 164 +\definecharacter quotedblbase 165 +\definecharacter textbrokenbar 166 +\definecharacter sectionmark 167 +\definecharacter Ostroke 168 +\definecharacter copyright 169 +\definecharacter Rcommaaccent 170 +\definecharacter leftguillemot 171 +\definecharacter textlognot 172 +%definecharacter softhyphen 173 % -> 45 (TODO!!!) +\definecharacter registered 174 +\definecharacter AEligature 175 +\definecharacter textdegree 176 +\definecharacter textpm 177 +\definecharacter twosuperior 178 +\definecharacter threesuperior 179 +\definecharacter quotedblleft 180 +\definecharacter textmu 181 +\definecharacter paragraphmark 182 +\definecharacter periodcentered 183 +\definecharacter ostroke 184 +\definecharacter onesuperior 185 +\definecharacter rcommaaccent 186 +\definecharacter rightguillemot 187 +\definecharacter onequarter 188 +\definecharacter onehalf 189 +\definecharacter threequarter 190 +\definecharacter aeligature 191 +\definecharacter Aogonek 192 +\definecharacter Iogonek 193 +\definecharacter Amacron 194 +\definecharacter Cacute 195 +\definecharacter Adiaeresis 196 +\definecharacter Aring 197 +\definecharacter Eogonek 198 +\definecharacter Emacron 199 +\definecharacter Ccaron 200 +\definecharacter Eacute 201 +\definecharacter Zacute 202 +\definecharacter Edotaccent 203 +\definecharacter Gcommaaccent 204 +\definecharacter Kcommaaccent 205 +\definecharacter Imacron 206 +\definecharacter Lcommaaccent 207 +\definecharacter Scaron 208 +\definecharacter Nacute 209 +\definecharacter Ncommaaccent 210 +\definecharacter Oacute 211 +\definecharacter Omacron 212 +\definecharacter Otilde 213 +\definecharacter Odiaeresis 214 +\definecharacter textmultiply 215 +\definecharacter Uogonek 216 +\definecharacter Lstroke 217 +\definecharacter Sacute 218 +\definecharacter Umacron 219 +\definecharacter Udiaeresis 220 +\definecharacter Zdotaccent 221 +\definecharacter Zcaron 222 +\definecharacter ssharp 223 +\definecharacter aogonek 224 +\definecharacter iogonek 225 +\definecharacter amacron 226 +\definecharacter cacute 227 +\definecharacter adiaeresis 228 +\definecharacter aring 229 +\definecharacter eogonek 230 +\definecharacter emacron 231 +\definecharacter ccaron 232 +\definecharacter eacute 233 +\definecharacter zacute 234 +\definecharacter edotaccent 235 +\definecharacter gcommaaccent 236 +\definecharacter kcommaaccent 237 +\definecharacter imacron 238 +\definecharacter lcommaaccent 239 +\definecharacter scaron 240 +\definecharacter nacute 241 +\definecharacter ncommaaccent 242 +\definecharacter oacute 243 +\definecharacter omacron 244 +\definecharacter otilde 245 +\definecharacter odiaeresis 246 +\definecharacter textdiv 247 +\definecharacter uogonek 248 +\definecharacter lstroke 249 +\definecharacter sacute 250 +\definecharacter umacron 251 +\definecharacter udiaeresis 252 +\definecharacter zdotaccent 253 +\definecharacter zcaron 254 +\definecharacter quoteright 255 + +\stopencoding + +\endinput diff --git a/tex/context/base/lpdf-ano.lua b/tex/context/base/lpdf-ano.lua index 2ebb98bb6..017a3919a 100644 --- a/tex/context/base/lpdf-ano.lua +++ b/tex/context/base/lpdf-ano.lua @@ -350,6 +350,25 @@ function specials.page(var,actions) -- better resolve in strc-ref end end +-- todo, do this in references namespace ordered instead (this is an experiment) + +local splitter = lpeg.splitat(":") + +function specials.order(var,actions) -- jobreferences.specials ! + local operation = var.operation + if operation then + local kind, name, n = lpegmatch(splitter,operation) + local order = lists.ordered[kind] + order = order and order[name] + local v = order[tonumber(n)] + local r = v and v.references.realpage + if r then + var.operation = r -- brrr, but test anyway + return specials.page(var,actions) + end + end +end + function specials.url(var,actions) -- better resolve in strc-ref local url = var.operation if url then diff --git a/tex/context/base/node-fin.mkiv b/tex/context/base/node-fin.mkiv index 9a5ce6f32..ea9e83f16 100644 --- a/tex/context/base/node-fin.mkiv +++ b/tex/context/base/node-fin.mkiv @@ -27,6 +27,8 @@ % tricky stuff: +% THIS MIGHT BECOME OBSOLETE. + \newcount\attributeboxcount \edef\startinheritattributes{\attribute\triggerattribute\plusone} diff --git a/tex/context/base/ppchtex.mkii b/tex/context/base/ppchtex.mkii index 285b0004e..045e9808b 100644 --- a/tex/context/base/ppchtex.mkii +++ b/tex/context/base/ppchtex.mkii @@ -1477,7 +1477,6 @@ \getvalue{\s!chemicallinesegment#22}% \undochemicaloffset} - \def\getprivatechemicallinesegment[#1][#2]% {\chemicalrotate[#1]% \getvalue{\s!chemicallinesegment#2#1}} @@ -1531,8 +1530,104 @@ \def\processchemicalunrotatedlinesegment#1% {\doprocesschemicallinesegment3{#1}\getchemicallinesegment} -\def\processchemicaldashedlinesegment% +\def\processchemicaldashedlinesegment {\doprocesschemicallinesegment4c\getchemicallinesegment} + +\def\plotchemicaldasheddeltaline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + z20 = z2 rotatedaround(z1,+5) ; + z21 = z2 rotatedaround(z1,-5) ; + draw (z1 rotatedaround(origin,-\chemicalangle)) shifted z0 ; + save n ; n := 5 ; + for i=1 upto n : + draw ((((z20--z21) shifted -z2) shifted (i/n)[z2,z1]) + rotatedaround(origin,-\chemicalangle)) shifted z0 ; + endfor + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\plotchemicalwavyline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + save d ; pair d ; + d := z2 rotatedaround(z1,+5) shifted -z2 ; + save n ; n := 4 ; + draw ((for i=0 upto n-1 : + ((i)/n)[z1,z2] .. + ((i+.25)/n)[z1,z2] shifted d .. + ((i+.50)/n)[z1,z2] .. + ((i+.75)/n)[z1,z2] shifted -d .. + endfor + z2) rotatedaround(origin,-\chemicalangle)) shifted z0 ; + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\processchemicaldasheddeltalinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicaldasheddeltaline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processchemicalwavylinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicalwavyline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} \def\processchemicalopenend#1#2% {\doprocesschemicallinesegment0c\doprocesschemicalopenend{#1}{#2}} @@ -2395,6 +2490,8 @@ DB##3##4##5=>\processchemicallinesegment{DB}{##3##4##5}, SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, BB##3##4##5=>\processchemicaldeltalinesegment{SB}{##3##4##5}, + BD##3##4##5=>\processchemicaldasheddeltalinesegment{SB}{##3##4##5}, + BW##3##4##5=>\processchemicalwavylinesegment{SB}{##3##4##5}, SD##3##4##5=>\processchemicaldashedlinesegment{SB}{##3##4##5}, TB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}% \processchemicallinesegment{DB}{##3##4##5}, diff --git a/tex/context/base/ppchtex.mkiv b/tex/context/base/ppchtex.mkiv index f0fc54bcc..8ea089627 100644 --- a/tex/context/base/ppchtex.mkiv +++ b/tex/context/base/ppchtex.mkiv @@ -1455,8 +1455,104 @@ \def\processchemicalunrotatedlinesegment#1% {\doprocesschemicallinesegment3{#1}\getchemicallinesegment} -\def\processchemicaldashedlinesegment% +\def\processchemicaldashedlinesegment {\doprocesschemicallinesegment4c\getchemicallinesegment} + +\def\plotchemicaldasheddeltaline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + z20 = z2 rotatedaround(z1,+5) ; + z21 = z2 rotatedaround(z1,-5) ; + draw (z1 rotatedaround(origin,-\chemicalangle)) shifted z0 ; + save n ; n := 5 ; + for i=1 upto n : + draw ((((z20--z21) shifted -z2) shifted (i/n)[z2,z1]) + rotatedaround(origin,-\chemicalangle)) shifted z0 ; + endfor + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\plotchemicalwavyline#1#2#3#4% + {\!!counta=#1\!!countb=#2\!!countc=#3\!!countd=#4\relax + \ifnum\chemicaldrawingmode=2 + \global\MPdrawingdonetrue + \setchemicalattributes + \startMPdrawing + x0 := \MPdivten[\chemicalxoffset]u ; + y0 := \MPdivten[\chemicalyoffset]u ; + x1 := \MPdivten[\the\!!counta]u ; + y1 := \MPdivten[\the\!!countb]u ; + x2 := \MPdivten[\the\!!countc]u ; + y2 := \MPdivten[\the\!!countd]u ; + save d ; pair d ; + d := z2 rotatedaround(z1,+5) shifted -z2 ; + save n ; n := 4 ; + draw ((for i=0 upto n-1 : + ((i)/n)[z1,z2] .. + ((i+.25)/n)[z1,z2] shifted d .. + ((i+.50)/n)[z1,z2] .. + ((i+.75)/n)[z1,z2] shifted -d .. + endfor + z2) rotatedaround(origin,-\chemicalangle)) shifted z0 ; + \stopMPdrawing + \account{#1}{#2}% + \account{#3}{#4}% + \else + \doplotchemicalline + \advance\!!countc by 16 \advance\!!countd by -21 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -8 \advance\!!countd by 14 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \advance\!!countc by -4 \advance\!!countd by 7 + \doplotchemicalline + \fi} + +\def\processchemicaldasheddeltalinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicaldasheddeltaline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} + +\def\processchemicalwavylinesegment#1#2% + {\bgroup + \def\plotchemicalline{\plotchemicalwavyline}% + \doprocesschemicallinesegment0c\getchemicallinesegment{#1}{#2}% + \egroup} \def\processchemicalopenend#1#2% {\doprocesschemicallinesegment0c\doprocesschemicalopenend{#1}{#2}} @@ -2227,6 +2323,9 @@ % afstand dubbele radikalen : 260 % afstand substituenten : +125 + + + \def\executechemicalONE[#1]% {\setchemicalname ONE % @@ -2312,6 +2411,8 @@ DB##3##4##5=>\processchemicallinesegment{DB}{##3##4##5}, SB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}, BB##3##4##5=>\processchemicaldeltalinesegment{SB}{##3##4##5}, + BD##3##4##5=>\processchemicaldasheddeltalinesegment{SB}{##3##4##5}, + BW##3##4##5=>\processchemicalwavylinesegment{SB}{##3##4##5}, SD##3##4##5=>\processchemicaldashedlinesegment{SB}{##3##4##5}, TB##3##4##5=>\processchemicallinesegment{SB}{##3##4##5}% \processchemicallinesegment{DB}{##3##4##5}, diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv index b36106f11..f9d573707 100644 --- a/tex/context/base/strc-des.mkiv +++ b/tex/context/base/strc-des.mkiv @@ -629,14 +629,10 @@ \newtoks \everyenumeration \newconditional\enumerationnumberenabled -\chardef \enumerationcouplingmode \zerocount \def \enumerationdisablenumbersignal {-} \appendtoks \disablepseudocaps \to \everyenumeration % sorry, uppercase causes troubles -\letvalue{\??dd:\c!couplingway:\v!local }\plusone -\letvalue{\??dd:\c!couplingway:\v!global}\plustwo - \setvalue{\??dd:\v!enumeration:\s!handler:\s!number}{\@@doenumerationnumber} \setvalue{\??dd:\v!enumeration:\s!handler:\s!text }{\@@doenumerationtext} \setvalue{\??dd:\v!enumeration:\s!handler }{\@@doenumerationhandler} @@ -697,32 +693,32 @@ \def\doenumerationrestorecounter {\restorestructurecounter[\currentdescriptionnumber]} \def\doenumerationincrementcounter{\doincrementsubstructurecounter[\currentdescriptionnumber][\currentdescriptionlevel]} +% to be used in for instance: +% +% coupling=questions .... coupling=answers +% +% we will provide some more control, like skipping etc or reference relates + \def\doenumerationcheckconditions {\doifelse{\descriptionparameter\c!number}\v!yes {\ifx\currentdescriptionreference\enumerationdisablenumbersignal \setfalse\enumerationnumberenabled \else \settrue\enumerationnumberenabled \fi}% {\setfalse\enumerationnumberenabled}% - \chardef\enumerationcouplingmode \iflocation - \executeifdefined{\??dd:\c!couplingway:\descriptionparameter\c!coupling}\zerocount - \else - \zerocount - \fi} + \edef\currentenumerationcoupling{\descriptionparameter\c!coupling}} \def\doenumerationregistercoupling {\iflocation - \ifcase\enumerationcouplingmode - \or - % todo - \or - % todo - \fi + % no area yet, we will provide variants some day \fi} \def\doenumerationcouplingsymbol - {\iflocation\ifcase\enumerationcouplingmode \else - % todo - \fi\fi} + {\iflocation \ifx\currentenumerationcoupling\empty\else + \symbolreference[order(description:\currentenumerationcoupling:\nextinternalorderreference)]% + \fi \fi} + +\def\skipenumerationcoupling[#1]% e.g. for questions with no answer + {\ctxlua{jobreferences.setnextorder("description","#1")}} \def\showdnpuretext{\strut\descriptionparameter\c!text} % geen spatie \def\showdnlisttext{\descriptionparameter\c!listtext} % space in default @@ -822,7 +818,8 @@ \glet\currentdescriptionsynchronize\relax \glet\currentdescriptionattribute \relax \else - \setnextinternalreference + %\setnextinternalreference + \setnextinternalreferences{description}\currentdescriptionname % plural \xdef\currentdescriptionnumberentry{\ctxlua{structure.lists.push{ metadata = { kind = "description", @@ -832,6 +829,7 @@ }, references = { internal = \nextinternalreference, + order = \nextinternalorderreference, reference = "\currentdescriptionreference", referenceprefix = "\referenceprefix", block = "\currentstructureblock", diff --git a/tex/context/base/strc-lst.lua b/tex/context/base/strc-lst.lua index 2cf8d4947..5f6726d44 100644 --- a/tex/context/base/strc-lst.lua +++ b/tex/context/base/strc-lst.lua @@ -11,10 +11,11 @@ if not modules then modules = { } end modules ['strc-lst'] = { -- section, metadata cache (internal then has to move up one level) or a -- shared cache [we can use a fast and stupid serializer] -local format, gmatch = string.format, string.gmatch +local format, gmatch, gsub = string.format, string.gmatch, string.gsub local tonumber = tonumber local texsprint, texprint, texwrite, texcount = tex.sprint, tex.print, tex.write, tex.count local concat, insert, remove = table.concat, table.insert, table.remove +local lpegmatch = lpeg.match local trace_lists = false trackers.register("structure.lists", function(v) trace_lists = v end) @@ -136,18 +137,19 @@ function lists.popnesting() lists.result = old.result end +-- will be split + local function filter_collected(names, criterium, number, collected, nested) local numbers, depth = documents.data.numbers, documents.data.depth local hash, result, all, detail = { }, { }, not names or names == "" or names == variables.all, nil + names, criterium = gsub(names," ",""), gsub(criterium," ","") + if trace_lists then + logs.report("lists","filtering names: %s, criterium: %s, number: %s",names,criterium,number or "-") + end if not all then - for s in gmatch(names,"[^, ]+") do - if trace_lists then - logs.report("lists","filtering: %s",s) - end + for s in gmatch(names,"[^, ]+") do -- sort of settings to hash hash[s] = true end - elseif trace_lists then - logs.report("lists","filtering all") end if criterium == variables.intro then -- special case, no structure yet @@ -204,7 +206,7 @@ local function filter_collected(names, criterium, number, collected, nested) end end elseif criterium == variables.here then - -- this is qquite dirty ... as cnumbers is not sparse we can misuse #cnumbers + -- this is quite dirty ... as cnumbers is not sparse we can misuse #cnumbers if depth == 0 then return filter_collected(names,variables.intro,number,collected) else @@ -456,3 +458,25 @@ function lists.prefixednumber(name,n,prefixspec,numberspec) end end end + +-- todo, do this in references namespace ordered instead (this is an experiment) +-- +-- also see lpdf-ano (maybe move this there) + +local splitter = lpeg.splitat(":") + +function jobreferences.specials.order(var,actions) -- jobreferences.specials ! + local operation = var.operation + if operation then + local kind, name, n = lpegmatch(splitter,operation) + local order = lists.ordered[kind] + order = order and order[name] + local v = order[tonumber(n)] + local r = v and v.references.realpage + if r then + actions.realpage = r + var.operation = r -- brrr, but test anyway + return jobreferences.specials.page(var,actions) + end + end +end diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv index 79a9f2e8f..b13ee5371 100644 --- a/tex/context/base/strc-lst.mkiv +++ b/tex/context/base/strc-lst.mkiv @@ -544,12 +544,13 @@ {[\currentlist: #3 -- #4 -- #5]}} \def\domakelistelement#1#2#3#4% ref internal command data - {\dontleavehmode - \doifnot{\listparameter\c!interaction}{#1}\locationfalse - \iflocation - \directgotobox{\setlocationcolor\??ia#4}[internal(#2)]% + {\dontleavehmode + \iflocation % we cannot tewak \iflocation as we nest + \doifelse{\listparameter\c!interaction}{#1} + {\directgoto{\setlocationcolor\??ia#4}[internal(#2)]}% was \directgotobox + {#3{#4}}% \else - #3{#4}% + #3{#4}% \fi} \def\dodofreelistelement#1#2#3#4#5#6#7#8% @@ -616,8 +617,8 @@ {\!!widtha\listparameter\c!width}}% \getvalue{\??li\c!alternative\listparameter\c!alternative}% \endgraf - \doif{\listparameter\c!interaction}\v!text % not supported ! ! ! ! ! ! text == all - {\setlistparameter\currentlist\c!interaction\v!all}% +% \doif{\listparameter\c!interaction}\v!text % not supported ! ! ! ! ! ! text == all +% {\setlistparameter\currentlist\c!interaction\v!all}% % \dontleavehmode % new, else no margin, but wrong, better (else \indent as well): \noindent \domakelistelement\v!all{#2}\hbox @@ -668,6 +669,7 @@ \leavevmode \box2\relax \hskip\dimen2 +\domakelistelement\v!text{#2}\firstofoneargument{% \bgroup \donestedlistattributes\c!textstyle\c!textcolor {\let\\=\newlineinlist @@ -676,6 +678,7 @@ \limitatedlistentry{#4}}% %\carryoverpar % new otherwise wrong linespacing \egroup +}% \ifdim\wd4=\zeropoint\relax % \ifvoid4 % \ifdim\!!widtha<\hsize \hfill\strut \fi % spoils align \else @@ -724,17 +727,20 @@ \ifvmode \noindent\leavevmode % leavevmode ? ? ? \fi +%% actually, the next can be supported now (will be enabled when I have time to test it) \doif{\listparameter\c!interaction}\v!text % not supported {\setlistparameter\currentlist\c!interaction\v!sectionnumber}% \doif{\listparameter\c!interaction}\v!all % not supported {\setlistparameter\currentlist\c!interaction\v!sectionnumber}% +%% \setbox4\hbox {\doif{\listparameter\c!pagenumber}\v!yes {\doifsomething{#5} {\domakelistelement\v!pagenumber{#2}\hbox {\donestedlistattributes\c!pagestyle\c!pagecolor {\listparameter\c!pagecommand{#5}}}}}}% - \doif{\listparameter\c!headnumber}\v!yes +%% \domakelistelement\v!all{#2}\firstofoneargument{% + \doif{\listparameter\c!headnumber}\v!yes {\donetrue \doifnothing{#3}{\doifnothing{\listparameter\c!symbol}\donefalse}% % == \doifnothing{#3\listparameter\c!symbol}\donefalse @@ -749,17 +755,20 @@ \nobreak \fi}% \tolerance3500 % niet zomaar veranderen +%% \domakelistelement\v!text{#2}\firstofoneargument{% \donestedlistattributes\c!textstyle\c!textcolor {\let\\=\newlineinlist \dontconvertfont %\listparameter\c!textcommand{#4}}% \limitatedlistentry{#4}}% +%% }% \ifvoid4\else \nobreak \hskip.75em\relax \nobreak \box4 \fi +%% }% \dimen0=\listparameter\c!distance\relax \ifdim\dimen0<1em\relax \hskip1em\!!plus1em\!!minus.25em\relax diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua index b21b6e524..52bc2a51b 100644 --- a/tex/context/base/strc-ref.lua +++ b/tex/context/base/strc-ref.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['strc-ref'] = { local format, find, gmatch, match, concat = string.format, string.find, string.gmatch, string.match, table.concat local lpegmatch = lpeg.match -local texsprint, texwrite, texcount = tex.sprint, tex.write, tex.count +local texsprint, texwrite, texcount, texsetcount = tex.sprint, tex.write, tex.count, tex.setcount local trace_referencing = false trackers.register("structure.referencing", function(v) trace_referencing = v end) @@ -70,6 +70,33 @@ end -- todo: delay split till later as in destinations we split anyway +local orders, lastorder = { }, 0 + +local function setnextorder(kind,name) + lastorder = 0 + if kind and name then + local ok = orders[kind] + if not ok then + ok = { } + orders[kind] = ok + end + lastorder = (ok[name] or 0) + 1 + ok[name] = lastorder + end + texsetcount("global","locationorder",lastorder) +end + +jobreferences.setnextorder = setnextorder + +function jobreferences.setnextinternal(kind,name) + setnextorder(kind,name) -- always incremented with internal + texsetcount("global","locationcount",texcount.locationcount + 1) +end + +function jobreferences.currentorder(kind,name) + texwrite((orders[kind] and orders[kind][name]) or lastorder) +end + function jobreferences.set(kind,prefix,tag,data) for ref in gmatch(tag,"[^,]+") do local p, r = match(ref,"^(%-):(.-)$") @@ -877,7 +904,7 @@ jobreferences.current_metadata = current_metadata function jobreferences.get_current_prefixspec(default) -- todo: message texsprint(ctxcatcodes,"\\getreferencestructureprefix{", - current_metadata("kind"), "}{", current_metadata("name") or "?", "}{", default, "}") + current_metadata("kind") or "?", "}{", current_metadata("name") or "?", "}{", default or "?", "}") end --~ function jobreferences.get_current_prefixspec(default) -- we can consider storing the data at the lua end @@ -1093,7 +1120,6 @@ function jobreferences.analyse(actions) return actions end - function jobreferences.realpage() -- special case, we always want result local cs = jobreferences.analyse() texwrite(cs.realpage or 0) @@ -1146,7 +1172,7 @@ end specials.i = specials.internal -function specials.page(var,actions) +function specials.page(var,actions) -- is this ok? local p = pages[var.operation] if type(p) == "function" then p = p() diff --git a/tex/context/base/strc-ref.mkiv b/tex/context/base/strc-ref.mkiv index a50c7d714..d8fe470d1 100644 --- a/tex/context/base/strc-ref.mkiv +++ b/tex/context/base/strc-ref.mkiv @@ -514,16 +514,25 @@ %D \gotosomeinternal {tag}{identifier}{pagenumber}{text} %D \stoptyping +%D We could do this in lua ... + \newif \iflocation \newcount\locationcount +\newcount\locationorder \newbox \locationbox -\def\nextinternalreference - {\the\locationcount} +\def\nextinternalreference {\the\locationcount} +\def\nextinternalorderreference{\the\locationorder} \def\setnextinternalreference {\global\advance\locationcount\plusone} +\def\setnextinternalreferences#1#2% plural + {\ctxlua{jobreferences.setnextinternal("#1","#2")}} + +\def\getinternalorderreference#1#2% + {\ctxlua{jobreferences.currentorder("#1","#2")}} + \def\thisissomeinternal#1#2% tag reference (only for old time sake) {\begingroup\attribute\destinationattribute\ctxlua{jobreferences.mark("#1:#2")}\hbox{}\endgroup} @@ -811,18 +820,41 @@ \fi}[#1]} {[?]}} +\unexpanded\def\referencesymbol + {\hbox{\strut\high + {\setupsymbolset[\@@iasymbolset]% + \symbol + [\ifcase\referencepagestate + \v!somewhere + \or % same + \v!nowhere + \or % before + \v!previous + \or % after + \v!next% + \fi]}}} + +% \def\dosymbolreference#1#2[#3]% +% {\removeunwantedspaces +% \goto{\setupsymbolset[\@@iasymbolset]\high{\symbol +% [\ifcase\referencepagestate +% \v!somewhere +% \or % same +% \v!nowhere +% \or % before +% \v!previous +% \or % after +% \v!next% +% \fi]}}[#3]} + \def\dosymbolreference#1#2[#3]% {\removeunwantedspaces - \goto{\setupsymbolset[\@@iasymbolset]\high{\symbol - [\ifcase\referencepagestate - \v!somewhere - \or % same - \v!nowhere - \or % before - \v!previous - \or % after - \v!next% - \fi]}}[#3]} + \goto{\referencesymbol}[#3]} + +\def\symbolreference[#1]% + {\removeunwantedspaces + \goto{\referencesymbol}[#1]} + %D The other alternatives just conform their names: only the %D label, only the text, or the label and the text. diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index bcbe715a1..8a7d3be48 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 01/22/10 19:15:02 +-- merge date : 01/25/10 11:14:13 do -- begin closure to overcome local limits and interference -- cgit v1.2.3