summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/node-ref.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/node-ref.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/node-ref.lua28
1 files changed, 15 insertions, 13 deletions
diff --git a/Master/texmf-dist/tex/context/base/node-ref.lua b/Master/texmf-dist/tex/context/base/node-ref.lua
index 19d602ed673..dc14102827f 100644
--- a/Master/texmf-dist/tex/context/base/node-ref.lua
+++ b/Master/texmf-dist/tex/context/base/node-ref.lua
@@ -16,6 +16,8 @@ if not modules then modules = { } end modules ['node-bck'] = {
-- is grouplevel still used?
+local format = string.format
+
local allocate, mark = utilities.storage.allocate, utilities.storage.mark
local cleanupreferences, cleanupdestinations = false, true
@@ -102,7 +104,7 @@ end
local function inject_range(head,first,last,reference,make,stack,parent,pardir,txtdir)
local width, height, depth = dimensions(parent,first,last)
- if pardir == "TRT" or txtdir == "+TRT" then
+ if txtdir == "+TRT" or (txtdir == "===" and pardir == "TRT") then -- KH: textdir == "===" test added
width = - width
end
local result, resolved = make(width,height,depth,reference)
@@ -178,6 +180,7 @@ local function inject_list(id,current,reference,make,stack,pardir,txtdir)
width = - width
end
local result, resolved = make(width,height,depth,reference)
+ -- todo: only when width is ok
if result and resolved then
if trace_backend then
report_area("box: %04i %s %s: w=%s, h=%s, d=%s, c=%s",reference,pardir or "---",txtdir or "----",width,height,depth,resolved)
@@ -220,7 +223,7 @@ local function inject_areas(head,attribute,make,stack,done,skip,parent,pardir,tx
elseif id == glue_code and current.subtype == leftskip_code then -- any glue at the left?
--
elseif id == hlist_code or id == vlist_code then
--- somehow reference is true so teh following fails (second one not done) in
+-- 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
-- if not reference and r and (not skip or r > skip) then -- > or ~=
@@ -294,7 +297,6 @@ end
-- tracing
-
local nodepool = nodes.pool
local new_rule = nodepool.rule
@@ -310,7 +312,7 @@ local u_transparency = nil
local u_colors = { }
local force_gray = true
-local function colorize(width,height,depth,n)
+local function colorize(width,height,depth,n,reference,what)
if force_gray then n = 0 end
u_transparency = u_transparency or transparencies.register(nil,2,.65)
local ucolor = u_colors[n]
@@ -328,11 +330,12 @@ local function colorize(width,height,depth,n)
u_colors[n] = u_color
end
if width == 0 then
- report_area("reference %s has no horizontal dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth)
+ -- probably a strut as placeholder
+ report_area("%s %s has no horizontal dimensions: width=%s, height=%s, depth=%s",what,reference,width,height,depth)
width = 65536
end
if height + depth <= 0 then
- report_area("reference %s has no vertical dimensions: width=%s, height=%s, depth=%s",reference,width,height,depth)
+ report_area("%s %s has no vertical dimensions: width=%s, height=%s, depth=%s",what,reference,n,width,height,depth)
height = 65536/2
depth = height
end
@@ -374,11 +377,10 @@ nodes.references = {
-- todo: get rid of n (n is just a number, can be used for tracing, obsolete)
-local function setreference(n,h,d,r)
+local function setreference(h,d,r)
topofstack = topofstack + 1
-- the preroll permits us to determine samepage (but delayed also has some advantages)
-- so some part of the backend work is already done here
---~ stack[topofstack] = { n, h, d, codeinjections.prerollreference(r) }
stack[topofstack] = { r, h, d, codeinjections.prerollreference(r) }
-- texattribute[attribute] = topofstack -- todo -> at tex end
texcount.lastreferenceattribute = topofstack
@@ -406,7 +408,7 @@ local function makereference(width,height,depth,reference)
local result, current
if trace_references then
local step = 65536
- result = hpack_list(colorize(width,height-step,depth-step,2,reference)) -- step subtracted so that we can see seperate links
+ result = hpack_list(colorize(width,height-step,depth-step,2,reference,"reference")) -- step subtracted so that we can see seperate links
result.width = 0
current = result
end
@@ -475,7 +477,7 @@ local function makedestination(width,height,depth,reference)
width, height, depth = 5*step, 5*step, 0
end
for n=1,#name do
- local rule = hpack_list(colorize(width,height,depth,3,reference))
+ local rule = hpack_list(colorize(width,height,depth,3,reference,"destination"))
rule.width = 0
if not result then
result, current = rule, rule
@@ -531,14 +533,14 @@ function references.inject(prefix,reference,h,d,highlight,newwindow,layer) -- to
else
-- check
set.highlight, set.newwindow,set.layer = highlight, newwindow, layer
- setreference(tex.currentgrouplevel,h,d,set) -- sets attribute / todo: for set[*].error
+ setreference(h,d,set) -- sets attribute / todo: for set[*].error
end
end
function references.injectcurrentset(h,d) -- used inside doifelse
local currentset = references.currentset
if currentset then
- setreference(tex.currentgrouplevel,h,d,currentset) -- sets attribute / todo: for set[*].error
+ setreference(h,d,currentset) -- sets attribute / todo: for set[*].error
end
end
@@ -560,7 +562,7 @@ end
statistics.register("interactive elements", function()
if nofreferences > 0 or nofdestinations > 0 then
- return string.format("%s references, %s destinations",nofreferences,nofdestinations)
+ return format("%s references, %s destinations",nofreferences,nofdestinations)
else
return nil
end