From 64f6e8fc0c6cb9254a6fe3db0b4ab31c51cf8524 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 4 Apr 2019 14:11:01 +0200 Subject: 2019-04-04 13:38:00 --- tex/context/base/mkiv/strc-not.lua | 39 ++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'tex/context/base/mkiv/strc-not.lua') diff --git a/tex/context/base/mkiv/strc-not.lua b/tex/context/base/mkiv/strc-not.lua index bb9d64beb..b2c8106e1 100644 --- a/tex/context/base/mkiv/strc-not.lua +++ b/tex/context/base/mkiv/strc-not.lua @@ -247,15 +247,38 @@ end notes.internal = internal notes.ordered = ordered +-- local function onsamepageasprevious(tag) +-- local same = false +-- local n = getn(tag,n) +-- local current = get(tag,n) +-- local previous = get(tag,n-1) +-- if current and previous then +-- local cr = current.references +-- local pr = previous.references +-- same = cr and pr and cr.realpage == pr.realpage +-- end +-- return same and true or false +-- end + local function onsamepageasprevious(tag) - local same = false - local n = getn(tag,n) - local current, previous = get(tag,n), get(tag,n-1) - if current and previous then - local cr, pr = current.references, previous.references - same = cr and pr and cr.realpage == pr.realpage + local n = getn(tag,n) + local current = get(tag,n) + if not current then + return false + end + local cr = current.references + if not cr then + return false + end + local previous = get(tag,n-1) + if not previous then + return false + end + local pr = previous.references + if not pr then + return false end - return same and true or false + return cr.realpage == pr.realpage end notes.doifonsamepageasprevious = onsamepageasprevious @@ -471,7 +494,7 @@ local texsetglue = tex.setglue local function check_spacing(n,i) local gn, pn, mn = texgetglue(n) local gi, pi, mi = texgetglue(i > 1 and "s_strc_notes_inbetween" or "s_strc_notes_before") - local gt, pt, mt = gn+gi, pn+pi, mn+mi + local gt, pt, mt = gn + gi, pn + pi, mn + mi if trace_insert then report_insert("%s %i: %p plus %p minus %p","always ",n,gn,pn,mn) report_insert("%s %i: %p plus %p minus %p",i > 1 and "inbetween" or "before ",n,gi,pi,mi) -- cgit v1.2.3