• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sile-typesetter / sile / 9304049654

30 May 2024 02:12PM UTC coverage: 60.021% (-14.7%) from 74.707%
9304049654

push

github

web-flow
Merge 1a26b4f22 into a1fd105f8

6743 of 12900 new or added lines in 186 files covered. (52.27%)

347 existing lines in 49 files now uncovered.

10311 of 17179 relevant lines covered (60.02%)

3307.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/typesetters/grid.lua
UNCOV
1
local base = require("typesetters.base")
×
2

UNCOV
3
local typesetter = pl.class(base)
×
UNCOV
4
typesetter._name = "grid"
×
5

6
local function makeUp (spacing, totals)
NEW
7
   local toadd = (spacing - SILE.types.measurement(totals.gridCursor)) % spacing
×
NEW
8
   totals.gridCursor = totals.gridCursor + toadd
×
NEW
9
   SU.debug("typesetter", "Makeup height =", toadd)
×
NEW
10
   return SILE.types.node.vglue({ discardable = false, gridleading = true, height = toadd })
×
11
end
12

NEW
13
function typesetter:_init (frame)
×
NEW
14
   base._init(self, frame)
×
NEW
15
   self.options = { spacing = SILE.types.measurement("1bs") }
×
16
end
17

UNCOV
18
function typesetter:leadingFor (vbox, previous)
×
NEW
19
   SU.debug("typesetter", "   Considering leading between two lines (grid mode):")
×
NEW
20
   SU.debug("typesetter", "   1)", previous)
×
NEW
21
   SU.debug("typesetter", "   2)", vbox)
×
NEW
22
   if not previous then
×
NEW
23
      return SILE.types.node.vglue()
×
24
   end
NEW
25
   SU.debug("typesetter", "   Depth of previous line was", previous.depth)
×
NEW
26
   local totals = self.frame.state.totals
×
NEW
27
   local oldCursor = SILE.types.measurement(totals.gridCursor)
×
NEW
28
   totals.gridCursor = oldCursor + vbox.height:absolute() + previous.depth
×
NEW
29
   SU.debug("typesetter", "   Cursor change =", totals.gridCursor - oldCursor)
×
NEW
30
   return makeUp(self.options.spacing, self.frame.state.totals)
×
31
end
32

UNCOV
33
function typesetter:pushVglue (spec)
×
34
   -- if SU.type(spec) ~= "table" then SU.warn("Please use pushVertical() to pass a premade node instead of a spec") end
NEW
35
   local node = SU.type(spec) == "vglue" and spec or SILE.types.node.vglue(spec)
×
NEW
36
   node.height.stretch = SILE.types.measurement()
×
NEW
37
   node.height.shrink = SILE.types.measurement()
×
NEW
38
   local totals = self.frame.state.totals
×
NEW
39
   totals.gridCursor = totals.gridCursor + SILE.types.measurement(node.height):absolute()
×
NEW
40
   self:pushVertical(node)
×
NEW
41
   self:pushVertical(makeUp(self.options.spacing, self.frame.state.totals))
×
NEW
42
   return node
×
43
end
44

UNCOV
45
function typesetter:pushExplicitVglue (spec)
×
46
   -- if SU.type(spec) ~= "table" then SU.warn("Please use pushVertical() to pass a premade node instead of a spec") end
NEW
47
   local node = SU.type(spec) == "vglue" and spec or SILE.types.node.vglue(spec)
×
NEW
48
   node.explicit = true
×
NEW
49
   node.discardable = false
×
NEW
50
   node.height.stretch = SILE.types.measurement()
×
NEW
51
   node.height.shrink = SILE.types.measurement()
×
NEW
52
   local totals = self.frame.state.totals
×
NEW
53
   totals.gridCursor = totals.gridCursor + SILE.types.measurement(node.height):absolute()
×
NEW
54
   self:pushVertical(node)
×
NEW
55
   self:pushVertical(makeUp(self.options.spacing, self.frame.state.totals))
×
NEW
56
   return node
×
57
end
58

UNCOV
59
return typesetter
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc