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

sile-typesetter / sile / 7232859119

16 Dec 2023 03:49PM UTC coverage: 66.878% (-7.7%) from 74.62%
7232859119

push

github

web-flow
Merge 05d75c2a3 into 8686730e4

0 of 4 new or added lines in 1 file covered. (0.0%)

1201 existing lines in 56 files now uncovered.

10550 of 15775 relevant lines covered (66.88%)

3347.52 hits per line

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

0.0
/classes/bible.lua
UNCOV
1
local plain = require("classes.plain")
×
2

UNCOV
3
local class = pl.class(plain)
×
UNCOV
4
class._name = "bible"
×
5

UNCOV
6
if not SILE.scratch.headers then SILE.scratch.headers = {} end
×
7

UNCOV
8
class.defaultFrameset = {
×
UNCOV
9
  content = {
×
10
    left = "8.3%pw",
11
    right = "86%pw",
12
    top = "11.6%ph",
13
    bottom = "top(footnotes)"
×
14
  },
UNCOV
15
  folio = {
×
16
    left = "left(content)",
17
    right = "right(content)",
18
    top = "bottom(footnotes)+3%ph",
19
    bottom = "bottom(footnotes)+5%ph"
×
20
  },
UNCOV
21
  runningHead = {
×
22
    left = "left(content)",
23
    right = "right(content)",
24
    top = "top(content) - 8%ph",
25
    bottom = "top(content)-3%ph"
×
26
  },
UNCOV
27
  footnotes = {
×
28
    left = "left(content)",
29
    right = "right(content)",
30
    height = "0",
31
    bottom = "83.3%ph"
×
32
  }
33
}
34

UNCOV
35
function class:singleColumnMaster()
×
UNCOV
36
  self:defineMaster({
×
37
    id = "right",
38
    firstContentFrame = self.firstContentFrame,
UNCOV
39
    frames = self.defaultFrameset
×
40
  })
UNCOV
41
  self:loadPackage("twoside", {
×
42
    oddPageMaster = "right",
43
    evenPageMaster = "left"
×
44
  })
UNCOV
45
  self:loadPackage("footnotes", {
×
46
    insertInto = "footnotes",
UNCOV
47
    stealFrom = { "content" }
×
48
  })
49
end
50

UNCOV
51
function class:twoColumnMaster()
×
52
  self.firstContentFrame = "contentA"
×
53
  self:defineMaster({
×
54
      id = "right",
55
      firstContentFrame = "contentA",
56
      frames = {
×
57
        title = {
×
58
          left = "left(contentA)",
59
          right = "right(contentB)",
60
          top = "11.6%ph",
61
          height = "0",
62
          bottom = "top(contentA)"
×
63
        },
64
        contentA = {
×
65
          left = "8.3%pw",
66
          right = "left(gutter)",
67
          top = "bottom(title)",
68
          bottom = "top(footnotesA)",
69
          next = "contentB",
70
          balanced = true
×
71
        },
72
        contentB = {
×
73
          left = "right(gutter)",
74
          width ="width(contentA)",
75
          right = "86%pw",
76
          top = "bottom(title)",
77
          bottom = "top(footnotesB)",
78
          balanced = true
×
79
        },
80
        gutter = {
×
81
          left = "right(contentA)",
82
          right = "left(contentB)",
83
          width = self.options.gutter
×
84
        },
85
        folio = {
×
86
          left = "left(contentA)",
87
          right = "right(contentB)",
88
          top = "bottom(footnotesB)+3%ph",
89
          bottom = "bottom(footnotesB)+5%ph"
×
90
        },
91
        runningHead = {
×
92
          left = "left(contentA)",
93
          right = "right(contentB)",
94
          top = "top(contentA)-8%ph",
95
          bottom = "top(contentA)-3%ph"
×
96
        },
97
        footnotesA = {
×
98
          left =  "left(contentA)",
99
          right = "right(contentA)",
100
          height = "0",
101
          bottom = "83.3%ph"
×
102
        },
103
        footnotesB = {
×
104
          left = "left(contentB)",
105
          right = "right(contentB)",
106
          height = "0",
107
          bottom = "83.3%ph"
×
108
        },
109
      }
110
    })
