summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/bibl-tra.mkii3
-rw-r--r--tex/context/base/bibl-tra.mkiv2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4383 -> 4385 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-inj.lua323
-rw-r--r--tex/context/base/lang-ini.mkiv6
-rw-r--r--tex/context/base/node-aux.lua2
-rw-r--r--tex/context/base/node-ref.lua191
-rw-r--r--tex/context/base/page-mix.mkiv6
-rw-r--r--tex/context/base/publ-aut.lua14
-rw-r--r--tex/context/base/publ-dat.lua40
-rw-r--r--tex/context/base/publ-ini.lua2
-rw-r--r--tex/context/base/publ-ini.mkiv3
-rw-r--r--tex/context/base/publ-tra.lua80
-rw-r--r--tex/context/base/publ-usr.lua117
-rw-r--r--tex/context/base/s-fonts-ligatures.mkiv12
-rw-r--r--tex/context/base/s-structure-sections.mkiv80
-rw-r--r--tex/context/base/status-files.pdfbin24616 -> 24610 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin333293 -> 333342 bytes
-rw-r--r--tex/context/base/strc-con.mkvi11
-rw-r--r--tex/context/base/strc-doc.lua13
-rw-r--r--tex/context/base/strc-not.mkvi2
-rw-r--r--tex/context/base/strc-ref.lua4
-rw-r--r--tex/context/base/strc-sec.mkiv21
-rw-r--r--tex/context/base/strc-tag.mkiv2
-rw-r--r--tex/context/base/typo-brk.lua12
-rw-r--r--tex/context/base/typo-dua.lua8
-rw-r--r--tex/context/base/typo-dub.lua8
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
30 files changed, 627 insertions, 341 deletions
diff --git a/tex/context/base/bibl-tra.mkii b/tex/context/base/bibl-tra.mkii
index a9ce392a2..868ca0fc6 100644
--- a/tex/context/base/bibl-tra.mkii
+++ b/tex/context/base/bibl-tra.mkii
@@ -642,8 +642,7 @@
%D If you want to write an extension to the styles, you might
%D as well define some of these commands yourself.
%D
-%D The argument liust has been reordered here, and the meanings
-%D are:
+%D The argument list has been reordered here, and the meanings are:
%D
%D {\obeylines\parskip0pt
%D \type{#1} firstnames
diff --git a/tex/context/base/bibl-tra.mkiv b/tex/context/base/bibl-tra.mkiv
index 092d21ca7..8ceffe2f3 100644
--- a/tex/context/base/bibl-tra.mkiv
+++ b/tex/context/base/bibl-tra.mkiv
@@ -689,7 +689,7 @@
\doifassignmentelse{#1}%
{\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}%
{\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}%
- \ctxlua{bibtex.hacks.register("\@@pbk","\@@pbs")}%
+ \ctxlua{bibtex.hacks.register(\!!bs\@@pbk\!!es,\!!bs\@@pbs\!!es)}%
\catcode\commentasciicode\othercatcode
\dodostartpublication}
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 1d8a82cc7..52c4e4d3c 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{2015.01.30 15:28}
+\newcontextversion{2015.02.03 21:36}
%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 8994c342a..cc5438f72 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.mkiv b/tex/context/base/context.mkiv
index 56bb004b4..ba82de9d3 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -28,7 +28,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2015.01.30 15:28}
+\edef\contextversion{2015.02.03 21:36}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/font-inj.lua b/tex/context/base/font-inj.lua
index 87330a393..87d3f9b27 100644
--- a/tex/context/base/font-inj.lua
+++ b/tex/context/base/font-inj.lua
@@ -79,19 +79,20 @@ function injections.resetcounts()
keepregisteredcounts = false
end
+-- We need to make sure that a possible metatable will not kick in
+-- unexpectedly.
+
function injections.reset(n)
- local p = rawget(properties,start)
- if p and p.injections then
- -- todo: decrement counters? tricky as we then need to change the nof* to not increment
- -- when we change a property
- p.injections = nil -- should we keep the liga index?
+ local p = rawget(properties,n)
+ if p and rawget(p,"injections") then
+ p.injections = nil
end
end
function injections.setligaindex(n,index)
local p = rawget(properties,n)
if p then
- local i = p.injections
+ local i = rawget(p,"injections")
if i then
i.ligaindex = index
else
@@ -111,8 +112,8 @@ end
function injections.getligaindex(n,default)
local p = rawget(properties,n)
if p then
- p = p.injections
- if p then
+ local i = rawget(p,"injections")
+ if i then
return p.ligaindex or default
end
end
@@ -132,7 +133,7 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne
--
local p = rawget(properties,start)
if p then
- local i = p.injections
+ local i = rawget(p,"injections")
if i then
i.cursiveanchor = true
else
@@ -149,7 +150,7 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne
end
local p = rawget(properties,nxt)
if p then
- local i = p.injections
+ local i = rawget(p,"injections")
if i then
i.cursivex = dx
i.cursivey = dy
@@ -183,7 +184,7 @@ function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) -- r2l
end
local p = rawget(properties,current)
if p then
- local i = p.injections
+ local i = rawget(p,"injections")
if i then
if leftkern ~= 0 or rightkern ~= 0 then
i.leftkern = i.leftkern or 0 + leftkern
@@ -238,7 +239,7 @@ function injections.setkern(current,factor,rlmode,x,injection)
injection = "injections"
end
if p then
- local i = p[injection]
+ local i = rawget(p,injection)
if i then
i.leftkern = dx + i.leftkern or 0
else
@@ -268,7 +269,7 @@ function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase) -- ba=basean
end
local p = rawget(properties,start)
if p then
- local i = p.injections
+ local i = rawget(p,"injections")
if i then
i.markx = dx
i.marky = dy
@@ -311,18 +312,18 @@ local function show(n,what,nested,symbol)
if n then
local p = rawget(properties,n)
if p then
- local p = p[what]
- if p then
- local leftkern = p.leftkern or 0
- local rightkern = p.rightkern or 0
- local yoffset = p.yoffset or 0
- local markx = p.markx or 0
- local marky = p.marky or 0
- local markdir = p.markdir or 0
- local markbase = p.markbase or 0 -- will be markbasenode
- local cursivex = p.cursivex or 0
- local cursivey = p.cursivey or 0
- local ligaindex = p.ligaindex or 0
+ local i = p[what]
+ if i then
+ local leftkern = i.leftkern or 0
+ local rightkern = i.rightkern or 0
+ local yoffset = i.yoffset or 0
+ local markx = i.markx or 0
+ local marky = i.marky or 0
+ local markdir = i.markdir or 0
+ local markbase = i.markbase or 0 -- will be markbasenode
+ local cursivex = i.cursivex or 0
+ local cursivey = i.cursivey or 0
+ local ligaindex = i.ligaindex or 0
local margin = nested and 4 or 2
--
if rightkern ~= 0 or yoffset ~= 0 then
@@ -412,10 +413,6 @@ local function collect_glyphs_1(head)
local nf, tm = nil, nil
for n in traverse_id(glyph_code,head) do -- only needed for relevant fonts
if getsubtype(n) < 256 then
- local pn = rawget(properties,n)
- if pn then
- pn = pn.injections
- end
local f = getfont(n)
if f ~= nf then
nf = f
@@ -429,10 +426,14 @@ local function collect_glyphs_1(head)
glyphs[nofglyphs] = n
end
-- yoffsets can influence curs steps
- if pn then
- local yoffset = pn.yoffset
- if yoffset and yoffset ~= 0 then
- setfield(n,"yoffset",yoffset)
+ local p = rawget(properties,n)
+ if p then
+ local i = rawget(p,"injections")
+ if i then
+ local yoffset = i.yoffset
+ if yoffset and yoffset ~= 0 then
+ setfield(n,"yoffset",yoffset)
+ end
end
end
end
@@ -468,21 +469,18 @@ local function inject_marks(marks,nofmarks)
local n = marks[i]
local pn = rawget(properties,n)
if pn then
- pn = pn.injections
- end
- if pn then
- -- local markbase = pn.markbase
- -- if markbase then
- -- local p = markanchors[markbase]
+ pn = rawget(pn,"injections")
+ if pn then
local p = pn.markbasenode
if p then
local px = getfield(p,"xoffset")
local ox = 0
+ local rightkern = nil
local pp = rawget(properties,p)
if pp then
- pp = pp.injections
+ pp = rawget(pp,"injections")
+ rightkern = pp.rightkern
end
- local rightkern = pp and pp.rightkern
if rightkern then -- x and w ~= 0
if pn.markdir < 0 then
-- kern(w-x) glyph(p) kern(x) mark(n)
@@ -491,7 +489,12 @@ local function inject_marks(marks,nofmarks)
else
-- kern(x) glyph(p) kern(w-x) mark(n)
-- ox = px - getfield(p,"width") + pn.markx - pp.leftkern
- ox = px - pn.markx - pp.leftkern
+ local leftkern = pp.leftkern
+ if leftkern then
+ ox = px - pn.markx
+ else
+ ox = px - pn.markx - leftkern
+ end
-- report_injections("l2r case 1: %p",ox)
end
else
@@ -529,7 +532,7 @@ local function inject_marks(marks,nofmarks)
-- normally this can't happen (only when in trace mode which is a special case anyway)
-- report_injections("missing mark anchor %i",pn.markbase or 0)
end
- -- end
+ end
end
end
end
@@ -541,7 +544,7 @@ local function inject_cursives(glyphs,nofglyphs)
local n = glyphs[i]
local pn = rawget(properties,n)
if pn then
- pn = pn.injections
+ pn = rawget(pn,"injections")
end
if pn then
local cursivex = pn.cursivex
@@ -623,16 +626,16 @@ local function inject_kerns(head,glyphs,nofglyphs)
local n = glyphs[i]
local pn = rawget(properties,n)
if pn then
- pn = pn.injections
- end
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- insert_node_before(head,n,newkern(leftkern)) -- type 0/2
- end
- local rightkern = pn.rightkern
- if rightkern and rightkern ~= 0 then
- insert_node_after(head,n,newkern(rightkern)) -- type 0/2
+ local i = rawget(pn,"injections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ insert_node_before(head,n,newkern(leftkern)) -- type 0/2
+ end
+ local rightkern = i.rightkern
+ if rightkern and rightkern ~= 0 then
+ insert_node_after(head,n,newkern(rightkern)) -- type 0/2
+ end
end
end
end
@@ -685,10 +688,10 @@ local function inject_kerns_only(head,where)
if p then
local d = getfield(p,"post")
if d then
- local pn = pn.postinjections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"postinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
local t = find_tail(d)
insert_node_after(d,t,newkern(leftkern))
end
@@ -696,28 +699,28 @@ local function inject_kerns_only(head,where)
end
local d = getfield(p,"replace")
if d then
- local pn = pn.replaceinjections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"replaceinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
local t = find_tail(d)
insert_node_after(d,t,newkern(leftkern))
end
end
else
- local pn = pn.injections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"injections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
setfield(p,"replace",newkern(leftkern))
end
end
end
else
- local pn = pn.injections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"injections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
head = insert_node_before(head,n,newkern(leftkern))
end
end
@@ -735,12 +738,12 @@ local function inject_kerns_only(head,where)
if getsubtype(n) < 256 then
local pn = rawget(properties,n)
if pn then
- pn = pn.preinjections
- end
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
+ local i = rawget(pn,"preinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
end
end
else
@@ -758,12 +761,12 @@ local function inject_kerns_only(head,where)
if getsubtype(n) < 256 then
local pn = rawget(properties,n)
if pn then
- pn = pn.postinjections
- end
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
+ local i = rawget(pn,"postinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
end
end
else
@@ -781,12 +784,12 @@ local function inject_kerns_only(head,where)
if getsubtype(n) < 256 then
local pn = rawget(properties,n) -- why can it be empty { }
if pn then
- pn = pn.replaceinjections
- end
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
+ local i = rawget(pn,"replaceinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
end
end
else
@@ -829,14 +832,14 @@ local function inject_pairs_only(head,where)
if p then
local d = getfield(p,"post")
if d then
- local pn = pn.postinjections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"postinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
local t = find_tail(d)
insert_node_after(d,t,newkern(leftkern))
end
- -- local rightkern = pn.rightkern
+ -- local rightkern = i.rightkern
-- if rightkern and rightkern ~= 0 then
-- insert_node_after(head,n,newkern(rightkern))
-- n = getnext(n) -- to be checked
@@ -845,27 +848,27 @@ local function inject_pairs_only(head,where)
end
local d = getfield(p,"replace")
if d then
- local pn = pn.replaceinjections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"replaceinjections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
local t = find_tail(d)
insert_node_after(d,t,newkern(leftkern))
end
- -- local rightkern = pn.rightkern
+ -- local rightkern = i.rightkern
-- if rightkern and rightkern ~= 0 then
-- insert_node_after(head,n,newkern(rightkern))
-- n = getnext(n) -- to be checked
-- end
end
else
- local pn = pn.injections
- if pn then
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local i = rawget(pn,"injections")
+ if i then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
setfield(p,"replace",newkern(leftkern))
end
- -- local rightkern = pn.rightkern
+ -- local rightkern = i.rightkern
-- if rightkern and rightkern ~= 0 then
-- insert_node_after(head,n,newkern(rightkern))
-- n = getnext(n) -- to be checked
@@ -874,17 +877,17 @@ local function inject_pairs_only(head,where)
end
else
-- this is the most common case
- local pn = pn.injections
- if pn then
- local yoffset = pn.yoffset
+ local i = rawget(pn,"injections")
+ if i then
+ local yoffset = i.yoffset
if yoffset and yoffset ~= 0 then
setfield(n,"yoffset",yoffset)
end
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
insert_node_before(head,n,newkern(leftkern))
end
- local rightkern = pn.rightkern
+ local rightkern = i.rightkern
if rightkern and rightkern ~= 0 then
insert_node_after(head,n,newkern(rightkern))
n = getnext(n) -- to be checked
@@ -902,23 +905,23 @@ local function inject_pairs_only(head,where)
local h = d
for n in traverse_id(glyph_code,d) do
if getsubtype(n) < 256 then
- local pn = rawget(properties,n)
- if pn then
- pn = pn.preinjections
- end
- if pn then
- local yoffset = pn.yoffset
- if yoffset and yoffset ~= 0 then
- setfield(n,"yoffset",yoffset)
- end
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
- end
- local rightkern = pn.rightkern
- if rightkern and rightkern ~= 0 then
- insert_node_after(head,n,newkern(rightkern))
- n = getnext(n) -- to be checked
+ local p = rawget(properties,n)
+ if p then
+ local i = rawget(p,"preinjections")
+ if i then
+ local yoffset = i.yoffset
+ if yoffset and yoffset ~= 0 then
+ setfield(n,"yoffset",yoffset)
+ end
+ local leftkern = i.leftkern
+ if leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
+ local rightkern = i.rightkern
+ if rightkern and rightkern ~= 0 then
+ insert_node_after(head,n,newkern(rightkern))
+ n = getnext(n) -- to be checked
+ end
end
end
else
@@ -934,23 +937,23 @@ local function inject_pairs_only(head,where)
local h = d
for n in traverse_id(glyph_code,d) do
if getsubtype(n) < 256 then
- local pn = rawget(properties,n)
- if pn then
- pn = pn.postinjections
- end
- if pn then
- local yoffset = pn.yoffset
- if yoffset and yoffset ~= 0 then
- setfield(n,"yoffset",yoffset)
- end
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
- end
- local rightkern = pn.rightkern
- if rightkern and rightkern ~= 0 then
- insert_node_after(head,n,newkern(rightkern))
- n = getnext(n) -- to be checked
+ local p = rawget(properties,n)
+ if p then
+ local i = rawget(p,"postinjections")
+ if i then
+ local yoffset = i.yoffset
+ if yoffset and yoffset ~= 0 then
+ setfield(n,"yoffset",yoffset)
+ end
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
+ local rightkern = i.rightkern
+ if rightkern and rightkern ~= 0 then
+ insert_node_after(head,n,newkern(rightkern))
+ n = getnext(n) -- to be checked
+ end
end
end
else
@@ -966,23 +969,23 @@ local function inject_pairs_only(head,where)
local h = d
for n in traverse_id(glyph_code,d) do
if getsubtype(n) < 256 then
- local pn = rawget(properties,n)
- if pn then
- pn = pn.replaceinjections
- end
- if pn then
- local yoffset = pn.yoffset
- if yoffset and yoffset ~= 0 then
- setfield(n,"yoffset",yoffset)
- end
- local leftkern = pn.leftkern
- if leftkern ~= 0 then
- h = insert_node_before(h,n,newkern(leftkern))
- end
- local rightkern = pn.rightkern
- if rightkern and rightkern ~= 0 then
- insert_node_after(head,n,newkern(rightkern))
- n = getnext(n) -- to be checked
+ local p = rawget(properties,n)
+ if p then
+ local i = rawget(pn,"replaceinjections")
+ if i then
+ local yoffset = i.yoffset
+ if yoffset and yoffset ~= 0 then
+ setfield(n,"yoffset",yoffset)
+ end
+ local leftkern = i.leftkern
+ if leftkern and leftkern ~= 0 then
+ h = insert_node_before(h,n,newkern(leftkern))
+ end
+ local rightkern = i.rightkern
+ if rightkern and rightkern ~= 0 then
+ insert_node_after(head,n,newkern(rightkern))
+ n = getnext(n) -- to be checked
+ end
end
end
else
diff --git a/tex/context/base/lang-ini.mkiv b/tex/context/base/lang-ini.mkiv
index 5a745a7d8..a55c4665a 100644
--- a/tex/context/base/lang-ini.mkiv
+++ b/tex/context/base/lang-ini.mkiv
@@ -366,6 +366,12 @@
\installcorenamespace{languagenumbers}
+\appendtoks
+ % we need to reassign the number because new patterns can be defined later on
+ % so let's hope not that many \setups happen during a run
+ \global\expandafter\let\csname\??languagenumbers\currentlanguage\endcsname\undefined
+\to \everysetuplanguage
+
\def\lang_basics_synchronize_yes
{\zerocount % see below
\global\expandafter\chardef\csname\??languagenumbers\currentlanguage\endcsname
diff --git a/tex/context/base/node-aux.lua b/tex/context/base/node-aux.lua
index 36e6ec27c..8f1146857 100644
--- a/tex/context/base/node-aux.lua
+++ b/tex/context/base/node-aux.lua
@@ -352,7 +352,7 @@ local function tonodes(str,fnt,attr) -- (str,template_glyph) -- moved from blob-
n = new_glyph(fnt,s)
end
if attr then -- normally false when template
--- setfield(n,"attr",copy_node_list(attr))
+ -- setfield(n,"attr",copy_node_list(attr))
setfield(n,"attr",attr)
end
if head then
diff --git a/tex/context/base/node-ref.lua b/tex/context/base/node-ref.lua
index 78ef409bc..4c04e5ea7 100644
--- a/tex/context/base/node-ref.lua
+++ b/tex/context/base/node-ref.lua
@@ -32,9 +32,9 @@ local colors = attributes.colors
local references = structures.references
local tasks = nodes.tasks
-local trace_backend = false trackers.register("nodes.backend", function(v) trace_backend = v end)
local trace_references = false trackers.register("nodes.references", function(v) trace_references = v end)
local trace_destinations = false trackers.register("nodes.destinations", function(v) trace_destinations = v end)
+local trace_areas = false trackers.register("nodes.areas", function(v) trace_areas = v end)
local report_reference = logs.reporter("backend","references")
local report_destination = logs.reporter("backend","destinations")
@@ -57,6 +57,7 @@ local setattr = nuts.setattr
local getsubtype = nuts.getsubtype
local hpack_list = nuts.hpack
+local vpack_list = nuts.vpack
local list_dimensions = nuts.dimensions
local traverse = nuts.traverse
local find_node_tail = nuts.tail
@@ -69,6 +70,8 @@ local listcodes = nodes.listcodes
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
local glue_code = nodecodes.glue
+local glyph_code = nodecodes.glyph
+local rule_code = nodecodes.rule
local whatsit_code = nodecodes.whatsit
local leftskip_code = skipcodes.leftskip
@@ -83,68 +86,145 @@ local line_code = listcodes.line
local new_rule = nodepool.rule
local new_kern = nodepool.kern
+local free_node = nuts.free
+
local tosequence = nodes.tosequence
--- local function dimensions(parent,start,stop)
--- stop = stop and getnext(stop)
--- if parent then
--- if stop then
--- return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),start,stop)
--- else
--- return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign",getfield(parent,"glue_order"),start)
--- end
--- else
--- if stop then
--- return list_dimensions(start,stop)
--- else
--- return list_dimensions(start)
--- end
--- end
--- end
---
--- -- more compact
+-- Normally a (destination) area is a box or a simple stretch if nodes but when it is
+-- a paragraph we hav ea problem: we cannot calculate the height well. This happens
+-- with footnotes or content broken across a page.
+
+local function vlist_dimensions(start,stop)
+ local temp
+ if stop then
+ temp = getnext(stop)
+ setfield(stop,"next",nil)
+ end
+ local v = vpack_list(start)
+ local w = getfield(v,"width")
+ local h = getfield(v,"height")
+ local d = getfield(v,"depth")
+ setfield(v,"list",nil)
+ free_node(v)
+ if temp then
+ setfield(stop,"next",temp)
+ end
+ return w, h, d
+end
-local function dimensions(parent,start,stop)
+local function hlist_dimensions(start,stop,parent)
+ local last = stop and getnext(stop)
if parent then
- return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),start,stop and getnext(stop))
+ return list_dimensions(getfield(parent,"glue_set"),getfield(parent,"glue_sign"),getfield(parent,"glue_order"),start,last)
+ else
+ return list_dimensions(start,last)
+ end
+end
+
+local function dimensions(parent,start,stop) -- in principle we could move some to the caller
+ local id = getid(start)
+ if start == stop then
+ if id == hlist_code or id == vlist_code or id == glyph_code or id == rule_code then -- or image
+ if trace_areas then
+ report_area("dimensions taken of %a",nodecodes[id])
+ end
+ return getfield(start,"width"), getfield(parent,"height"), getfield(parent,"depth")
+ else
+ if trace_areas then
+ report_area("dimensions calculated of %a",nodecodes[id])
+ end
+ return hlist_dimensions(start,stop) -- one node only so simple
+ end
+ end
+ local last = stop and getnext(stop)
+ if parent then
+ -- todo: if no prev and no next and parent
+ -- todo: we need a a list_dimensions for a vlist
+ if getid(parent) == vlist_code then
+ local l = getlist(parent)
+ local c = l
+ local ok = false
+ while c do
+ if c == start then
+ ok = true
+ end
+ if ok and getid(c) == hlist_code then
+ break
+ else
+ c = getnext(c)
+ end
+ end
+ if ok and c then
+ if trace_areas then
+ report_area("dimensions taken of first line in vlist")
+ end
+ return getfield(c,"width"), getfield(c,"height"), getfield(c,"depth"), c
+ else
+ if trace_areas then
+ report_area("dimensions taken of vlist (probably wrong)")
+ end
+ return hlist_dimensions(start,stop,parent)
+ end
+ else
+ if trace_areas then
+ report_area("dimensions taken of range starting with %a using parent",nodecodes[id])
+ end
+ return hlist_dimensions(start,stop,parent)
+ end
else
- return list_dimensions(start,stop and getnext(stop))
+ if trace_areas then
+ report_area("dimensions taken of range starting with %a",nodecodes[id])
+ end
+ return hlist_dimensions(start,stop)
end
end
-- is pardir important at all?
local function inject_range(head,first,last,reference,make,stack,parent,pardir,txtdir)
- local width, height, depth = dimensions(parent,first,last)
+ local width, height, depth, line = dimensions(parent,first,last)
if txtdir == "+TRT" or (txtdir == "===" and pardir == "TRT") then -- KH: textdir == "===" test added
width = - width
end
local result, resolved = make(width,height,depth,reference)
if result and resolved then
- if head == first then
- if trace_backend then
- report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","head",
- reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved)
+ if line then
+ -- special case, we only treat the first line in a vlist
+ local l = getlist(line)
+ if trace_areas then
+ report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","line",
+ reference,pardir or "---",txtdir or "---",tosequence(l,nil,true),width,height,depth,resolved)
end
- setfield(result,"next",first)
- setfield(first,"prev",result)
- return result, last
+ setfield(line,"list",result)
+ setfield(result,"next",l)
+ setfield(l,"prev",result)
+ return head, last
else
- if trace_backend then
- report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","middle",
- reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved)
- end
- local prev = getprev(first)
- if prev then
- setfield(prev,"next",result)
- setfield(result,"prev",prev)
+ if head == first then
+ if trace_areas then
+ report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","head",
+ reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved)
+ end
+ setfield(result,"next",first)
+ setfield(first,"prev",result)
+ return result, last
+ else
+ if trace_areas then
+ report_area("%s: %04i %s %s %s => w=%p, h=%p, d=%p, c=%S","middle",
+ reference,pardir or "---",txtdir or "---",tosequence(first,last,true),width,height,depth,resolved)
+ end
+ local prev = getprev(first)
+ if prev then
+ setfield(prev,"next",result)
+ setfield(result,"prev",prev)
+ end
+ setfield(result,"next",first)
+ setfield(first,"prev",result)
+ -- if first == getnext(head) then
+ -- setfield(head,"next",result) -- hm, weird
+ -- end
+ return head, last
end
- setfield(result,"next",first)
- setfield(first,"prev",result)
--- if first == getnext(head) then
--- setfield(head,"next",result) -- hm, weird
--- end
- return head, last
end
else
return head, last
@@ -152,9 +232,12 @@ local function inject_range(head,first,last,reference,make,stack,parent,pardir,t
end
local function inject_list(id,current,reference,make,stack,pardir,txtdir)
- local width, height, depth, correction = getfield(current,"width"), getfield(current,"height"), getfield(current,"depth"), 0
- local moveright = false
- local first = getlist(current)
+ local width = getfield(current,"width")
+ local height = getfield(current,"height")
+ local depth = getfield(current,"depth")
+ local correction = 0
+ local moveright = false
+ local first = getlist(current)
if id == hlist_code then -- box_code line_code
-- can be either an explicit hbox or a line and there is no way
-- to recognize this; anyway only if ht/dp (then inline)
@@ -193,7 +276,7 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)
local result, resolved = make(width,height,depth,reference)
-- todo: only when width is ok
if result and resolved then
- if trace_backend then
+ if trace_areas then
report_area("%s: %04i %s %s %s: w=%p, h=%p, d=%p, c=%S","box",
reference,pardir or "---",txtdir or "----","[]",width,height,depth,resolved)
end
@@ -227,6 +310,11 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
while current do
local id = getid(current)
if id == hlist_code or id == vlist_code then
+
+ -- see dimensions: this is tricky with split off boxes like inserts
+ -- where we can end up with a first and last spanning lines
+
+
local r = getattr(current,attribute)
-- test \goto{test}[page(2)] test \gotobox{test}[page(2)]
-- test \goto{\TeX}[page(2)] test \gotobox{\hbox {x} \hbox {x}}[page(2)]
@@ -432,7 +520,7 @@ local function makereference(width,height,depth,reference) -- height and depth a
-- step = 0
local annot = nodeinjections.reference(width,height,depth,set)
if annot then
-annot = tonut(annot)
+ annot = tonut(annot) -- todo
nofreferences = nofreferences + 1
local result, current
if trace_references then
@@ -581,12 +669,15 @@ function references.mark(reference,h,d,view)
end
function references.inject(prefix,reference,h,d,highlight,newwindow,layer) -- todo: use currentreference is possible
+-- print(prefix,reference,h,d,highlight,newwindow,layer)
local set, bug = references.identify(prefix,reference)
if bug or #set == 0 then
-- unknown ref, just don't set it and issue an error
else
-- check
- set.highlight, set.newwindow, set.layer = highlight, newwindow, layer
+ set.highlight = highlight
+ set.newwindow = newwindow
+ set.layer = layer
setreference(h,d,set) -- sets attribute / todo: for set[*].error
end
end
diff --git a/tex/context/base/page-mix.mkiv b/tex/context/base/page-mix.mkiv
index ece93c948..4a86dfcf4 100644
--- a/tex/context/base/page-mix.mkiv
+++ b/tex/context/base/page-mix.mkiv
@@ -296,7 +296,11 @@
{\setvalue{\??mixedcolumnsseparator#1}{#2}}
\installmixedcolumnseparator\v!rule
- {\vrule\mixedcolumnsparameter\c!rulethickness\relax}
+ {\vrule
+ \s!width \mixedcolumnsparameter\c!rulethickness
+ \s!height\mixedcolumnseparatorheight
+ \s!depth \mixedcolumnseparatordepth
+ \relax}
\unexpanded\def\page_mix_command_inject_separator
{\begingroup
diff --git a/tex/context/base/publ-aut.lua b/tex/context/base/publ-aut.lua
index 7045ca41f..dc5a707cf 100644
--- a/tex/context/base/publ-aut.lua
+++ b/tex/context/base/publ-aut.lua
@@ -18,7 +18,8 @@ local concat = table.concat
local utfchar = utf.char
local formatters = string.formatters
-local P, C, V, Cs, Ct, lpegmatch, lpegpatterns = lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.match, lpeg.patterns
+local P, C, V, Cs, Ct, Cg, Cf, Cc = lpeg.P, lpeg.C, lpeg.V, lpeg.Cs, lpeg.Ct, lpeg.Cg, lpeg.Cf, lpeg.Cc
+local lpegmatch, lpegpatterns = lpeg.match, lpeg.patterns
local context = context
local commands = commands
@@ -47,7 +48,7 @@ local report = logs.reporter("publications","authors")
-- authorspec = von, surnames, jr, firstnames
-- authorspec = von, surnames, jr, firstnames, initials
-local space = P(" ")
+local space = lpegpatterns.whitespace
local comma = P(",")
local period = P(".")
local dash = P("-")
@@ -82,6 +83,8 @@ local p_initial = p_shortone * period * dash^0
+ p_longone * (period + dash + P(-1))
local initialsplitter = p_initial * P(-1) + Ct((p_initial)^1)
+local optionsplitter = Cf(Ct("") * Cg(C((1-space)^1) * space^0 * Cc(true))^1,rawset)
+
local function is_upper(str)
local first = lpegmatch(firstcharacter,str)
local okay = chardata[first]
@@ -122,7 +125,7 @@ local function splitauthorstring(str)
-- print("hit 2",author,nofhits,nofused,math.round(100*nofhits/nofused))
end
if not detail then
- local firstnames, vons, surnames, initials, juniors
+ local firstnames, vons, surnames, initials, juniors, options
local split = lpegmatch(commasplitter,author)
local n = #split
detail = {
@@ -224,12 +227,17 @@ local function splitauthorstring(str)
juniors = lpegmatch(spacesplitter,split[3])
firstnames = lpegmatch(spacesplitter,split[4])
initials = lpegmatch(spacesplitter,split[5])
+ options = split[6]
+ if options then
+ options = lpegmatch(optionsplitter,options)
+ end
end
if firstnames and #firstnames > 0 then detail.firstnames = firstnames end
if vons and #vons > 0 then detail.vons = vons end
if surnames and #surnames > 0 then detail.surnames = surnames end
if initials and #initials > 0 then detail.initials = initials end
if juniors and #juniors > 0 then detail.juniors = juniors end
+ if options and next(options) then detail.options = options end
cache[author] = detail
nofhits = nofhits + 1
end
diff --git a/tex/context/base/publ-dat.lua b/tex/context/base/publ-dat.lua
index 97ff543ca..bfb38645b 100644
--- a/tex/context/base/publ-dat.lua
+++ b/tex/context/base/publ-dat.lua
@@ -400,27 +400,29 @@ do
-- we apply some normalization
- local space = S(" \t\n\r\f") -- / " "
-
- ----- command = P("\\") * Cc("btxcmd{") * (R("az","AZ")^1) * Cc("}")
- ----- command = P("\\") * (Carg(1) * C(R("az","AZ")^1) / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
- local command = P("\\") * (Carg(1) * C(R("az","AZ")^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
- local somemath = P("$") * ((1-P("$"))^1) * P("$") -- let's not assume nested math
- local any = P(1)
- local done = P(-1)
- local one_l = P("{") / ""
- local one_r = P("}") / ""
- local two_l = P("{{") / ""
- local two_r = P("}}") / ""
- local special = P("#") / "\\letterhash"
-
- local filter_0 = S('\\{}')
- local filter_1 = (1-filter_0)^0 * filter_0
- local filter_2 = Cs(
+ local space = S(" \t\n\r\f") -- / " "
+ local collapsed = space^1/" "
+
+ ----- command = P("\\") * Cc("btxcmd{") * (R("az","AZ")^1) * Cc("}")
+ ----- command = P("\\") * (Carg(1) * C(R("az","AZ")^1) / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
+ local command = P("\\") * (Carg(1) * C(R("az","AZ")^1) * space^0 / function(list,c) list[c] = (list[c] or 0) + 1 return "btxcmd{" .. c .. "}" end)
+ local somemath = P("$") * ((1-P("$"))^1) * P("$") -- let's not assume nested math
+ ----- character = lpegpatterns.utf8character
+ local any = P(1)
+ local done = P(-1)
+ local one_l = P("{") / ""
+ local one_r = P("}") / ""
+ local two_l = P("{{") / ""
+ local two_r = P("}}") / ""
+ local special = P("#") / "\\letterhash"
+
+ local filter_0 = S('\\{}')
+ local filter_1 = (1-filter_0)^0 * filter_0
+ local filter_2 = Cs(
-- {{...}} ... {{...}}
-- two_l * (command + special + any - two_r - done)^0 * two_r * done +
-- one_l * (command + special + any - one_r - done)^0 * one_r * done +
- (somemath + command + special + any )^0
+ (somemath + command + special + collapsed + any)^0
)
-- Currently we expand shortcuts and for large ones (like the acknowledgements
@@ -833,7 +835,7 @@ do
local v = function(dataset,filename)
report("no loader for file %a with filetype %a",filename,filetype)
end
- t[k] = v
+ t[filetype] = v
return v
end)
diff --git a/tex/context/base/publ-ini.lua b/tex/context/base/publ-ini.lua
index fe1007d88..2d85637a2 100644
--- a/tex/context/base/publ-ini.lua
+++ b/tex/context/base/publ-ini.lua
@@ -2263,7 +2263,7 @@ do
end
- -- entry
+ -- entry (we could provide a generic one)
do
diff --git a/tex/context/base/publ-ini.mkiv b/tex/context/base/publ-ini.mkiv
index 4bfb7db8f..c9670f535 100644
--- a/tex/context/base/publ-ini.mkiv
+++ b/tex/context/base/publ-ini.mkiv
@@ -1378,6 +1378,9 @@
%D In-text entries:
+\definebtxcitevariant
+ [entry]
+
\unexpanded\def\placecitation{\citation[entry]} % [#1]
\unexpanded\def\btxhandleciteentry
diff --git a/tex/context/base/publ-tra.lua b/tex/context/base/publ-tra.lua
index 2b5d63a83..1c39aef97 100644
--- a/tex/context/base/publ-tra.lua
+++ b/tex/context/base/publ-tra.lua
@@ -92,10 +92,10 @@ function tracers.showdatasetcompleteness(settings)
local fielddata = specification and specifications[specification] or specifications.apa
local categories = fielddata.categories
- local lpegmatch = lpeg.match
- local texescape = lpeg.patterns.texescape
+ -- local lpegmatch = lpeg.match
+ -- local texescape = lpeg.patterns.texescape
- local preamble = { "|lTBw(5em)|lBTp(10em)|pl|" }
+ local preamble = { "|lTBw(5em)|lBTp(10em)|plT|" }
local function identified(tag,category,crossref)
ctx_NC()
@@ -114,12 +114,13 @@ function tracers.showdatasetcompleteness(settings)
ctx_NC()
if indirect then
if value then
- context("\\darkblue %s",lpegmatch(texescape,value))
+ context("\\darkblue")
+ ctx_verbatim(value)
else
context("\\darkred\\tttf [missing crossref]")
end
elseif value then
- context(lpegmatch(texescape,value))
+ ctx_verbatim(value)
else
context("\\darkred\\tttf [missing value]")
end
@@ -133,9 +134,10 @@ function tracers.showdatasetcompleteness(settings)
ctx_NC() context(key)
ctx_NC()
if indirect then
- context("\\darkblue %s",lpegmatch(texescape,value))
+ context("\\darkblue")
+ ctx_verbatim(value)
elseif value then
- context(lpegmatch(texescape,value))
+ ctx_verbatim(value)
end
ctx_NC() ctx_NR()
foundfields[key] = nil
@@ -145,7 +147,7 @@ function tracers.showdatasetcompleteness(settings)
local function special(done,key,value)
ctx_NC() if not done then ctx_monobold("special") end
ctx_NC() context(key)
- ctx_NC() context(lpegmatch(texescape,value))
+ ctx_NC() ctx_verbatim(value)
ctx_NC() ctx_NR()
return done or true
end
@@ -153,7 +155,7 @@ function tracers.showdatasetcompleteness(settings)
local function extra(done,key,value)
ctx_NC() if not done then ctx_monobold("extra") end
ctx_NC() context(key)
- ctx_NC() context(lpegmatch(texescape,value))
+ ctx_NC() ctx_verbatim(value)
ctx_NC() ctx_NR()
return done or true
end
@@ -328,27 +330,31 @@ function tracers.showdatasetauthors(settings)
if not dataset or dataset == "" then dataset = "standard" end
if not field or field == "" then field = "author" end
- local function flush(ai,k,i)
+ local function row(i,k,v)
+ ctx_NC()
+ if i then
+ ctx_verbatim(i)
+ end
+ ctx_NC()
+ ctx_verbatim(k)
+ ctx_EQ()
+ if type(v) == "table" then
+ ctx_verbatim(concat(v, " | "))
+ else
+ ctx_verbatim(v)
+ end
+ ctx_NC()
+ ctx_NR()
+ end
+
+ local function authorrow(ai,k,i)
local v = ai[k]
if v then
- ctx_NC()
- if i then
- ctx_verbatim(i)
- end
- ctx_NC()
- ctx_verbatim(k)
- ctx_EQ()
- if type(v) == "table" then
- ctx_verbatim(concat(v, " | "))
- else
- ctx_verbatim(v)
- end
- ctx_NC()
- ctx_NR()
+ row(i,k,v)
end
end
- local function row(key,value)
+ local function commonrow(key,value)
ctx_NC() ctx_rlap(function() ctx_verbatim(key) end)
ctx_NC()
ctx_EQ() ctx_verbatim(value)
@@ -366,19 +372,23 @@ function tracers.showdatasetauthors(settings)
context.tt()
context.starttabulate { "|B|Bl|p|" }
ctx_FL()
- row("tag",tag)
- row("field",field)
- row("content",getfield(dataset,tag,field))
+ commonrow("tag",tag)
+ commonrow("field",field)
+ commonrow("content",getfield(dataset,tag,field))
for i=1,#a do
ctx_ML()
local ai = a[i]
- flush(ai,"original",i)
- flush(ai,"snippets")
- flush(ai,"initials")
- flush(ai,"firstnames")
- flush(ai,"vons")
- flush(ai,"surnames")
- flush(ai,"juniors")
+ authorrow(ai,"original",i)
+ authorrow(ai,"snippets")
+ authorrow(ai,"initials")
+ authorrow(ai,"firstnames")
+ authorrow(ai,"vons")
+ authorrow(ai,"surnames")
+ authorrow(ai,"juniors")
+ local options = ai.options
+ if options then
+ row(false,"options",sortedkeys(options))
+ end
end
ctx_LL()
context.stoptabulate()
diff --git a/tex/context/base/publ-usr.lua b/tex/context/base/publ-usr.lua
index 4650401ee..f01112279 100644
--- a/tex/context/base/publ-usr.lua
+++ b/tex/context/base/publ-usr.lua
@@ -6,13 +6,16 @@ if not modules then modules = { } end modules ['publ-usr'] = {
license = "see context related readme files"
}
-local P, Cs, R, Cc, Carg = lpeg.P, lpeg.Cs, lpeg.R, lpeg.Cc, lpeg.Carg
+local P, Cs, R, Cc, C, Carg = lpeg.P, lpeg.Cs, lpeg.R, lpeg.Cc, lpeg.C, lpeg.Carg
local lpegmatch = lpeg.match
local settings_to_hash = utilities.parsers.settings_to_hash
local publications = publications
local datasets = publications.datasets
+local report = logs.reporter("publications")
+local trace = false trackers.register("publications",function(v) trace = v end)
+
-- local str = [[
-- \startpublication[k=Berdnikov:TB21-2-129,t=article,a={{Berdnikov},{}},y=2000,n=2257,s=BHHJ00]
-- \artauthor[]{Alexander}[A.]{}{Berdnikov}
@@ -30,42 +33,27 @@ local datasets = publications.datasets
-- \stoppublication
-- ]]
-local remapped = {
- artauthor = "author",
- arttitle = "title",
+local lists = {
+ author = true,
+ editor = true,
+ -- artauthor = true,
+ -- arteditor = true,
}
-local function register(target,key,a,b,c,d,e)
- key = remapped[key] or key
- if b and d and e then
- local s = nil
- if b ~= "" and b then
- s = s and s .. " " .. b or b
- end
- if d ~= "" and d then
- s = s and s .. " " .. d or d
- end
- if e ~= "" and e then
- s = s and s .. " " .. e or e
- end
- if a ~= "" and a then
- s = s and s .. " " .. a or a
- end
- local value = target[key]
- if s then
- if value then
- target[key] = value .. " and " .. s
- else
- target[key] = s
- end
- else
- if not value then
- target[key] = s
- end
- end
- else
- target[key] = b
- end
+local function registervalue(target,key,value)
+ target[key] = value
+end
+
+-- Instead of being generic we just hardcode the old stuff:
+
+local function registerauthor(target,key,juniors,firstnames,initials,vons,surnames)
+ local value = target[key]
+ target[key]= ((value and value .. " and {") or "{") ..
+ vons .. "},{" ..
+ surnames .. "},{" ..
+ juniors .. "},{" ..
+ firstnames .. "},{" ..
+ initials .. "}"
end
local leftbrace = P("{")
@@ -75,14 +63,25 @@ local rightbracket = P("]")
local backslash = P("\\")
local letter = R("az","AZ")
-local key = backslash * Cs(letter^1) * lpeg.patterns.space^0
-local mandate = leftbrace * Cs(lpeg.patterns.balanced) * rightbrace + Cc(false)
-local optional = leftbracket * Cs((1-rightbracket)^0) * rightbracket + Cc(false)
-local value = optional^-1 * mandate^-1 * optional^-1 * mandate^-2
+local skipspaces = lpeg.patterns.whitespace^0
+local key = Cs(letter^1)
+local value = leftbrace * Cs(lpeg.patterns.balanced) * rightbrace
+local optional = leftbracket * Cs((1-rightbracket)^0) * rightbracket
+
+local authorkey = (P("artauthor") + P("author")) / "author"
+ + (P("arteditor") + P("editor")) / "editor"
+local authorvalue = (optional + Cc("{}")) * skipspaces -- [juniors]
+ * (value + Cc("{}")) * skipspaces -- {firstnames}
+ * (optional + Cc("{}")) * skipspaces -- [initials]
+ * (value + Cc("{}")) * skipspaces -- {vons}
+ * (value + Cc("{}")) * skipspaces -- {surnames}
+
+local keyvalue = Carg(1) * authorkey * skipspaces * authorvalue / registerauthor
+ + Carg(1) * key * skipspaces * value / registervalue
-local pattern = ((Carg(1) * key * value) / register + P(1))^0
+local pattern = (backslash * keyvalue + P(1))^0
-function publications.addtexentry(dataset,settings,content)
+local function addtexentry(dataset,settings,content)
local current = datasets[dataset]
local settings = settings_to_hash(settings)
local data = {
@@ -90,10 +89,38 @@ function publications.addtexentry(dataset,settings,content)
category = settings.category or settings.t or "article",
}
lpegmatch(pattern,content,1,data) -- can set tag too
- current.userdata[data.tag] = data
- current.luadata[data.tag] = data
- publications.markasupdated(current)
+ local tag = data.tag
+ current.userdata[tag] = data
+ current.luadata[tag] = data
+ current.details[tag] = nil
return data
end
-commands.addbtxentry = publications.addtexentry
+local pattern = ( Carg(1)
+ * P("\\startpublication")
+ * skipspaces
+ * optional
+ * C((1 - P("\\stoppublication"))^1)
+ * P("\\stoppublication") / addtexentry
+ + P("%") * (1-lpeg.patterns.newline)^0
+ + P(1)
+)^0
+
+function publications.loaders.bbl(dataset,filename)
+ local dataset, fullname = publications.resolvedname(dataset,filename)
+ if not fullname then
+ return
+ end
+ local data = io.loaddata(filename) or ""
+ if data == "" then
+ report("empty file %a, nothing loaded",fullname)
+ return
+ end
+ if trace then
+ report("loading file %a",fullname)
+ end
+ lpegmatch(pattern,data,1,dataset)
+end
+
+publications.addtexentry = addtexentry
+commands.addbtxentry = addtexentry
diff --git a/tex/context/base/s-fonts-ligatures.mkiv b/tex/context/base/s-fonts-ligatures.mkiv
index 21d8efe34..3453aa010 100644
--- a/tex/context/base/s-fonts-ligatures.mkiv
+++ b/tex/context/base/s-fonts-ligatures.mkiv
@@ -70,9 +70,15 @@
\eTD
\stoptexdefinition
+\def\showotfligaturescells{3}
+%def\showotfligaturesnx {12}
+%def\showotfligatureswidth{18em}
+\def\showotfligaturesnx {\the\numexpr 3*\showotfligaturescells}
+\def\showotfligatureswidth{\the\dimexpr6em*\showotfligaturescells}
+
\starttexdefinition showotfligaturesbanner #1
\bTR[frame=off]
- \bTD [nx=12,width=18em,align={middle,lohi},height=4ex]
+ \bTD [nx=\showotfligaturesnx,width=\showotfligatureswidth,align={middle,lohi},height=4ex]
\tttf #1
\eTD
\eTR
@@ -132,7 +138,7 @@
\starttexdefinition showotfligaturesdefaults
\bTR
- \bTD [nx=12,width=18em,align=middle,height=4ex,frame=off]
+ \bTD [nx=\showotfligaturesnx,width=\showotfligatureswidth,align=middle,height=4ex,frame=off]
\start \LigatureFont fb \stop \quad
\start \LigatureFont ff \stop \quad
\start \LigatureFont fi \stop \quad
@@ -156,6 +162,8 @@
\showotfligaturesextremes {#2}
\stoptexdefinition
+% todo: n -> and split in lua
+
\starttexdefinition showotfligaturesexamples
\showotfligaturesexample
{leafing,baffling,efficient,shifffahrt}
diff --git a/tex/context/base/s-structure-sections.mkiv b/tex/context/base/s-structure-sections.mkiv
new file mode 100644
index 000000000..daaab5abc
--- /dev/null
+++ b/tex/context/base/s-structure-sections.mkiv
@@ -0,0 +1,80 @@
+%D \module
+%D [ file=s-structure-sections,
+%D version=2015.02.02,
+%D title=\CONTEXT\ Style File,
+%D subtitle=Show Structure Sections,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+\startluacode
+ local context = context
+ local ctx_NC, ctx_NR = context.NC, context.NR
+ local ctx_bold = context.bold
+
+ structures.tracers = structures.tracers or { }
+
+ function structures.tracers.showsections()
+
+ local list = structures.sections.registered
+ local keys = table.keys(list)
+ table.sort(keys,function(a,b)
+ local la, lb = list[a].level, list[b].level
+ if la == lb then
+ return a < b
+ else
+ return la < lb
+ end
+ end)
+ context.start()
+ context.switchtobodyfont { "tt" }
+ context.starttabulate { "||c||||" }
+ context.FL()
+ ctx_NC() ctx_bold("name")
+ ctx_NC() ctx_bold("level")
+ ctx_NC() ctx_bold("parent")
+ ctx_NC() ctx_bold("section")
+ ctx_NC() ctx_bold("coupling")
+ ctx_NC() context.NR()
+ context.ML()
+ for i=1,#keys do
+ local k = keys[i]
+ local v = list[k]
+ ctx_NC() ctx_bold(k)
+ ctx_NC() context(v.level)
+ ctx_NC() context(v.parent)
+ ctx_NC() context(v.section)
+ ctx_NC() context(v.coupling)
+ ctx_NC() context.NR()
+ end
+ context.LL()
+ context.stoptabulate()
+ context.stop()
+
+ end
+\stopluacode
+
+
+\starttexdefinition showstructuresections
+
+ % no settings yet
+
+ \ctxlua{structures.tracers.showsections()}
+
+\stoptexdefinition
+
+\protect
+
+\continueifinputfile{s-structure-sections.mkiv}
+
+\starttext
+
+ \showstructuresections
+
+\stoptext
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 35d1d9880..275184f80 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 a133c3289..b9623e001 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-con.mkvi b/tex/context/base/strc-con.mkvi
index e32c3dd61..4a9315f33 100644
--- a/tex/context/base/strc-con.mkvi
+++ b/tex/context/base/strc-con.mkvi
@@ -263,7 +263,9 @@
\def\strc_constructions_ignore_head
{\constructionsheaddistance\zeropoint
- \constructionsheadwidth \zeropoint}
+ \constructionsheadwidth \zeropoint
+ % we also need to make sure that no stretch creeps in (new per 2015-02-02, for Alan)
+ \settrue\c_strc_constructions_distance_none}
\let\currentconstructionhash\??construction
@@ -325,7 +327,7 @@
\else
\strc_constructions_preroll_head\currentconstructionsample
\ifzeropt\wd\constructionheadbox
- \strc_constructions_ignore_head
+ \strc_constructions_ignore_head
\else
\strc_constructions_set_width_and_distance
\fi
@@ -530,6 +532,11 @@
% The setups. These only deal with placement of the descriptor and initializing the
% environment. The wrapping happens elsewhere.
+% todo: optimize the setups with
+%
+% \ifconditional\c_strc_constructions_distance_none : no need for skip
+% \ifzeropt\wd\constructionheadbox : no need for box and skips
+
\startsetups[\??constructionrenderings:\v!left]
\edef\p_strc_constructions_hang{\constructionparameter\c!hang}%
\doifsetupselse{\??constructionrenderings:\v!left:\p_strc_constructions_hang} {
diff --git a/tex/context/base/strc-doc.lua b/tex/context/base/strc-doc.lua
index 24a705164..f91136f5d 100644
--- a/tex/context/base/strc-doc.lua
+++ b/tex/context/base/strc-doc.lua
@@ -128,8 +128,21 @@ local registered = sections.registered
storage.register("structures/sections/registered", registered, "structures.sections.registered")
+local function update(name,level,section)
+ for k, v in next, registered do
+ if k ~= name and v.coupling == name then
+ report_structure("updating section level %a to level of %a",k,name)
+ context.doredefinehead(k,name)
+ update(k,level,section)
+ end
+ end
+end
+
function sections.register(name,specification)
registered[name] = specification
+ local level = specification.level
+ local section = specification.section
+ update(name,level,section)
end
function sections.currentid()
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index 6d2a04fec..142696b28 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -1218,7 +1218,7 @@
\begstrut
\strc_references_flush_destination_nodes
\strc_notes_set_destination_attribute_text
- \strc_notes_inject_text
+ \strc_notes_inject_text\relax
\ifvmode\obeydepth\else\endstrut\fi % \obeydepth is new per 2015-01-10
\strc_constructions_stored_stop
% \endgroup
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index 633fc112a..1a4ccecd8 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -1716,7 +1716,9 @@ function references.valid(prefix,reference,highlight,newwindow,layer)
unknowns[str] = u + 1
end
else
- set.highlight, set.newwindow, set.layer = highlight, newwindow, layer
+ set.highlight = highlight
+ set.newwindow = newwindow
+ set.layer = layer
currentreference = set[1]
end
-- we can do the expansion here which saves a call
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 06a34c11a..26ddfaac0 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -431,11 +431,17 @@
\the\everysetuphead
\to \everydefinehead
+\newtoks\everyredefinehead
+
\appendtoks
- \setstructurelevel\currenthead{\thenamedheadlevel\currenthead}%
+ \the\everyredefinehead
\to \everydefinehead
\appendtoks
+ \setstructurelevel\currenthead{\thenamedheadlevel\currenthead}%
+\to \everyredefinehead
+
+\appendtoks
% beware, this is a global register
\begingroup
\edef\currentsectionheadcoupling{\sectionheadcoupling\currenthead}%
@@ -445,9 +451,11 @@
coupling = "\currentsectionheadcoupling",
section = "\currentsectionheadsection",
level = \currentsectionlevel,
+ % for statistical purposes:
+ parent = "\currentheadparent"
})}%
\endgroup
-\to \everydefinehead
+\to \everyredefinehead
\appendtoks
% \setevalue{\e!next \currenthead}{\donexthead [\currenthead]}%
@@ -461,6 +469,15 @@
{\setuevalue\currenthead{\strc_sectioning_handle_nop[\currenthead]}}%
\to \everysetuphead
+\unexpanded\def\doredefinehead#1#2% called at lua end
+ {\pushmacro\currenthead
+ \pushmacro\currentheadparent
+ \edef\currenthead{#1}%
+ \edef\currentheadparent{#2}%
+ \the\everyredefinehead\relax
+ \popmacro\currentheadparent
+ \popmacro\currenthead}
+
\let\currentnamedsection\empty
\unexpanded\def\startnamedsection
diff --git a/tex/context/base/strc-tag.mkiv b/tex/context/base/strc-tag.mkiv
index e538eff2d..e1198af4d 100644
--- a/tex/context/base/strc-tag.mkiv
+++ b/tex/context/base/strc-tag.mkiv
@@ -73,6 +73,8 @@
\def\t!registerpages {registerpages} % Span
\def\t!registerpage {registerpage} % Span
\def\t!registerpagerange {registerpagerange} % Span
+\def\t!registerfrompage {registerfrompage} % Span
+\def\t!registertopage {registertopage} % Span
\def\t!registerseparator {registerseparator} % Span
\def\t!table {table} % Table
diff --git a/tex/context/base/typo-brk.lua b/tex/context/base/typo-brk.lua
index f9a65c6ba..2a9c94c86 100644
--- a/tex/context/base/typo-brk.lua
+++ b/tex/context/base/typo-brk.lua
@@ -107,7 +107,8 @@ methods[2] = function(head,start) -- ( => (-
local tmp
head, start, tmp = remove_node(head,start)
head, start = insert_node_before(head,start,new_disc())
- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ -- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ setfield(start,"attr",getfield(tmp,"attr"))
setfield(start,"replace",tmp)
local tmp = copy_node(tmp)
local hyphen = copy_node(tmp)
@@ -125,7 +126,8 @@ methods[3] = function(head,start) -- ) => -)
local tmp
head, start, tmp = remove_node(head,start)
head, start = insert_node_before(head,start,new_disc())
- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ -- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ setfield(start,"attr",getfield(tmp,"attr"))
setfield(start,"replace",tmp)
local tmp = copy_node(tmp)
local hyphen = copy_node(tmp)
@@ -143,7 +145,8 @@ methods[4] = function(head,start) -- - => - - -
local tmp
head, start, tmp = remove_node(head,start)
head, start = insert_node_before(head,start,new_disc())
- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ -- setfield(start,"attr",copy_nodelist(getfield(tmp,"attr"))) -- just a copy will do
+ setfield(start,"attr",getfield(tmp,"attr"))
setfield(start,"pre",copy_node(tmp))
setfield(start,"post",copy_node(tmp))
setfield(start,"replace",tmp)
@@ -171,7 +174,8 @@ methods[5] = function(head,start,settings) -- x => p q r
if middle then
setfield(start,"replace",(tonodes(tostring(middle),font,attr)))
end
- setfield(start,"attr",copy_nodelist(attr)) -- todo: critical only -- just a copy will do
+ -- setfield(start,"attr",copy_nodelist(attr)) -- todo: critical only -- just a copy will do
+ setfield(start,"attr",attr) -- todo: critical only -- just a copy will do
free_node(tmp)
insert_break(head,start,10000,10000)
end
diff --git a/tex/context/base/typo-dua.lua b/tex/context/base/typo-dua.lua
index 73b00f033..1e9b325a6 100644
--- a/tex/context/base/typo-dua.lua
+++ b/tex/context/base/typo-dua.lua
@@ -710,7 +710,7 @@ local function apply_to_list(list,size,head,pardir)
if enddir and getsubtype(current) == parfillskip_code then
-- insert the last enddir before \parfillskip glue
local d = new_textdir(enddir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head = insert_node_before(head,current,d)
enddir = false
done = true
@@ -719,7 +719,7 @@ local function apply_to_list(list,size,head,pardir)
if begindir and getsubtype(current) == localpar_code then
-- local_par should always be the 1st node
local d = new_textdir(begindir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head, current = insert_node_after(head,current,d)
begindir = nil
done = true
@@ -727,7 +727,7 @@ local function apply_to_list(list,size,head,pardir)
end
if begindir then
local d = new_textdir(begindir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head = insert_node_before(head,current,d)
done = true
end
@@ -739,7 +739,7 @@ local function apply_to_list(list,size,head,pardir)
end
if enddir then
local d = new_textdir(enddir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head, current = insert_node_after(head,current,d)
done = true
end
diff --git a/tex/context/base/typo-dub.lua b/tex/context/base/typo-dub.lua
index 7437e2c44..a1c9de752 100644
--- a/tex/context/base/typo-dub.lua
+++ b/tex/context/base/typo-dub.lua
@@ -819,7 +819,7 @@ local function apply_to_list(list,size,head,pardir)
if enddir and getsubtype(current) == parfillskip_code then
-- insert the last enddir before \parfillskip glue
local d = new_textdir(enddir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head = insert_node_before(head,current,d)
enddir = false
done = true
@@ -828,7 +828,7 @@ local function apply_to_list(list,size,head,pardir)
if begindir and getsubtype(current) == localpar_code then
-- local_par should always be the 1st node
local d = new_textdir(begindir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head, current = insert_node_after(head,current,d)
begindir = nil
done = true
@@ -836,7 +836,7 @@ local function apply_to_list(list,size,head,pardir)
end
if begindir then
local d = new_textdir(begindir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head = insert_node_before(head,current,d)
done = true
end
@@ -848,7 +848,7 @@ local function apply_to_list(list,size,head,pardir)
end
if enddir then
local d = new_textdir(enddir)
--- setfield(d,"attr",copy_node(getfield(current,"attr")))
+ -- setfield(d,"attr",getfield(current,"attr"))
head, current = insert_node_after(head,current,d)
done = true
end
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index ff3230b5f..bef47218d 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 : 01/30/15 15:28:21
+-- merge date : 02/03/15 21:36:49
do -- begin closure to overcome local limits and interference