strc-flt.lmt /size: 1678 b    last modification: 2024-01-16 10:22
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
17local texgetoutputactive = tex.getoutputactive
18
19local trace              = trackers.register("structure.sidefloats.pageflush")
20local report             = logs.reporter("structure","floats")
21
22local forcepageflush     = builders.vspacing.forcepageflush
23
24local d_page_sides_vsize = tex.isdimen("d_page_sides_vsize")
25
26function builders.checksidefloat(mode,indented)
27    if not texgetoutputactive() then
28        local s = texgetdimen(d_page_sides_vsize)
29        if s > 0 then
30            if trace then
31                report("force flushing page state, height %p",s)
32            end
33            forcepageflush()
34        end
35    else
36        -- we don't have side floats outside the main vertical list
37    end
38    return indented
39end
40
41-- These two lines might move to task-ini.lmt where we currently only deal
42-- with node handlers:
43
44appendaction ("paragraph","system","builders.checksidefloat")
45disableaction("paragraph","builders.checksidefloat")
46
47interfaces.implement {
48    name     = "enablesidefloatchecker",
49    onlyonce = true,
50    actions  = function()
51        enableaction("paragraph","builders.checksidefloat")
52    end,
53}
54