111
  self:defineMaster({
×
112
      id = "left",
113
      firstContentFrame = "contentA",
114
      frames = {
×
115
        title = {
×
116
          left = "left(contentA)",
117
          right = "right(contentB)",
118
          top = "11.6%ph",
119
          height = "0",
120
          bottom = "top(contentA)"
×
121
        },
122
        contentA = {
×
123
          left = "14%pw",
124
          right = "left(gutter)",
125
          top = "bottom(title)",
126
          bottom = "top(footnotesA)",
127
          next = "contentB",
128
          balanced = true
×
129
        },
130
        contentB = {
×
131
          left = "right(gutter)",
132
          width = "width(contentA)",
133
          right = "91.7%pw",
134
          top = "bottom(title)",
135
          bottom = "top(footnotesB)",
136
          balanced = true
×
137
        },
138
        gutter = {
×
139
          left = "right(contentA)",
140
          right = "left(contentB)",
141
          width = self.options.gutter
×
142
        },
143
        folio = {
×
144
          left = "left(contentA)",
145
          right = "right(contentB)",
146
          top = "bottom(footnotesB)+3%ph",
147
          bottom = "bottom(footnotesB)+5%ph"
×
148
        },
149
        runningHead = {
×
150
          left = "left(contentA)",
151
          right = "right(contentB)",
152
          top = "top(contentA)-8%ph",
153
          bottom = "top(contentA)-3%ph"
×
154
        },
155
        footnotesA = {
×
156
          left = "left(contentA)",
157
          right = "right(contentA)",
158
          height = "0",
159
          bottom = "83.3%ph"
×
160
        },
161
        footnotesB = {
×
162
          left = "left(contentB)",
163
          right = "right(contentB)",
164
          height = "0",
165
          bottom = "83.3%ph"
×
166
        },
167
      }
168
    })
169
  -- Later we'll have an option for two fn frames
170
  self:loadPackage("footnotes", { insertInto = "footnotesB", stealFrom = { "contentB" } })
×
171
  -- self:loadPackage("balanced-frames")
172
end
173

174
local _twocolumns
175
local _gutterwidth
176

UNCOV
177
function class:_init(options)
×
UNCOV
178
  plain._init(self, options)
×
UNCOV
179
  self:loadPackage("masters")
×
UNCOV
180
  self:loadPackage("infonode")
×
UNCOV
181
  self:loadPackage("chapterverse")
×
UNCOV
182
  self:registerPostinit(function (self_)
×
UNCOV
183
    if self_.options.twocolumns then
×
184
      self_:twoColumnMaster()
×
185
      SILE.settings:set("linebreak.tolerance", 9000)
×
186
    else
UNCOV
187
      self_:singleColumnMaster()
×
188
    end
189
  end)
190
end
191

UNCOV
192
function class:endPage ()
×
UNCOV
193
  if (self:oddPage() and SILE.scratch.headers.right) then
×
UNCOV
194
    SILE.typesetNaturally(SILE.getFrame("runningHead"), function ()
×
UNCOV
195
      SILE.settings:set("current.parindent", SILE.nodefactory.glue())
×
UNCOV
196
      SILE.settings:set("document.lskip", SILE.nodefactory.glue())
×
UNCOV
197
      SILE.settings:set("document.rskip", SILE.nodefactory.glue())
×
198
      -- SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue())
UNCOV
199
      SILE.process(SILE.scratch.headers.right)
×
UNCOV
200
      SILE.call("par")
×
201
    end)
UNCOV
202
  elseif (not(self:oddPage()) and SILE.scratch.headers.left) then
×
UNCOV
203
      SILE.typesetNaturally(SILE.getFrame("runningHead"), function ()
×
UNCOV
204
        SILE.settings:set("current.parindent", SILE.nodefactory.glue())
×
UNCOV
205
        SILE.settings:set("document.lskip", SILE.nodefactory.glue())
×
UNCOV
206
        SILE.settings:set("document.rskip", SILE.nodefactory.glue())
×
207
          -- SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue())
