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

sile-typesetter / sile / 9304060604

30 May 2024 02:07PM UTC coverage: 74.124% (-0.6%) from 74.707%
9304060604

push

github

alerque
style: Reformat Lua with stylua

8104 of 11995 new or added lines in 184 files covered. (67.56%)

15 existing lines in 11 files now uncovered.

12444 of 16788 relevant lines covered (74.12%)

7175.1 hits per line

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

95.35
/typesetters/grid.lua
1
local base = require("typesetters.base")
2✔
2

3
local typesetter = pl.class(base)
2✔
4
typesetter._name = "grid"
2✔
5

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

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

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

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

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

59
return typesetter
2✔
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