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

sile-typesetter / sile / 6713098919

31 Oct 2023 10:21PM UTC coverage: 52.831% (-21.8%) from 74.636%
6713098919

push

github

web-flow
Merge d0a2a1ee9 into b185d4972

45 of 45 new or added lines in 3 files covered. (100.0%)

8173 of 15470 relevant lines covered (52.83%)

6562.28 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

© 2025 Coveralls, Inc