UNCOV
208
        SILE.process(SILE.scratch.headers.left)
×
UNCOV
209
        SILE.call("par")
×
210
      end)
211
  end
UNCOV
212
  return plain.endPage(self)
×
213
end
214

UNCOV
215
function class:declareOptions ()
×
UNCOV
216
  plain.declareOptions(self)
×
UNCOV
217
  self:declareOption("twocolumns", function(_, value)
×
UNCOV
218
    if value then
×
219
      _twocolumns = value
×
220
    end
UNCOV
221
    return _twocolumns
×
222
  end)
UNCOV
223
  self:declareOption("gutter", function(_, value)
×
UNCOV
224
    if value then
×
UNCOV
225
      _gutterwidth = value
×
226
    end
UNCOV
227
    return _gutterwidth
×
228
  end)
229
end
230

UNCOV
231
function class:setOptions (options)
×
UNCOV
232
  options.twocolumns = options.twocolumns or false
×
UNCOV
233
  options.gutter = options.gutter or "3%pw"
×
UNCOV
234
  plain.setOptions(self, options)
×
235
end
236

UNCOV
237
function class:registerCommands ()
×
238

UNCOV
239
  plain.registerCommands(self)
×
240

UNCOV
241
  self:registerCommand("left-running-head", function (_, content)
×
UNCOV
242
    local closure = SILE.settings:wrap()
×
UNCOV
243
    SILE.scratch.headers.left = function () closure(content) end
×
UNCOV
244
  end, "Text to appear on the top of the left page")
×
245

UNCOV
246
  self:registerCommand("right-running-head", function (_, content)
×
UNCOV
247
    local closure = SILE.settings:wrap()
×
UNCOV
248
    SILE.scratch.headers.right = function () closure(content) end
×
UNCOV
249
  end, "Text to appear on the top of the right page")
×
250

UNCOV
251
  self:registerCommand("chapter", function (options, content)
×
252
    local ch = options.id:match("%d+")
×
253
    SILE.call("bible:chapter-head", options, {"Chapter " .. ch})
×
254
    SILE.call("save-chapter-number", options, {options.id})
×
255
    SILE.process(content)
×
256
  end)
257

UNCOV
258
  self:registerCommand("verse-number", function (options, content)
×
UNCOV
259
    SILE.call("indent")
×
UNCOV
260
    SILE.call("bible:verse-number", options, content)
×
UNCOV
261
    SILE.call("save-verse-number", options, content)
×
UNCOV
262
    SILE.call("left-running-head", {}, function ()
×
UNCOV
263
      SILE.settings:temporarily(function ()
×
UNCOV
264
        SILE.settings:set("document.lskip", SILE.nodefactory.glue())
×
UNCOV
265
        SILE.settings:set("document.rskip", SILE.nodefactory.glue())
×
266
        -- SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue())
UNCOV
267
        SILE.call("font", { size = "10pt", family = "Gentium" }, function ()
×
UNCOV
268
          SILE.call("first-reference")
×
UNCOV
269
          SILE.call("hfill")
×
UNCOV
270
          SILE.call("font", { style = "italic" }, SILE.scratch.theChapter)
×
271
        end)
UNCOV
272
        SILE.typesetter:leaveHmode()
×
273
      end)
274
    end)
UNCOV
275
    SILE.call("right-running-head", {}, function ()
×
UNCOV
276
      SILE.settings:temporarily(function ()
×
UNCOV
277
        SILE.settings:set("document.lskip", SILE.nodefactory.glue())
×
UNCOV
278
        SILE.settings:set("document.rskip", SILE.nodefactory.glue())
×
UNCOV
279
        SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue())
×
UNCOV
280
        SILE.call("font", { size = "10pt", family = "Gentium" }, function ()
×
281
          -- SILE.call("font", { style = "italic" }, SILE.scratch.theChapter)
UNCOV
282
          SILE.call("hfill")
×
UNCOV
283
          SILE.call("last-reference")
×
284
        end)
UNCOV
285
        SILE.typesetter:leaveHmode()
×
286
      end)
287
    end)
288
  end)
289

290
end
291

UNCOV
292
return class
×
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