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

sile-typesetter / sile / 6915845768

18 Nov 2023 07:23PM UTC coverage: 63.161% (-5.6%) from 68.751%
6915845768

push

github

web-flow
Merge 0f5c09a66 into f64e235fa

9802 of 15519 relevant lines covered (63.16%)

2045.54 hits per line

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

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

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

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

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

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

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

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

57

58
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