strc-flt.lua /size: 1298 b    last modification: 2021-10-28 13:50
1if not modules then modules = { } end modules ['strc-flt'] = {
2    version   = 1.001,
3    comment   = "companion to strc-flt.mkiv",
4    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5    copyright = "PRAGMA ADE / ConTeXt Development Team",
6    license   = "see context related readme files"
7}
8
9-- nothing
10
11local sequencers      = utilities.sequencers
12local appendaction    = sequencers.appendaction
13local enableaction    = sequencers.enableaction
14local disableaction   = sequencers.disableaction
15
16local texgetdimen     = tex.getdimen
17
18local trace           = trackers.register("structure.sidefloats.pageflush")
19local report          = logs.reporter("structure","floats")
20
21local forcepageflush  = builders.vspacing.forcepageflush
22
23function builders.checksidefloat(mode,indented)
24    local s = texgetdimen("d_page_sides_vsize")
25    if s > 0 then
26        if trace then
27            report("force flushing page state, height %p",s)
28        end
29        forcepageflush()
30    end
31    return indented
32end
33
34appendaction ("paragraph","system","builders.checksidefloat")
35disableaction("paragraph","builders.checksidefloat")
36
37interfaces.implement {
38    name     = "enablesidefloatchecker",
39    onlyonce = true,
40    actions  = function()
41        enableaction("paragraph","builders.checksidefloat")
42    end,
43}
44