diff options
author | Karl Berry <karl@freefriends.org> | 2017-04-19 23:04:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-04-19 23:04:15 +0000 |
commit | f74161ca4e7eb3c5af9afcbe92522ae3b58987c1 (patch) | |
tree | 3c30a13df5ac7968195c85070a2b074578e669d2 /Master/texmf-dist/tex/context/base/mkiv/strc-not.lua | |
parent | 1d5a55ac8f5506a7ae9cfca52f4b588182e199d4 (diff) |
context beta/cont-tmf.zip (Apr 16 12:55)
git-svn-id: svn://tug.org/texlive/trunk@43931 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/strc-not.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/strc-not.lua | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/strc-not.lua b/Master/texmf-dist/tex/context/base/mkiv/strc-not.lua index ddbd2ae06eb..eff357eead0 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/strc-not.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/strc-not.lua @@ -26,8 +26,11 @@ local counterspecials = counters.specials local texgetcount = tex.getcount local texgetbox = tex.getbox +-- todo: allocate + notes.states = notes.states or { } lists.enhancers = lists.enhancers or { } +notes.numbers = notes.numbers or { } storage.register("structures/notes/states", notes.states, "structures.notes.states") @@ -143,6 +146,8 @@ end notes.setstate = setstate notes.getstate = getstate + + implement { name = "setnotestate", actions = setstate, @@ -157,6 +162,7 @@ implement { function notes.define(tag,kind,number) local state = setstate(tag,kind) + notes.numbers[number] = state state.number = number end @@ -448,3 +454,42 @@ function notes.internalid(tag,n) return r.internal end end + +-- for the moment here but better in some builder modules + +-- gets register "n" and location "i" (where 1 is before) + +-- this is an experiment, we will make a more general handler instead +-- of the current note one + +local report_insert = logs.reporter("pagebuilder","insert") +local trace_insert = false trackers.register("pagebuilder.insert",function(v) trace_insert = v end) + +local texgetglue = tex.getglue +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 + 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) + report_insert("%s %i: %p plus %p minus %p","effective",n,gt,pt,mt) + end + return gt, pt, mt +end + +notes.check_spacing = check_spacing + +callback.register("build_page_insert", function(n,i) + local state = notes.numbers[n] + if state then + -- only notes, kind of hardcoded .. bah + local gt, pt, mt = check_spacing(n,i) + texsetglue(0,gt,pt,mt) -- for the moment we use skip register 0 + return 0 + else + return n + end +end) |