summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/attr-ini.mkiv4
-rw-r--r--tex/context/base/back-exp.lua36
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4140 -> 4138 bytes
-rw-r--r--tex/context/base/context-version.pngbin105499 -> 104769 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-ota.lua2
-rw-r--r--tex/context/base/font-otn.lua44
-rw-r--r--tex/context/base/l-lpeg.lua48
-rw-r--r--tex/context/base/l-string.lua2
-rw-r--r--tex/context/base/l-table.lua10
-rw-r--r--tex/context/base/lang-txt.lua88
-rw-r--r--tex/context/base/luat-mac.lua34
-rw-r--r--tex/context/base/node-fin.lua24
-rw-r--r--tex/context/base/node-inj.lua4
-rw-r--r--tex/context/base/node-ref.lua36
-rw-r--r--tex/context/base/node-shp.lua106
-rw-r--r--tex/context/base/regi-ini.lua99
-rw-r--r--tex/context/base/spac-ver.lua66
-rw-r--r--tex/context/base/spac-ver.mkiv61
-rw-r--r--tex/context/base/status-files.pdfbin24585 -> 24568 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin195620 -> 195680 bytes
-rw-r--r--tex/context/base/strc-not.mkvi19
-rw-r--r--tex/context/base/tabl-tbl.mkiv131
-rw-r--r--tex/context/base/util-sql.lua2
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua112
28 files changed, 648 insertions, 288 deletions
diff --git a/tex/context/base/attr-ini.mkiv b/tex/context/base/attr-ini.mkiv
index 8a41dd427..377960f9f 100644
--- a/tex/context/base/attr-ini.mkiv
+++ b/tex/context/base/attr-ini.mkiv
@@ -85,10 +85,10 @@
%D For the moment we put this here (later it will move to where it's used):
\definesystemattribute [state]
+\definesystemattribute [color] [public]
+\definesystemattribute [colormodel] [public,global]
\definesystemattribute [skip]
\definesystemattribute [penalty]
-\definesystemattribute [colormodel] [public,global]
-\definesystemattribute [color] [public]
\definesystemattribute [transparency] [public]
\definesystemattribute [background] [public]
\definesystemattribute [colorintent] [public]
diff --git a/tex/context/base/back-exp.lua b/tex/context/base/back-exp.lua
index 46ce4f96c..56d300ba3 100644
--- a/tex/context/base/back-exp.lua
+++ b/tex/context/base/back-exp.lua
@@ -1937,24 +1937,6 @@ local function collectresults(head,list) -- is last used (we also have currentat
end
end
end
- elseif id == hlist_code or id == vlist_code then
- local ai = has_attribute(n,a_image)
- if ai then
- local at = has_attribute(n,a_tagged)
- if nofcurrentcontent > 0 then
- pushcontent()
- pushentry(currentnesting) -- ??
- end
- pushentry(taglist[at]) -- has an index, todo: flag empty element
- if trace_export then
- report_export("%s<!-- processing image (tag %s)",spaces[currentdepth],last)
- end
- last = nil
- currentparagraph = nil
- else
- -- we need to determine an end-of-line
- collectresults(n.list,n)
- end
elseif id == disc_code then -- probably too late
if keephyphens then
local pre = n.pre
@@ -2094,6 +2076,24 @@ local function collectresults(head,list) -- is last used (we also have currentat
return
end
end
+ elseif id == hlist_code or id == vlist_code then
+ local ai = has_attribute(n,a_image)
+ if ai then
+ local at = has_attribute(n,a_tagged)
+ if nofcurrentcontent > 0 then
+ pushcontent()
+ pushentry(currentnesting) -- ??
+ end
+ pushentry(taglist[at]) -- has an index, todo: flag empty element
+ if trace_export then
+ report_export("%s<!-- processing image (tag %s)",spaces[currentdepth],last)
+ end
+ last = nil
+ currentparagraph = nil
+ else
+ -- we need to determine an end-of-line
+ collectresults(n.list,n)
+ end
elseif id == kern_code then
local kern = n.kern
if kern > 0 then
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 2c07401d8..a9c083588 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.19 00:06}
+\newcontextversion{2012.10.20 02:07}
%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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index e791d3ba8..e69a0d016 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2012.10.19 00:06}
+\newcontextversion{2012.10.20 02:07}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 5b6793083..2f7df127d 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 2df1bdb1b..cccfe00f0 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 3163097b0..0748eb032 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.19 00:06}
+\edef\contextversion{2012.10.20 02:07}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 3d93b64c3..8f7888f14 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2012.10.19 00:06}
+\edef\contextversion{2012.10.20 02:07}
%D For those who want to use this:
diff --git a/tex/context/base/font-ota.lua b/tex/context/base/font-ota.lua
index 8262f983e..5b2c3f22a 100644
--- a/tex/context/base/font-ota.lua
+++ b/tex/context/base/font-ota.lua
@@ -309,7 +309,7 @@ function methods.arab(head,font,attr) -- maybe make a special version with no tr
local marks = tfmdata.resources.marks
local first, last, current, done = nil, nil, head, false
while current do
- if current.id == glyph_code and current.subtype<256 and current.font == font and not has_attribute(current,state) then
+ if current.id == glyph_code and current.font == font and current.subtype<256 and not has_attribute(current,state) then
done = true
local char = current.char
if marks[char] or (useunicodemarks and categories[char] == "mn") then
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 2c670825a..6e465ece9 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -639,7 +639,7 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence)
if marks[startchar] then
while s do
local id = s.id
- if id == glyph_code and s.subtype<256 and s.font == currentfont then
+ if id == glyph_code and s.font == currentfont and s.subtype<256 then
local lg = ligature[s.char]
if lg then
stop = s
@@ -724,12 +724,12 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -785,12 +785,12 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [optional marks] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -863,7 +863,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence)
end
end
end
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then -- subtype test can go
local basechar = base.char
local baseanchors = descriptions[basechar]
if baseanchors then
@@ -914,7 +914,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to
end
else
local nxt = start.next
- while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do
+ while not done and nxt and nxt.id == glyph_code and nxt.font == currentfont and nxt.subtype<256 do
local nextchar = nxt.char
if marks[nextchar] then
-- should not happen (maybe warning)
@@ -978,7 +978,7 @@ function handlers.gpos_pair(start,kind,lookupname,kerns,sequence)
local prev, done = start, false
local factor = tfmdata.parameters.factor
local lookuptype = lookuptypes[lookupname]
- while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do
+ while snext and snext.id == glyph_code and snext.font == currentfont and snext.subtype<256 do
local nextchar = snext.char
local krn = kerns[nextchar]
if not krn and marks[nextchar] then
@@ -1370,12 +1370,12 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,look
end
if markanchors then
local base = start.prev -- [glyph] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -1434,12 +1434,12 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,
end
if markanchors then
local base = start.prev -- [glyph] [optional marks] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -1520,7 +1520,7 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,look
end
end
end
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then -- subtype test can go
local basechar = base.char
local baseanchors = descriptions[basechar].anchors
if baseanchors then
@@ -1580,7 +1580,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,lookup
end
else
local nxt = start.next
- while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do
+ while not done and nxt and nxt.id == glyph_code and nxt.font == currentfont and nxt.subtype<256 do
local nextchar = nxt.char
if marks[nextchar] then
-- should not happen (maybe warning)
@@ -1661,7 +1661,7 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,lookuphas
local lookuptype = lookuptypes[lookupname]
local prev, done = start, false
local factor = tfmdata.parameters.factor
- while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do
+ while snext and snext.id == glyph_code and snext.font == currentfont and snext.subtype<256 do
local nextchar = snext.char
local krn = kerns[nextchar]
if not krn and marks[nextchar] then
@@ -1754,7 +1754,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
-- f..l = mid string
if s == 1 then
-- never happens
- match = current.id == glyph_code and current.subtype<256 and current.font == currentfont and seq[1][current.char]
+ match = current.id == glyph_code and current.font == currentfont and current.subtype<256 and seq[1][current.char]
else
-- maybe we need a better space check (maybe check for glue or category or combination)
-- we cannot optimize for n=2 because there can be disc nodes
@@ -1774,7 +1774,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if last then
local id = last.id
if id == glyph_code then
- if last.subtype<256 and last.font == currentfont then
+ if last.font == currentfont and last.subtype<256 then
local char = last.char
local ccd = descriptions[char]
if ccd then
@@ -1824,7 +1824,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if prev then
local id = prev.id
if id == glyph_code then
- if prev.subtype<256 and prev.font == currentfont then -- normal char
+ if prev.font == currentfont and prev.subtype<256 then -- normal char
local char = prev.char
local ccd = descriptions[char]
if ccd then
@@ -1885,7 +1885,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if current then
local id = current.id
if id == glyph_code then
- if current.subtype<256 and current.font == currentfont then -- normal char
+ if current.font == currentfont and current.subtype<256 then -- normal char
local char = current.char
local ccd = descriptions[char]
if ccd then
@@ -2227,7 +2227,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = a == attr
@@ -2279,7 +2279,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = (a == attr) and (not attribute or has_attribute(start,state,attribute))
@@ -2352,7 +2352,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = (a == attr) and (not attribute or has_attribute(start,state,attribute))
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index d92b722ed..38ac3c0dd 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -431,15 +431,10 @@ end
function lpeg.replacer(one,two)
if type(one) == "table" then
local no = #one
- local p
+ local p = P(false)
if no == 0 then
for k, v in next, one do
- local pp = P(k) / v
- if p then
- p = p + pp
- else
- p = pp
- end
+ p = p + P(k) / v
end
return Cs((p + 1)^0)
elseif no == 1 then
@@ -449,12 +444,7 @@ function lpeg.replacer(one,two)
else
for i=1,no do
local o = one[i]
- local pp = P(o[1]) / o[2]
- if p then
- p = p + pp
- else
- p = pp
- end
+ p = p + P(o[1]) / o[2]
end
return Cs((p + 1)^0)
end
@@ -585,13 +575,9 @@ lpeg.UP = lpeg.P
if utfcharacters then
function lpeg.US(str)
- local p
+ local p = P(false)
for uc in utfcharacters(str) do
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
return p
end
@@ -600,13 +586,9 @@ if utfcharacters then
elseif utfgmatch then
function lpeg.US(str)
- local p
+ local p = P(false)
for uc in utfgmatch(str,".") do
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
return p
end
@@ -614,13 +596,9 @@ elseif utfgmatch then
else
function lpeg.US(str)
- local p
+ local p = P(false)
local f = function(uc)
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
lpegmatch((utf8char/f)^0,str)
return p
@@ -646,13 +624,9 @@ function lpeg.UR(str,more)
if first == last then
return P(str)
elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium
- local p
+ local p = P(false)
for i=first,last do
- if p then
- p = p + P(utfchar(i))
- else
- p = P(utfchar(i))
- end
+ p = p + P(utfchar(i))
end
return p -- nil when invalid range
else
diff --git a/tex/context/base/l-string.lua b/tex/context/base/l-string.lua
index 03616aa19..857acb019 100644
--- a/tex/context/base/l-string.lua
+++ b/tex/context/base/l-string.lua
@@ -128,7 +128,7 @@ string.itself = function(s) return s end
-- also handy (see utf variant)
-local pattern = Ct(C(1)^0)
+local pattern = Ct(C(1)^0) -- string and not utf !
function string.totable(str)
return lpegmatch(pattern,str)
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index 80f28c2cd..8d18452d2 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -146,6 +146,16 @@ local function sortedhashkeys(tab) -- fast one
end
end
+function table.allkeys(t)
+ local keys = { }
+ for i=1,#t do
+ for k, v in next, t[i] do
+ keys[k] = true
+ end
+ end
+ return sortedkeys(keys)
+end
+
table.sortedkeys = sortedkeys
table.sortedhashkeys = sortedhashkeys
diff --git a/tex/context/base/lang-txt.lua b/tex/context/base/lang-txt.lua
index 7b0e046fe..4c3a3a985 100644
--- a/tex/context/base/lang-txt.lua
+++ b/tex/context/base/lang-txt.lua
@@ -24,7 +24,7 @@ if not modules then modules = { } end modules ['lang-txt'] = {
-- da Danish Arne Jorgensen
-- de German Tobias Burnus, ...
-- en English Hans Hagen, ...
--- es Spanish ...
+-- es Spanish Andrés Montoya, ...
-- fi Finish ...
-- fr French Daniel Flipo, Arthur Reutenauer
-- gr Greek Apostolos Syropoulos, Thomas Schmitz
@@ -75,6 +75,7 @@ data.labels={
labels={
cz="arccos",
en="arccos",
+ es="arc\\sixperemspace cos",
hr="arc\\sixperemspace cos",
pl="arc\\sixperemspace cos",
sk="arccos",
@@ -84,6 +85,7 @@ data.labels={
labels={
cz="arccotg",
en="arccot",
+ es="arc\\sixperemspace cot",
hr="arc\\sixperemspace ctg",
pl="arc\\sixperemspace ctg",
sk="arccotg",
@@ -93,6 +95,7 @@ data.labels={
labels={
cz="arcsin",
en="arcsin",
+ es="arc\\sixperemspace sen",
hr="arc\\sixperemspace sin",
pl="arc\\sixperemspace sin",
sk="arcsin",
@@ -102,6 +105,7 @@ data.labels={
labels={
cz="arctg",
en="arctan",
+ es="arc\\sixperemspace tan",
hr="arc\\sixperemspace tg",
pl="arc\\sixperemspace tg",
sk="arctg",
@@ -111,6 +115,7 @@ data.labels={
labels={
cz="arctg",
en="arctan",
+ es="arc\\sixperemspace tan",
hr="arc\\sixperemspace tg",
pl="arc\\sixperemspace tg",
sk="arctg",
@@ -120,6 +125,7 @@ data.labels={
labels={
cz="arg",
en="arg",
+ es="arg",
sk="arg",
},
},
@@ -127,6 +133,7 @@ data.labels={
labels={
cz="cos",
en="cos",
+ es="cos",
sk="cos",
},
},
@@ -134,6 +141,7 @@ data.labels={
labels={
cz="cosh",
en="cosh",
+ es="cosh",
sk="cosh",
},
},
@@ -141,6 +149,7 @@ data.labels={
labels={
cz="cotg",
en="cot",
+ es="cot",
hr="ctg",
pl="ctg",
sk="cotg",
@@ -150,6 +159,7 @@ data.labels={
labels={
cz="cotgh",
en="coth",
+ es="coth",
sk="cotgh",
},
},
@@ -157,6 +167,7 @@ data.labels={
labels={
cz="cosec",
en="csc",
+ es="csc",
sk="cosec",
},
},
@@ -164,6 +175,7 @@ data.labels={
labels={
cz="cotg",
en="cot",
+ es="cot",
hr="ctg",
pl="ctg",
sk="cotg",
@@ -173,6 +185,7 @@ data.labels={
labels={
cz="deg",
en="deg",
+ es="gr",
sk="deg",
},
},
@@ -180,6 +193,7 @@ data.labels={
labels={
cz="det",
en="det",
+ es="det",
sk="det",
},
},
@@ -187,6 +201,7 @@ data.labels={
labels={
cz="dim",
en="dim",
+ es="dim",
sk="dim",
},
},
@@ -194,6 +209,7 @@ data.labels={
labels={
cz="exp",
en="exp",
+ es="exp",
sk="exp",
},
},
@@ -201,6 +217,7 @@ data.labels={
labels={
cz="NSD",
en="gcd",
+ es="mcd",
hr="nzd",
nl="ggd",
sk="NSD",
@@ -210,6 +227,7 @@ data.labels={
labels={
cz="Hom",
en="hom",
+ es="hom",
sk="Hom",
},
},
@@ -217,6 +235,7 @@ data.labels={
labels={
cz="inf",
en="inf",
+ es="inf",
sk="inf",
},
},
@@ -224,6 +243,7 @@ data.labels={
labels={
cz="inj\\sixperemspace lim",
en="inj\\sixperemspace lim",
+ es="lím\\sixperemspace iny",
sk="inj\\sixperemspace lim",
},
},
@@ -231,6 +251,7 @@ data.labels={
labels={
cz="ker",
en="ker",
+ es="Ker",
sk="ker",
},
},
@@ -238,6 +259,7 @@ data.labels={
labels={
cz="NSN",
en="lcm",
+ es="MCM",
hr="nzv",
nl="kgv",
sk="NSN",
@@ -247,6 +269,7 @@ data.labels={
labels={
cz="log",
en="lg",
+ es="log",
sk="log",
},
},
@@ -254,6 +277,7 @@ data.labels={
labels={
cz="lim",
en="lim",
+ es="lím",
sk="lim",
},
},
@@ -261,6 +285,7 @@ data.labels={
labels={
cz="lim\\sixperemspace inf",
en="lim\\sixperemspace inf",
+ es="lím\\sixperemspace inf",
sk="lim\\sixperemspace inf",
},
},
@@ -268,6 +293,7 @@ data.labels={
labels={
cz="lim\\sixperemspace sup",
en="lim\\sixperemspace sup",
+ es="lím\\sixperemspace sup",
sk="lim\\sixperemspace sup",
},
},
@@ -275,6 +301,7 @@ data.labels={
labels={
cz="ln",
en="ln",
+ es="ln",
sk="ln",
},
},
@@ -282,6 +309,7 @@ data.labels={
labels={
cz="log",
en="log",
+ es="log",
sk="log",
},
},
@@ -289,6 +317,7 @@ data.labels={
labels={
cz="max",
en="max",
+ es="máx",
sk="max",
},
},
@@ -296,6 +325,7 @@ data.labels={
labels={
cz="\\tilde",
en="median",
+ es="Mediana",
sk="\\tilde",
},
},
@@ -303,6 +333,7 @@ data.labels={
labels={
cz="min",
en="min",
+ es="mín",
sk="min",
},
},
@@ -310,6 +341,7 @@ data.labels={
labels={
cz="mod",
en="mod",
+ es="mod",
sk="mod",
},
},
@@ -317,6 +349,7 @@ data.labels={
labels={
cz="proj\\sixperemspace lim",
en="proj\\sixperemspace lim",
+ es="lím\\sixperemspace proy",
sk="proj\\sixperemspace lim",
},
},
@@ -324,6 +357,7 @@ data.labels={
labels={
cz="sec",
en="sec",
+ es="sec",
sk="sec",
},
},
@@ -331,6 +365,7 @@ data.labels={
labels={
cz="sin",
en="sin",
+ es="sen",
sk="sin",
},
},
@@ -338,6 +373,7 @@ data.labels={
labels={
cz="sinh",
en="sinh",
+ es="senh",
sk="sinh",
},
},
@@ -345,6 +381,7 @@ data.labels={
labels={
cz="sup",
en="sup",
+ es="sup",
sk="sup",
},
},
@@ -352,6 +389,7 @@ data.labels={
labels={
cz="tg",
en="tan",
+ es="tan",
hr="tg",
pl="tg",
sk="tg",
@@ -361,6 +399,7 @@ data.labels={
labels={
cz="tgh",
en="tanh",
+ es="tanh",
sk="tgh",
},
},
@@ -368,6 +407,7 @@ data.labels={
labels={
cz="tg",
en="tan",
+ es="tan",
hr="tg",
pl="tg",
sk="tg",
@@ -383,7 +423,7 @@ data.labels={
da="",
de="und",
en="and",
- es="",
+ es="y",
fi="",
fr="",
gr="",
@@ -493,7 +533,7 @@ data.labels={
da="",
de="",
en="apr",
- es="",
+ es="abr.",
fi="",
fr="",
gr="",
@@ -527,7 +567,7 @@ data.labels={
da="på side ",
de="auf Seite ",
en="at page ",
- es="",
+ es="en la página ",
fi="",
fr="à la page ",
gr="",
@@ -600,7 +640,7 @@ data.labels={
da="",
de="",
en="aug",
- es="",
+ es="ago.",
fi="",
fr="",
gr="",
@@ -671,7 +711,7 @@ data.labels={
da="",
de="",
en=" (continued)",
- es="",
+ es=" (continúa)",
fi="",
fr="",
gr="",
@@ -743,7 +783,7 @@ data.labels={
da="",
de="",
en="dec",
- es="",
+ es="dic.",
fi="",
fr="",
gr="",
@@ -815,7 +855,7 @@ data.labels={
da="",
de="",
en="feb",
- es="",
+ es="feb.",
fi="",
fr="",
gr="",
@@ -850,7 +890,7 @@ data.labels={
da="Figur ",
de="Abbildung ",
en="Figure ",
- es="Ilustración ",
+ es="Figura ",
fi="Kuva ",
fr="Figure ",
gr="Σχήμα",
@@ -959,7 +999,7 @@ data.labels={
da="se foroven",
de="siehe oben",
en="as we show above",
- es="",
+ es="como se muestra arriba",
fi="",
fr="ci-dessus",
gr="",
@@ -994,7 +1034,7 @@ data.labels={
da="se forneden",
de="siehe unten",
en="as we show below",
- es="",
+ es="como se muestra abajo",
fi="",
fr="ci-dessous",
gr="",
@@ -1103,7 +1143,7 @@ data.labels={
da="",
de="",
en="jan",
- es="",
+ es="ene.",
fi="",
fr="",
gr="",
@@ -1176,7 +1216,7 @@ data.labels={
da="",
de="",
en="jul",
- es="",
+ es="jul.",
fi="",
fr="",
gr="",
@@ -1248,7 +1288,7 @@ data.labels={
da="",
de="",
en="jun",
- es="",
+ es="jun.",
fi="",
fr="",
gr="",
@@ -1393,7 +1433,7 @@ data.labels={
da="",
de="",
en="mar",
- es="",
+ es="mar.",
fi="",
fr="",
gr="",
@@ -1466,7 +1506,7 @@ data.labels={
da="",
de="",
en="may",
- es="",
+ es="may.",
fi="",
fr="",
gr="",
@@ -1575,7 +1615,7 @@ data.labels={
da="",
de="",
en="nov",
- es="",
+ es="nov.",
fi="",
fr="",
gr="",
@@ -1646,7 +1686,7 @@ data.labels={
da="",
de="",
en="oct",
- es="",
+ es="oct.",
fi="",
fr="",
gr="",
@@ -1680,7 +1720,7 @@ data.labels={
da="Side ",
de="Seite ",
en="page ",
- es="",
+ es="página ",
fi="",
fr="page ",
gr="",
@@ -1827,7 +1867,7 @@ data.labels={
da="se ",
de="siehe ",
en="see ",
- es="",
+ es="ver: ",
fi="",
fr="cf. ",
gr="",
@@ -1900,7 +1940,7 @@ data.labels={
da="",
de="",
en="sep",
- es="",
+ es="sep.",
fi="",
fr="",
gr="",
@@ -2270,7 +2310,7 @@ data.labels={
da="Indhold",
de="Inhalt",
en="Contents",
- es="Índice",
+ es="Contenido",
fi="Sisällys",
fr="Table des matières",
gr="Περιεχόμενα",
@@ -2307,7 +2347,7 @@ data.labels={
da="Figurer",
de="Abbildungen",
en="Figures",
- es="Ilustraciones",
+ es="Figuras",
fi="Kuvi",
fr="Figures",
gr="Σχήματα",
@@ -2381,7 +2421,7 @@ data.labels={
da="Indeks",
de="Index",
en="Index",
- es="Índice alfabético",
+ es="Índice",
fi="Indeksiluku",
fr="Index",
gr="Ευρετήριο",
diff --git a/tex/context/base/luat-mac.lua b/tex/context/base/luat-mac.lua
index 199332bba..e7f96359a 100644
--- a/tex/context/base/luat-mac.lua
+++ b/tex/context/base/luat-mac.lua
@@ -21,7 +21,7 @@ local insert, remove = table.insert, table.remove
local rep, sub = string.rep, string.sub
local setmetatable = setmetatable
local filesuffix = file.suffix
-local convertlmxstring = lmx.convertstring
+local convertlmxstring = lmx and lmx.convertstring
local pushtarget, poptarget = logs.pushtarget, logs.poptarget
@@ -128,6 +128,8 @@ local function matcherror(str,pos)
report_macros("runaway definition at: %s",sub(str,pos-30,pos))
end
+local csname_endcsname = P("\\csname") * (identifier + (1 - P("\\endcsname")))^1
+
local grammar = { "converter",
texcode = pushlocal
* startcode
@@ -146,7 +148,8 @@ local grammar = { "converter",
definition = pushlocal
* definer
* escapedname
- * (declaration + furthercomment + commentline + (1-leftbrace))^0
+-- * (declaration + furthercomment + commentline + (1-leftbrace))^0
+ * (declaration + furthercomment + commentline + csname_endcsname + (1-leftbrace))^0
* V("braced")
* poplocal,
setcode = pushlocal
@@ -269,8 +272,6 @@ function macros.processmk(str,filename)
return str
end
-utilities.sequencers.appendaction(resolvers.openers.helpers.textfileactions,"system","resolvers.macros.processmk")
-
function macros.processmkvi(str,filename)
if filename and filesuffix(filename) == "mkvi" or lpegmatch(checker,str) == "mkvi" then
local oldsize = #str
@@ -282,7 +283,14 @@ function macros.processmkvi(str,filename)
return str
end
-utilities.sequencers.appendaction(resolvers.openers.helpers.textfileactions,"system","resolvers.macros.processmkvi")
+local sequencers = utilities.sequencers
+
+if sequencers then
+
+ sequencers.appendaction(resolvers.openers.helpers.textfileactions,"system","resolvers.macros.processmk")
+ sequencers.appendaction(resolvers.openers.helpers.textfileactions,"system","resolvers.macros.processmkvi")
+
+end
-- bonus
@@ -366,6 +374,22 @@ end
-- }
-- ]]))
--
+-- print(macros.preprocessed([[
+-- \unexpanded\def\start#tag#stoptag%
+-- {\initialize{#tag}%
+-- \normalexpanded
+-- {\def\yes[#one]#two\csname\e!stop#stoptag\endcsname{\command_yes[#one]{#two}}%
+-- \def\nop #one\csname\e!stop#stoptag\endcsname{\command_nop {#one}}}%
+-- \doifnextoptionalelse\yes\nop}
+-- ]]))
+--
+-- print(macros.preprocessed([[
+-- \normalexpanded{\long\def\expandafter\noexpand\csname\e!start\v!interactionmenu\endcsname[#tag]#content\expandafter\noexpand\csname\e!stop\v!interactionmenu\endcsname}%
+-- {\def\currentinteractionmenu{#tag}%
+-- \expandafter\settrue\csname\??menustate\interactionmenuparameter\c!category\endcsname
+-- \setinteractionmenuparameter\c!menu{#content}}
+-- ]]))
+--
-- Just an experiment:
--
-- \catcode\numexpr"10FF25=\commentcatcode %% > 110000 is invalid
diff --git a/tex/context/base/node-fin.lua b/tex/context/base/node-fin.lua
index 27793716d..e0830de61 100644
--- a/tex/context/base/node-fin.lua
+++ b/tex/context/base/node-fin.lua
@@ -348,10 +348,6 @@ local function process(namespace,attribute,head,inheritance,default) -- one attr
local id = stack.id
if id == glyph_code then
check()
- elseif id == rule_code then
- if stack.width ~= 0 then
- check()
- end
elseif id == glue_code then
local content = stack.leader
if content and check() then
@@ -379,6 +375,10 @@ local function process(namespace,attribute,head,inheritance,default) -- one attr
done = done or ok
end
+ elseif id == rule_code then
+ if stack.width ~= 0 then
+ check()
+ end
end
stack = stack.next
end
@@ -534,10 +534,6 @@ local function selective(namespace,attribute,head,inheritance,default) -- two at
local id = stack.id
if id == glyph_code then
check()
- elseif id == rule_code then
- if stack.width ~= 0 then
- check()
- end
elseif id == glue_code then
local content = stack.leader
if content and check() then
@@ -573,6 +569,10 @@ local function selective(namespace,attribute,head,inheritance,default) -- two at
-- end
end
+ elseif id == rule_code then
+ if stack.width ~= 0 then
+ check()
+ end
end
stack = stack.next
end
@@ -617,10 +617,6 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in
local id = stack.id
if id == glyph_code then
check()
- elseif id == rule_code then
- if stack.width ~= 0 then
- check()
- end
elseif id == glue_code then
local content = stack.leader
if content and check() then
@@ -652,6 +648,10 @@ local function stacked(namespace,attribute,head,default) -- no triggering, no in
done = done or ok
end
end
+ elseif id == rule_code then
+ if stack.width ~= 0 then
+ check()
+ end
end
stack = stack.next
end
diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua
index 2cbcc8b88..4e0824fe9 100644
--- a/tex/context/base/node-inj.lua
+++ b/tex/context/base/node-inj.lua
@@ -37,14 +37,14 @@ local set_attribute = node.set_attribute
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
+local kernpair = attributes.private('kernpair')
+local ligacomp = attributes.private('ligacomp')
local markbase = attributes.private('markbase')
local markmark = attributes.private('markmark')
local markdone = attributes.private('markdone')
local cursbase = attributes.private('cursbase')
local curscurs = attributes.private('curscurs')
local cursdone = attributes.private('cursdone')
-local kernpair = attributes.private('kernpair')
-local ligacomp = attributes.private('ligacomp')
-- This injector has been tested by Idris Samawi Hamid (several arabic fonts as well as
-- the rather demanding Husayni font), Khaled Hosny (latin and arabic) and Kaj Eigner
diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua
index 2896c0d67..33d27e0ec 100644
--- a/tex/context/base/node-ref.lua
+++ b/tex/context/base/node-ref.lua
@@ -213,16 +213,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
while current do
local id = current.id
local r = has_attribute(current,attribute)
- if id == whatsit_code then
- local subtype = current.subtype
- if subtype == localpar_code then
- pardir = current.dir
- elseif subtype == dir_code then
- txtdir = current.dir
- end
- elseif id == glue_code and current.subtype == leftskip_code then -- any glue at the left?
- --
- elseif id == hlist_code or id == vlist_code then
+ if id == hlist_code or id == vlist_code then
-- somehow reference is true so the following fails (second one not done) in
-- test \goto{test}[page(2)] test \gotobox{test}[page(2)]
-- so let's wait till this fails again
@@ -241,6 +232,15 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
if r then
done[r] = done[r] - 1
end
+ elseif id == whatsit_code then
+ local subtype = current.subtype
+ if subtype == localpar_code then
+ pardir = current.dir
+ elseif subtype == dir_code then
+ txtdir = current.dir
+ end
+ elseif id == glue_code and current.subtype == leftskip_code then -- any glue at the left?
+ --
elseif not r then
-- just go on, can be kerns
elseif not reference then
@@ -272,19 +272,19 @@ local function inject_area(head,attribute,make,stack,done,parent,pardir,txtdir)
while current do
local id = current.id
local r = has_attribute(current,attribute)
- if id == whatsit_code then
+ if id == hlist_code or id == vlist_code then
+ if r and not done[r] then
+ done[r] = true
+ inject_list(id,current,r,make,stack,pardir,txtdir)
+ end
+ current.list = inject_area(current.list,attribute,make,stack,done,current,pardir,txtdir)
+ elseif id == whatsit_code then
local subtype = current.subtype
if subtype == localpar_code then
pardir = current.dir
elseif subtype == dir_code then
txtdir = current.dir
end
- elseif id == hlist_code or id == vlist_code then
- if r and not done[r] then
- done[r] = true
- inject_list(id,current,r,make,stack,pardir,txtdir)
- end
- current.list = inject_area(current.list,attribute,make,stack,done,current,pardir,txtdir)
elseif r and not done[r] then
done[r] = true
head, current = inject_range(head,current,current,r,make,stack,parent,pardir,txtdir)
@@ -305,8 +305,8 @@ local new_kern = nodepool.kern
local set_attribute = node.set_attribute
local register_color = colors.register
-local a_colormodel = attributes.private('colormodel')
local a_color = attributes.private('color')
+local a_colormodel = attributes.private('colormodel')
local a_transparency = attributes.private('transparency')
local u_transparency = nil
local u_colors = { }
diff --git a/tex/context/base/node-shp.lua b/tex/context/base/node-shp.lua
index 6fad0f495..8f7a411a7 100644
--- a/tex/context/base/node-shp.lua
+++ b/tex/context/base/node-shp.lua
@@ -8,20 +8,27 @@ if not modules then modules = { } end modules ['node-shp'] = {
local nodes, node = nodes, node
-local nodecodes = nodes.nodecodes
-local tasks = nodes.tasks
+local next, type = next, type
+local format = string.format
+local concat, sortedpairs = table.concat, table.sortedpairs
+local setmetatableindex = table.setmetatableindex
-local hlist_code = nodecodes.hlist
-local vlist_code = nodecodes.vlist
-local disc_code = nodecodes.disc
-local mark_code = nodecodes.mark
-local kern_code = nodecodes.kern
-local glue_code = nodecodes.glue
+local nodecodes = nodes.nodecodes
+local tasks = nodes.tasks
+local handlers = nodes.handlers
-local texbox = tex.box
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local disc_code = nodecodes.disc
+local mark_code = nodecodes.mark
+local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
-local free_node = node.free
-local remove_node = node.remove
+local texbox = tex.box
+
+local free_node = node.free
+local remove_node = node.remove
+local traverse_nodes = node.traverse
local function cleanup(head) -- rough
local start = head
@@ -50,21 +57,92 @@ directives.register("backend.cleanup", function()
tasks.enableaction("shipouts","nodes.handlers.cleanuppage")
end)
-function nodes.handlers.cleanuppage(head)
+function handlers.cleanuppage(head)
-- about 10% of the nodes make no sense for the backend
return cleanup(head), true
end
local actions = tasks.actions("shipouts") -- no extra arguments
-function nodes.handlers.finalize(head) -- problem, attr loaded before node, todo ...
+function handlers.finalize(head) -- problem, attr loaded before node, todo ...
return actions(head)
end
---~ nodes.handlers.finalize = actions
+-- handlers.finalize = actions
-- interface
function commands.finalizebox(n)
actions(texbox[n])
end
+
+-- just in case we want to optimize lookups:
+
+local frequencies = { }
+
+nodes.tracers.frequencies = frequencies
+
+local data = { }
+local done = false
+
+setmetatableindex(data,function(t,k)
+ local v = { }
+ setmetatableindex(v,function(t,k)
+ local v = { }
+ t[k] = v
+ setmetatableindex(v,function(t,k)
+ t[k] = 0
+ return 0
+ end)
+ return v
+ end)
+ t[k] = v
+ return v
+end)
+
+local function count(head,data,subcategory)
+ -- no components, pre, post, replace .. can maybe an option .. but
+ -- we use this for optimization so it makes sense to look the the
+ -- main node only
+ for n in traverse_nodes(head) do
+ local id = n.id
+ local dn = data[nodecodes[n.id]]
+ dn[subcategory] = dn[subcategory] + 1
+ if id == hlist_code or id == vlist_code then
+ count(n.list,data,subcategory)
+ end
+ end
+end
+
+local function register(category,subcategory)
+ return function(head)
+ done = true
+ count(head,data[category],subcategory)
+ return head, false
+ end
+end
+
+frequencies.register = register
+frequencies.filename = nil
+
+trackers.register("nodes.frequencies",function(v)
+ if type(v) == "string" then
+ frequencies.filename = v
+ end
+ handlers.frequencies_shipouts_before = register("shipouts", "begin")
+ handlers.frequencies_shipouts_after = register("shipouts", "end")
+ handlers.frequencies_processors_before = register("processors", "begin")
+ handlers.frequencies_processors_after = register("processors", "end")
+ tasks.prependaction("shipouts", "before", "nodes.handlers.frequencies_shipouts_before")
+ tasks.appendaction ("shipouts", "after", "nodes.handlers.frequencies_shipouts_after")
+ tasks.prependaction("processors", "before", "nodes.handlers.frequencies_processors_before")
+ tasks.appendaction ("processors", "after", "nodes.handlers.frequencies_processors_after")
+end)
+
+statistics.register("node frequencies", function()
+ if done then
+ local filename = frequencies.filename or (tex.jobname .. "-frequencies.lua")
+ io.savedata(filename,table.serialize(data,true))
+ return format("saved in %q",filename)
+ end
+end)
diff --git a/tex/context/base/regi-ini.lua b/tex/context/base/regi-ini.lua
index f9507bd0b..f7fb20efe 100644
--- a/tex/context/base/regi-ini.lua
+++ b/tex/context/base/regi-ini.lua
@@ -15,10 +15,12 @@ runtime.</p>
local commands, context = commands, context
local utfchar = utf.char
-local lpegmatch = lpeg.match
-local char, gsub, format = string.char, string.gsub, string.format
+local P, Cs, lpegmatch = lpeg.P, lpeg.Cs, lpeg.match
+local char, gsub, format, gmatch, byte, match = string.char, string.gsub, string.format, string.gmatch, string.byte, string.match
local next = next
local insert, remove, fastcopy = table.insert, table.remove, table.fastcopy
+local concat = table.concat
+local totable = string.totable
local allocate = utilities.storage.allocate
local sequencers = utilities.sequencers
@@ -127,8 +129,8 @@ local function loadreverse(t,k)
return t
end
-setmetatableindex(mapping, loadregime)
-setmetatableindex(backmapping, loadreverse)
+setmetatableindex(mapping, loadregime)
+setmetatableindex(backmapping,loadreverse)
local function translate(line,regime)
if line and #line > 0 then
@@ -276,6 +278,95 @@ function commands.stopregime()
end
end
+-- Next we provide some hacks. Unfortunately we run into crappy encoded
+-- (read : mixed) encoded xml files that have these ë ä ö ü sequences
+-- instead of ë ä ö ü
+
+local patterns = { }
+
+-- function regimes.cleanup(regime,str)
+-- local p = patterns[regime]
+-- if p == nil then
+-- regime = regime and synonyms[regime] or regime or currentregime
+-- local vector = regime ~= "utf" and mapping[regime]
+-- if vector then
+-- local list = { }
+-- for k, uchar in next, vector do
+-- local stream = totable(uchar)
+-- for i=1,#stream do
+-- stream[i] = vector[stream[i]]
+-- end
+-- list[concat(stream)] = uchar
+-- end
+-- p = lpeg.append(list,nil,true)
+-- p = Cs((p+1)^0)
+-- -- lpeg.print(p) -- size 1604
+-- else
+-- p = false
+-- end
+-- patterns[vector] = p
+-- end
+-- return p and lpegmatch(p,str) or str
+-- end
+--
+-- twice as fast and much less lpeg bytecode
+
+function regimes.cleanup(regime,str)
+ local p = patterns[regime]
+ if p == nil then
+ regime = regime and synonyms[regime] or regime or currentregime
+ local vector = regime ~= "utf" and mapping[regime]
+ if vector then
+ local utfchars = { }
+ local firsts = { }
+ for k, uchar in next, vector do
+ local stream = { }
+ local split = totable(uchar)
+ local nofsplits = #split
+ if nofsplits > 1 then
+ local first
+ for i=1,nofsplits do
+ local u = vector[split[i]]
+ if not first then
+ first = firsts[u]
+ if not first then
+ first = { }
+ firsts[u] = first
+ end
+ end
+ stream[i] = u
+ end
+ local nofstream = #stream
+ if nofstream > 1 then
+ first[#first+1] = concat(stream,2,nofstream)
+ utfchars[concat(stream)] = uchar
+ end
+ end
+ end
+ p = P(false)
+ for k, v in next, firsts do
+ local q = P(false)
+ for i=1,#v do
+ q = q + P(v[i])
+ end
+ p = p + P(k) * q
+ end
+ p = Cs(((p+1)/utfchars)^1)
+ -- lpeg.print(p) -- size: 1042
+ else
+ p = false
+ end
+ patterns[regime] = p
+ end
+ return p and lpegmatch(p,str) or str
+end
+
+-- local map = require("regi-cp1252")
+-- local old = [[test ë ä ö ü crap]]
+-- local new = correctencoding(map,old)
+--
+-- print(old,new)
+
-- obsolete:
--
-- function regimes.setsynonym(synonym,target)
diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua
index ace3ed8bb..c02789547 100644
--- a/tex/context/base/spac-ver.lua
+++ b/tex/context/base/spac-ver.lua
@@ -209,14 +209,17 @@ local function validvbox(parentid,list)
else
done = n
end
- elseif id == penalty_code or id == glue_code then
+ elseif id == glue_code or id == penalty_code then
-- go on
else
return nil -- whatever
end
end
- if done and done.id == hlist_code then
- return validvbox(done.id,done.list)
+ if done then
+ local id = done.id
+ if id == hlist_code then
+ return validvbox(id,done.list)
+ end
end
return done -- only one vbox
end
@@ -243,7 +246,7 @@ local function already_done(parentid,list,a_snapmethod) -- todo: done when only
elseif a == 0 then
return true -- already snapped
end
- elseif id == penalty_code or id == glue_code then -- whatsit is weak spot
+ elseif id == glue_code or id == penalty_code then -- whatsit is weak spot
-- go on
else
return false -- whatever
@@ -574,6 +577,16 @@ do -- todo: interface.variables
-- This will change: just node.write and we can store the values in skips which
-- then obeys grouping
+ local fixedblankskip = context.fixedblankskip
+ local flexibleblankskip = context.flexibleblankskip
+ local setblankcategory = context.setblankcategory
+ local setblankorder = context.setblankorder
+ local setblankpenalty = context.setblankpenalty
+ local setblankhandling = context.setblankhandling
+ local flushblankhandling = context.flushblankhandling
+ local addpredefinedblankskip = context.addpredefinedblankskip
+ local addaskedblankskip = context.addaskedblankskip
+
local function analyze(str,oldcategory) -- we could use shorter names
for s in gmatch(str,"([^ ,]+)") do
local amount, keyword, detail = lpegmatch(splitter,s) -- the comma splitter can be merged
@@ -584,35 +597,35 @@ do -- todo: interface.variables
if mk then
category = analyze(mk,category)
elseif keyword == k_fixed then
- context.fixedblankskip()
+ fixedblankskip()
elseif keyword == k_flexible then
- context.flexibleblankskip()
+ flexibleblankskip()
elseif keyword == k_category then
local category = tonumber(detail)
if category then
- context.setblankcategory(category)
+ setblankcategory(category)
if category ~= oldcategory then
- context.flushblankhandling()
+ flushblankhandling()
oldcategory = category
end
end
elseif keyword == k_order and detail then
local order = tonumber(detail)
if order then
- context.setblankorder(order)
+ setblankorder(order)
end
elseif keyword == k_penalty and detail then
local penalty = tonumber(detail)
if penalty then
- context.setblankpenalty(penalty)
+ setblankpenalty(penalty)
end
else
amount = tonumber(amount) or 1
local sk = skip[keyword]
if sk then
- context.addpredefinedblankskip(amount,keyword)
+ addpredefinedblankskip(amount,keyword)
else -- no check
- context.addaskedblankskip(amount,keyword)
+ addaskedblankskip(amount,keyword)
end
end
end
@@ -620,15 +633,22 @@ do -- todo: interface.variables
return category
end
+ local pushlogger = context.pushlogger
+ local startblankhandling = context.startblankhandling
+ local stopblankhandling = context.stopblankhandling
+ local poplogger = context.poplogger
+
function vspacing.analyze(str)
if trace_vspacing then
- context.pushlogger(report_vspacing)
- end
- context.startblankhandling()
- analyze(str,1)
- context.stopblankhandling()
- if trace_vspacing then
- context.poplogger()
+ pushlogger(report_vspacing)
+ startblankhandling()
+ analyze(str,1)
+ stopblankhandling()
+ poplogger()
+ else
+ startblankhandling()
+ analyze(str,1)
+ stopblankhandling()
end
end
@@ -826,6 +846,8 @@ local function forced_skip(head,current,width,where,trace)
return head, current
end
+-- penalty only works well when before skip
+
local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also pass tail
if trace then
reset_tracing(head)
@@ -954,9 +976,9 @@ local function collapser(head,where,what,trace,snap,a_snapmethod) -- maybe also
if cs.writable and ps.stretch_order == 0 and ps.shrink_order == 0 and cs.stretch_order == 0 and cs.shrink_order == 0 then
local pw, pp, pm = ps.width, ps.stretch, ps.shrink
local cw, cp, cm = cs.width, cs.stretch, cs.shrink
---~ ps = writable_spec(previous) -- no writable needed here
---~ ps.width, ps.stretch, ps.shrink = pw + cw, pp + cp, pm + cm
-previous.spec = new_gluespec(pw + cw, pp + cp, pm + cm) -- else topskip can disappear
+ -- ps = writable_spec(previous) -- no writable needed here
+ -- ps.width, ps.stretch, ps.shrink = pw + cw, pp + cp, pm + cm
+ previous.spec = new_gluespec(pw + cw, pp + cp, pm + cm) -- else topskip can disappear
if trace then trace_natural("removed",current) end
head, current = remove_node(head, current, true)
-- current = previous
diff --git a/tex/context/base/spac-ver.mkiv b/tex/context/base/spac-ver.mkiv
index 7fdf2f70f..2dcc654e2 100644
--- a/tex/context/base/spac-ver.mkiv
+++ b/tex/context/base/spac-ver.mkiv
@@ -1592,6 +1592,18 @@
{\setvalue{\??vspacingamount#1}{\ifgridsnapping#3\else#2\fi}%
\ctxcommand{vspacingsetamount("#1")}}
+% \installcorenamespace{vspacingamountnormal}
+% \installcorenamespace{vspacingamountgrid}
+
+% \def\spac_vspacing_define_amount[#1][#2][#3]% can be combined
+% {\ifcsname n>#1\endcsname\else
+% \expandafter\newtoks\csname n>#1\endcsname
+% \expandafter\newtoks\csname g>#1\endcsname
+% \fi
+% \csname n>#1\endcsname{#2}%
+% \csname g>#1\endcsname{#3}%
+% \ctxcommand{vspacingsetamount("#1")}}
+
\unexpanded\def\definevspacing
{\dodoubleempty\spac_vspacing_define}
@@ -1627,31 +1639,31 @@
\relax
\to \everyafterblankhandling
-\def\setblankcategory#1%
+\unexpanded\def\setblankcategory#1%
{\settrue\c_space_vspacing_done
\attribute\skipcategoryattribute#1\relax}
-\def\setblankorder#1%
+\unexpanded\def\setblankorder#1%
{\attribute\skiporderattribute#1\relax}
-\def\fixedblankskip
+\unexpanded\def\fixedblankskip
{\settrue\c_space_vspacing_fixed}
-\def\flexibleblankskip
+\unexpanded\def\flexibleblankskip
{\setfalse\c_space_vspacing_fixed}
-\def\addblankskip#1#2#3%
- {\settrue\c_space_vspacing_done
- \advance\s_spac_vspacing_temp#1\dimexpr\ifgridsnapping#3\else#2\fi\relax\relax}
+% \unexpanded\def\addblankskip#1#2#3%
+% {\settrue\c_space_vspacing_done
+% \advance\s_spac_vspacing_temp#1\dimexpr\ifgridsnapping#3\else#2\fi\relax\relax}
-\def\setblankpenalty#1%
+\unexpanded\def\setblankpenalty#1%
{\flushblankhandling
\settrue\c_space_vspacing_done
\attribute\skipcategoryattribute \plusthree
\attribute\skippenaltyattribute #1\relax
\flushblankhandling}
-\unexpanded\def\startblankhandling
+\unexpanded\def\startblankhandling % move this to \vspacing
{\par
\ifvmode
\expandafter\dostartblankhandling
@@ -1674,7 +1686,7 @@
\fi
\endgroup}
-\def\flushblankhandling
+\unexpanded\def\flushblankhandling
{\the\everyafterblankhandling
\ifconditional\c_space_vspacing_done
\vskip\s_spac_vspacing_temp
@@ -1686,7 +1698,11 @@
{\settrue\c_space_vspacing_done
\advance\s_spac_vspacing_temp#1\dimexpr\csname\??vspacingamount#2\endcsname\relax}
-\def\addaskedblankskip#1#2%
+% \unexpanded\def\addpredefinedblankskip#1#2%
+% {\settrue\c_space_vspacing_done
+% \advance\s_spac_vspacing_temp#1\dimexpr\the\csname\ifgridsnapping g\else n\fi>#2\endcsname\relax}
+
+\unexpanded\def\addaskedblankskip#1#2%
{\settrue\c_space_vspacing_done
\advance\s_spac_vspacing_temp#1\dimexpr#2\relax}
@@ -1725,6 +1741,27 @@
\def\spac_vspacing_nop_ignore
{\ifmmode\else\par\fi}
+\def\directvspacing#1%
+ {\par\ctxcommand{vspacing("#1")}}
+
+% handy (and faste):
+
+\unexpanded\def\directvpenalty#1%
+ {\begingroup
+ \attribute\skipcategoryattribute \plusthree
+ \attribute\skippenaltyattribute #1\relax
+ \attribute\skiporderattribute \attributeunsetvalue
+ \vskip\zeropoint
+ \endgroup}
+
+\unexpanded\def\directvskip#1%
+ {\begingroup
+ \attribute\skipcategoryattribute \plusone
+ \attribute\skippenaltyattribute \attributeunsetvalue
+ \attribute\skiporderattribute \attributeunsetvalue
+ \vskip#1\relax
+ \endgroup}
+
% these depend on bigskipamount cum suis so we'd better sync them
\unexpanded\def\setupvspacing
@@ -1782,7 +1819,7 @@
\relax}
\definevspacing[\v!preference][penalty:-500] % goodbreak
-\definevspacing[\v!samepage] [penalty:10000] % real strong
+\definevspacing[\v!samepage] [penalty:10000] % nobreak
\definevspacing[\v!max] [category:1]
\definevspacing[\v!force] [category:2]
\definevspacing[\v!disable] [category:5]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index fedf9a077..d489f2697 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index acc1ebe16..b4e1e10bf 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index 0a89edf3d..691b69c2a 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -254,6 +254,19 @@
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
+% \unexpanded\def\strc_notations_start#tag#stoptag%
+% {\begingroup
+% \edef\currentnote{#tag}%
+% \strc_constructions_initialize{#tag}%
+% \strc_notes_synchronize
+% \ifnotesenabled
+% \strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel
+% \fi
+% \normalexpanded % not that efficient but also not that frequently used (\normaldef for parser)
+% {\normaldef\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#stoptag\endcsname{\strc_notations_command_yes[##1]{##2}}%
+% \normaldef\noexpand\strc_pickup_nop ##1\csname\e!stop#stoptag\endcsname{\strc_notations_command_nop {##1}}}%
+% \doifnextoptionalelse\strc_pickup_yes\strc_pickup_nop}
+
\unexpanded\def\strc_notations_start#tag#stoptag%
{\begingroup
\edef\currentnote{#tag}%
@@ -262,9 +275,9 @@
\ifnotesenabled
\strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel
\fi
- \normalexpanded % not that efficient but also not that frequently used
- {\def\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#stoptag\endcsname{\strc_notations_command_yes[##1]{##2}}%
- \def\noexpand\strc_pickup_nop ##1\csname\e!stop#stoptag\endcsname{\strc_notations_command_nop {##1}}}%
+ \normalexpanded % not that efficient but also not that frequently used (\normaldef for parser)
+ {\def\noexpand\strc_pickup_yes[#one]#two\csname\e!stop#stoptag\endcsname{\strc_notations_command_yes[#one]{#two}}%
+ \def\noexpand\strc_pickup_nop #one\csname\e!stop#stoptag\endcsname{\strc_notations_command_nop {#one}}}%
\doifnextoptionalelse\strc_pickup_yes\strc_pickup_nop}
\unexpanded\def\strc_notations_start_yes[#reference]#title%
diff --git a/tex/context/base/tabl-tbl.mkiv b/tex/context/base/tabl-tbl.mkiv
index 0bd2fb05e..a8e2a0309 100644
--- a/tex/context/base/tabl-tbl.mkiv
+++ b/tex/context/base/tabl-tbl.mkiv
@@ -310,10 +310,10 @@
\hrule\s!height.5\linewidth\s!depth.5\linewidth
\par
\kern-\linewidth
- \nobreak}
+ \tabl_tabulate_break_no}
\def\tabl_tabulate_nobreak_inject_indeed
- {\nobreak
+ {\tabl_tabulate_break_no
\iftracetabulate
\tabl_tabulate_nobreak_inject_tracer
\fi}
@@ -1096,18 +1096,47 @@
{\bgroup % whole thing
\dodoubleempty\tabl_start_regular}
-\def\tabl_start_regular[#1][#2]%
+% \def\tabl_start_regular[#1][#2]%
+% {%\let\currenttabulationparent\v!tabulate
+% \let\currenttabulationparent\empty
+% \let\currenttabulation\currenttabulationparent
+% \def\p_format{#1}%
+% \ifx\p_format\empty
+% \def\p_format{|l|p|}%
+% \fi
+% \lettabulationparameter\c!format\p_format
+% \ifsecondargument
+% \setupcurrenttabulation[#2]%
+% \fi
+% \tabl_tabulate_start_building}
+
+\def\tabl_start_regular
{%\let\currenttabulationparent\v!tabulate
\let\currenttabulationparent\empty
\let\currenttabulation\currenttabulationparent
- \def\p_format{#1}%
+ \ifsecondargument
+ \expandafter\tabl_start_regular_two
+ \else
+ \expandafter\tabl_start_regular_one
+ \fi}
+
+\def\tabl_start_regular_one[#1][#2]%
+ {\doifassignmentelse{#1}
+ {\setupcurrenttabulation[\c!format={|l|p|},#1]}
+ {\def\p_format{#1}%
+ \ifx\p_format\empty
+ \def\p_format{|l|p|}%
+ \fi
+ \lettabulationparameter\c!format\p_format}%
+ \tabl_tabulate_start_building}
+
+\def\tabl_start_regular_two[#1][#2]%
+ {\def\p_format{#1}%
\ifx\p_format\empty
\def\p_format{|l|p|}%
\fi
\lettabulationparameter\c!format\p_format
- \ifsecondargument
- \setupcurrenttabulation[#2]%
- \fi
+ \setupcurrenttabulation[#2]%
\tabl_tabulate_start_building}
\letvalue{\e!stop\v!tabulate }\relax
@@ -1363,7 +1392,11 @@
\processcommacommand[\p_distance]\tabl_tabulate_column_rule_separator_step
\s_tabl_tabulate_separator\m_tabl_tabulate_separator_factor\s_tabl_tabulate_separator
\fi
- \ifconditional\c_tabl_tabulate_someamble\kern\else\vskip\fi\s_tabl_tabulate_separator % new
+ % someamble: footer or header: unfortunately a skip can trigger a page break (weird
+ % as we have lots of nobreaks)
+ % \ifconditional\c_tabl_tabulate_someamble\kern\else\vskip\fi\s_tabl_tabulate_separator % new
+ % \directvspacing{\the\s_tabl_tabulate_separator}% new
+ \directvskip\s_tabl_tabulate_separator
\egroup}
\def\tabl_tabulate_hrule_spec_ignore#1%
@@ -1618,6 +1651,43 @@
{\def\dobaselinecorrection{\vskip\dimexpr-\prevdepth+\strutdp+\strutdp\relax}% todo: mkiv
\baselinecorrection}
+% some hack to prevent an allowbreak ... actually we could set up a system then
+% that is dealt with atthe lua end in the skip handler: turn penalties with attributes
+% values into other penalties that get removed
+
+\installcorenamespace{tabulatenobreak}
+
+% \def\tabl_tabulate_break_state_set
+% {%\writestatus{SET}{\the\c_tabl_tabulate_noflines}%
+% \global\expandafter\let\csname\??tabulatenobreak\the\c_tabl_tabulate_noflines\endcsname\conditionaltrue}
+%
+% \def\tabl_tabulate_break_state_reset
+% {\ifcsname\??tabulatenobreak\the\c_tabl_tabulate_noflines\endcsname
+% %\writestatus{RESET}{\the\c_tabl_tabulate_noflines}%
+% \global\expandafter\let\csname\??tabulatenobreak\the\c_tabl_tabulate_noflines\endcsname\undefined
+% \fi}
+%
+% \def\tabl_tabulate_break_state_allowbreak
+% {\ifcsname\??tabulatenobreak\the\c_tabl_tabulate_noflines\endcsname
+% %\writestatus{TRUE}{\the\c_tabl_tabulate_noflines}%
+% \else
+% %\writestatus{FALSE}{\the\c_tabl_tabulate_noflines}%
+% \tabl_tabulate_break_allow % needed with pbreak prevention
+% \fi}
+%
+% \let\tabl_tabulate_break_allow\allowbreak
+% \let\tabl_tabulate_break_no \nobreak
+
+\def\tabl_tabulate_break_allow{\directvpenalty\zerocount}
+\def\tabl_tabulate_break_maybe{\directvpenalty\zerocount}
+\def\tabl_tabulate_break_no {\directvpenalty\plustenthousand} % ,order:2}}
+
+\let\tabl_tabulate_break_state_set \relax
+\let\tabl_tabulate_break_state_reset \relax
+\let\tabl_tabulate_break_state_allowbreak\tabl_tabulate_break_maybe
+
+% so far
+
\unexpanded\def\tabl_tabulate_VL_first{\tabl_tabulate_column_vruled\zerocount}
\unexpanded\def\tabl_tabulate_NC_first{\tabl_tabulate_column_normal\zerocount}
\unexpanded\def\tabl_tabulate_RC_first{\tabl_tabulate_column_normal\plusone}
@@ -1629,8 +1699,12 @@
\unexpanded\def\tabl_tabulate_NG_first{\NC\tabl_tabulate_charalign}
\unexpanded\def\tabl_tabulate_NN_first{\NC\tabl_tabulate_digits} % new, undocumented, test first
\unexpanded\def\tabl_tabulate_ND_first{\NC\tabl_tabulate_digits} % same, for old times sake
-\unexpanded\def\tabl_tabulate_NR_first{\tabl_tabulate_NR_common\tabl_tabulate_check_penalties} % next row
-\unexpanded\def\tabl_tabulate_NB_first{\tabl_tabulate_NR_common\tabl_tabulate_nobreak_inject} % next row no break
+
+\unexpanded\def\tabl_tabulate_NR_first {\tabl_tabulate_NR_common\conditionaltrue \tabl_tabulate_check_penalties} % next row
+\unexpanded\def\tabl_tabulate_NB_first {\tabl_tabulate_NR_common\conditionaltrue \tabl_tabulate_nobreak_inject } % next row no break
+
+\unexpanded\def\tabl_tabulate_NR_second{\tabl_tabulate_NR_common\conditionalfalse\tabl_tabulate_check_penalties} % next row
+\unexpanded\def\tabl_tabulate_NB_second{\tabl_tabulate_NR_common\conditionalfalse\tabl_tabulate_nobreak_inject } % next row no break
\unexpanded\def\tabl_tabulate_CC_first{\global\c_tabl_tabulate_localcolorspan\zerocount\tabl_tabulate_set_color_column\zerocount}
\unexpanded\def\tabl_tabulate_CL_first{\global\c_tabl_tabulate_localcolorspan\plusone \tabl_tabulate_set_color_column\zerocount}
@@ -1657,6 +1731,11 @@
\to \t_tabl_tabulate_initializers_first
\appendtoks
+ \let\NR\tabl_tabulate_NR_second
+ \let\NB\tabl_tabulate_NB_second
+\to \t_tabl_tabulate_initializers_second
+
+\appendtoks
\let\SR\NR
\let\FR\NR
\let\MR\NR
@@ -1664,37 +1743,41 @@
\let\AR\NR
\to \t_tabl_tabulate_initializers_first
-\unexpanded\def\tabl_tabulate_NR_common#1%
+\unexpanded\def\tabl_tabulate_NR_common#1#2%
{\global\advance\c_tabl_tabulate_noflines\plusone
\global\setfalse\c_tabl_tabulate_firstflushed
\global\setfalse\c_tabl_tabulate_equal
\global\c_tabl_tabulate_column\zerocount
+ \ifconditional#1\relax
+ \tabl_tabulate_break_state_reset
+ \fi
\tabl_tabulate_pheight_reset
\unskip\unskip\crcr\tabl_tabulate_flush_collected
+ % can we omit the next one in the first run? probably
\starttabulatenoalign
\the\t_tabl_tabulate_every_after_row
- #1%
+ #2%
\stoptabulatenoalign}
\def\tabl_tabulate_check_penalties
{\ifconditional\c_tabl_tabulate_tolerant_break\else
\ifnum\c_tabl_tabulate_totalnoflines=\plusone
- % \allowbreak
+ % \tabl_tabulate_break_allow
\else
\ifconditional\c_tabl_tabulate_someamble \ifcase\c_tabl_tabulate_repeathead \else
- \allowbreak
+ \tabl_tabulate_break_allow
\fi \fi
\ifnum\c_tabl_tabulate_noflines=\plusone
\tabl_tabulate_nobreak_inject
- \else\ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_minusnoflines
+ \else \ifnum\c_tabl_tabulate_noflines=\c_tabl_tabulate_minusnoflines
\ifnum\c_tabl_tabulate_plines_max<\plustwo
\tabl_tabulate_nobreak_inject
\else
- \allowbreak % needed with pbreak prevention
+ \tabl_tabulate_break_allow % needed with pbreak prevention
\fi
\else
- \allowbreak % needed with pbreak prevention
- \fi\fi
+ \tabl_tabulate_break_state_allowbreak
+ \fi \fi
\fi
\fi
\global\setfalse\c_tabl_tabulate_firstflushed}
@@ -1784,7 +1867,11 @@
% \starttabulate[||] \dorecurse{100}{\NC Eins \NC \NR \HL} \stoptabulate
% \stoptext
-\def\tabl_tabulate_XX_none{\starttabulatenoalign\tabl_tabulate_hrule_spec_ignore\stoptabulatenoalign}
+\def\tabl_tabulate_XX_none
+ {\starttabulatenoalign
+ \tabl_tabulate_break_state_set
+ \tabl_tabulate_hrule_spec_ignore
+ \stoptabulatenoalign}
\def\tabl_tabulate_FL_second{\starttabulatenoalign\tabl_tabulate_hrule_spec_pickup\tabl_tabulate_FL_second_indeed}
\def\tabl_tabulate_ML_second{\starttabulatenoalign\tabl_tabulate_hrule_spec_pickup\tabl_tabulate_ML_second_indeed}
@@ -1808,7 +1895,7 @@
\tabl_tabulate_hrule_inject
\vskip-\p_rulethickness\relax
\tabl_tabulate_hrule_inject
- \nobreak
+ \tabl_tabulate_break_no
\tabl_tabulate_column_rule_separator_inject
\stoptabulatenoalign}
@@ -1879,12 +1966,12 @@
% \stoptabulatenoalign
% \dotabulateautoline
% \starttabulatenoalign
-% \nobreak
+% \tabl_tabulate_break_no
% \ifx\dotabulateautoline\dotabulatelinerule\kern-\lineheight\fi
% \ifnum\noftabulatelines=\totalnoftabulatelines
% \@EA\dotabulatenobreak
% \else
-% \@EA\allowbreak
+% \@EA\tabl_tabulate_break_allow
% \fi
% \stoptabulatenoalign
% \dotabulateautoline
diff --git a/tex/context/base/util-sql.lua b/tex/context/base/util-sql.lua
index 70c7d4be6..07841f8fd 100644
--- a/tex/context/base/util-sql.lua
+++ b/tex/context/base/util-sql.lua
@@ -279,7 +279,7 @@ function sql.setmethod(method)
sql.execute = firstexecute
end
-sql.setmethod("client")
+sql.setmethod("library")
-- helper:
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 777defd88..8d8df9414 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 10/19/12 00:06:05
+-- merge date : 10/20/12 02:07:32
do -- begin closure to overcome local limits and interference
@@ -134,7 +134,7 @@ string.itself = function(s) return s end
-- also handy (see utf variant)
-local pattern = Ct(C(1)^0)
+local pattern = Ct(C(1)^0) -- string and not utf !
function string.totable(str)
return lpegmatch(pattern,str)
@@ -292,6 +292,16 @@ local function sortedhashkeys(tab) -- fast one
end
end
+function table.allkeys(t)
+ local keys = { }
+ for i=1,#t do
+ for k, v in next, t[i] do
+ keys[k] = true
+ end
+ end
+ return sortedkeys(keys)
+end
+
table.sortedkeys = sortedkeys
table.sortedhashkeys = sortedhashkeys
@@ -1578,15 +1588,10 @@ end
function lpeg.replacer(one,two)
if type(one) == "table" then
local no = #one
- local p
+ local p = P(false)
if no == 0 then
for k, v in next, one do
- local pp = P(k) / v
- if p then
- p = p + pp
- else
- p = pp
- end
+ p = p + P(k) / v
end
return Cs((p + 1)^0)
elseif no == 1 then
@@ -1596,12 +1601,7 @@ function lpeg.replacer(one,two)
else
for i=1,no do
local o = one[i]
- local pp = P(o[1]) / o[2]
- if p then
- p = p + pp
- else
- p = pp
- end
+ p = p + P(o[1]) / o[2]
end
return Cs((p + 1)^0)
end
@@ -1732,13 +1732,9 @@ lpeg.UP = lpeg.P
if utfcharacters then
function lpeg.US(str)
- local p
+ local p = P(false)
for uc in utfcharacters(str) do
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
return p
end
@@ -1747,13 +1743,9 @@ if utfcharacters then
elseif utfgmatch then
function lpeg.US(str)
- local p
+ local p = P(false)
for uc in utfgmatch(str,".") do
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
return p
end
@@ -1761,13 +1753,9 @@ elseif utfgmatch then
else
function lpeg.US(str)
- local p
+ local p = P(false)
local f = function(uc)
- if p then
- p = p + P(uc)
- else
- p = P(uc)
- end
+ p = p + P(uc)
end
lpegmatch((utf8char/f)^0,str)
return p
@@ -1793,13 +1781,9 @@ function lpeg.UR(str,more)
if first == last then
return P(str)
elseif utfchar and last - first < 8 then -- a somewhat arbitrary criterium
- local p
+ local p = P(false)
for i=first,last do
- if p then
- p = p + P(utfchar(i))
- else
- p = P(utfchar(i))
- end
+ p = p + P(utfchar(i))
end
return p -- nil when invalid range
else
@@ -8368,14 +8352,14 @@ local set_attribute = node.set_attribute
local insert_node_before = node.insert_before
local insert_node_after = node.insert_after
+local kernpair = attributes.private('kernpair')
+local ligacomp = attributes.private('ligacomp')
local markbase = attributes.private('markbase')
local markmark = attributes.private('markmark')
local markdone = attributes.private('markdone')
local cursbase = attributes.private('cursbase')
local curscurs = attributes.private('curscurs')
local cursdone = attributes.private('cursdone')
-local kernpair = attributes.private('kernpair')
-local ligacomp = attributes.private('ligacomp')
-- This injector has been tested by Idris Samawi Hamid (several arabic fonts as well as
-- the rather demanding Husayni font), Khaled Hosny (latin and arabic) and Kaj Eigner
@@ -9128,7 +9112,7 @@ function methods.arab(head,font,attr) -- maybe make a special version with no tr
local marks = tfmdata.resources.marks
local first, last, current, done = nil, nil, head, false
while current do
- if current.id == glyph_code and current.subtype<256 and current.font == font and not has_attribute(current,state) then
+ if current.id == glyph_code and current.font == font and current.subtype<256 and not has_attribute(current,state) then
done = true
local char = current.char
if marks[char] or (useunicodemarks and categories[char] == "mn") then
@@ -9823,7 +9807,7 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence)
if marks[startchar] then
while s do
local id = s.id
- if id == glyph_code and s.subtype<256 and s.font == currentfont then
+ if id == glyph_code and s.font == currentfont and s.subtype<256 then
local lg = ligature[s.char]
if lg then
stop = s
@@ -9908,12 +9892,12 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -9969,12 +9953,12 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [optional marks] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -10047,7 +10031,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence)
end
end
end
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then -- subtype test can go
local basechar = base.char
local baseanchors = descriptions[basechar]
if baseanchors then
@@ -10098,7 +10082,7 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to
end
else
local nxt = start.next
- while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do
+ while not done and nxt and nxt.id == glyph_code and nxt.font == currentfont and nxt.subtype<256 do
local nextchar = nxt.char
if marks[nextchar] then
-- should not happen (maybe warning)
@@ -10162,7 +10146,7 @@ function handlers.gpos_pair(start,kind,lookupname,kerns,sequence)
local prev, done = start, false
local factor = tfmdata.parameters.factor
local lookuptype = lookuptypes[lookupname]
- while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do
+ while snext and snext.id == glyph_code and snext.font == currentfont and snext.subtype<256 do
local nextchar = snext.char
local krn = kerns[nextchar]
if not krn and marks[nextchar] then
@@ -10554,12 +10538,12 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,look
end
if markanchors then
local base = start.prev -- [glyph] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -10618,12 +10602,12 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,
end
if markanchors then
local base = start.prev -- [glyph] [optional marks] [start=mark]
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
local basechar = base.char
if marks[basechar] then
while true do
base = base.prev
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then
basechar = base.char
if not marks[basechar] then
break
@@ -10704,7 +10688,7 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,look
end
end
end
- if base and base.id == glyph_code and base.subtype<256 and base.font == currentfont then -- subtype test can go
+ if base and base.id == glyph_code and base.font == currentfont and base.subtype<256 then -- subtype test can go
local basechar = base.char
local baseanchors = descriptions[basechar].anchors
if baseanchors then
@@ -10764,7 +10748,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,lookup
end
else
local nxt = start.next
- while not done and nxt and nxt.id == glyph_code and nxt.subtype<256 and nxt.font == currentfont do
+ while not done and nxt and nxt.id == glyph_code and nxt.font == currentfont and nxt.subtype<256 do
local nextchar = nxt.char
if marks[nextchar] then
-- should not happen (maybe warning)
@@ -10845,7 +10829,7 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,lookuphas
local lookuptype = lookuptypes[lookupname]
local prev, done = start, false
local factor = tfmdata.parameters.factor
- while snext and snext.id == glyph_code and snext.subtype<256 and snext.font == currentfont do
+ while snext and snext.id == glyph_code and snext.font == currentfont and snext.subtype<256 do
local nextchar = snext.char
local krn = kerns[nextchar]
if not krn and marks[nextchar] then
@@ -10938,7 +10922,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
-- f..l = mid string
if s == 1 then
-- never happens
- match = current.id == glyph_code and current.subtype<256 and current.font == currentfont and seq[1][current.char]
+ match = current.id == glyph_code and current.font == currentfont and current.subtype<256 and seq[1][current.char]
else
-- maybe we need a better space check (maybe check for glue or category or combination)
-- we cannot optimize for n=2 because there can be disc nodes
@@ -10958,7 +10942,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if last then
local id = last.id
if id == glyph_code then
- if last.subtype<256 and last.font == currentfont then
+ if last.font == currentfont and last.subtype<256 then
local char = last.char
local ccd = descriptions[char]
if ccd then
@@ -11008,7 +10992,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if prev then
local id = prev.id
if id == glyph_code then
- if prev.subtype<256 and prev.font == currentfont then -- normal char
+ if prev.font == currentfont and prev.subtype<256 then -- normal char
local char = prev.char
local ccd = descriptions[char]
if ccd then
@@ -11069,7 +11053,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if current then
local id = current.id
if id == glyph_code then
- if current.subtype<256 and current.font == currentfont then -- normal char
+ if current.font == currentfont and current.subtype<256 then -- normal char
local char = current.char
local ccd = descriptions[char]
if ccd then
@@ -11411,7 +11395,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = a == attr
@@ -11463,7 +11447,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = (a == attr) and (not attribute or has_attribute(start,state,attribute))
@@ -11536,7 +11520,7 @@ local function featuresprocessor(head,font,attr)
while start do
local id = start.id
if id == glyph_code then
- if start.subtype<256 and start.font == font then
+ if start.font == font and start.subtype<256 then
local a = has_attribute(start,0)
if a then
a = (a == attr) and (not attribute or has_attribute(start,state,attribute))