diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-09 20:40:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-09 20:40:29 +0000 |
commit | a81bd3ba3336ba74c9fc657ec765256675c21af0 (patch) | |
tree | 23fe47161d31824edd29f35772dfde68442b4f31 /Master/texmf-dist/tex/luatex/minim/minim-hooks.lua | |
parent | bddd14bf18d40232025826b31f20264323ef6af2 (diff) |
minim (9jun21)
git-svn-id: svn://tug.org/texlive/trunk@59536 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/minim/minim-hooks.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/minim/minim-hooks.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/luatex/minim/minim-hooks.lua b/Master/texmf-dist/tex/luatex/minim/minim-hooks.lua new file mode 100644 index 00000000000..c399547c9e7 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/minim/minim-hooks.lua @@ -0,0 +1,30 @@ + +-- Adds a callback just before a box is shipped out, opposite to +-- 'finish_pdfpage'. + +local alloc = require('minim-alloc') +local cb = require ('minim-callbacks') +alloc.remember('minim-hooks') + +local M = { } + +cb.new_callback('pre_shipout', 'simple') + +M.primitive_shipout = tex.shipout +function tex.shipout(nr) + cb.call_callback('pre_shipout', nr) + M.primitive_shipout(nr) +end + +local shipout_box = alloc.new_box('minim:shipout:box') + +alloc.luadef('minim:shipout', function() + tex.box[shipout_box] = token.scan_list() + cb.call_callback('pre_shipout', shipout_box) + -- we must let tex do the rest, because some other package may have + -- redefined \shipout before us. + tex.sprint(token.create('minim:shipout:do')) +end, 'protected') + +return M + |