• 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

89.36
/classes/letter.lua
1
--- letter document class.
2
-- @use classes.letter
3

4
local plain = require("classes.plain")
1✔
5

6
local class = pl.class(plain)
1✔
7
class._name = "letter"
1✔
8

9
class.defaultFrameset = {
1✔
10
   content = {
1✔
11
      left = "5%pw",
12
      right = "95%pw",
13
      top = "2in",
14
      bottom = "90%ph",
15
   },
1✔
16
}
1✔
17

18
function class:_init (options)
1✔
19
   plain._init(self, options)
1✔
20
   SILE.scratch.letter = {
1✔
21
      sender = nil,
22
      date = nil,
23
      recipient = "",
24
      salutation = "",
25
   }
1✔
26
end
27

28
function class:registerCommands ()
1✔
29
   plain.registerCommands(self)
1✔
30

31
   self:registerCommand("letter", function (_, content)
2✔
32
      SILE.settings:set("current.parindent", SILE.types.node.glue())
2✔
33
      SILE.settings:set("document.parindent", SILE.types.node.glue())
2✔
34
      SILE.call("raggedright", {}, function ()
2✔
35
         SILE.call("letter:format:date")
1✔
36
         SILE.call("bigskip")
1✔
37
         if SILE.scratch.letter.sender then
1✔
NEW
38
            SILE.call("letter:format:sender")
×
NEW
39
            SILE.call("bigskip")
×
40
         end
41
         SILE.call("letter:format:recipient")
1✔
42
         SILE.call("bigskip")
1✔
43
         SILE.call("letter:format:salutation")
1✔
44
         SILE.call("bigskip")
1✔
45
         SILE.process(content)
1✔
46
      end)
47
   end)
48

49
   self:registerCommand("sender", function (_, content)
2✔
NEW
50
      SILE.scratch.letter.sender = content
×
51
   end)
52
   self:registerCommand("recipient", function (_, content)
2✔
53
      SILE.scratch.letter.recipient = content
1✔
54
   end)
55
   self:registerCommand("salutation", function (_, content)
2✔
56
      SILE.scratch.letter.salutation = content
1✔
57
   end)
58
   self:registerCommand("date", function (_, content)
2✔
NEW
59
      SILE.scratch.letter.date = content
×
60
   end)
61

62
   self:registerCommand("letter:format:date", function ()
2✔
63
      if not SILE.scratch.letter.date then
1✔
64
         SILE.scratch.letter.date = { os.date("%A, %d %B") }
1✔
65
      end
66
      SILE.process(SILE.scratch.letter.date)
1✔
67
      SILE.call("par")
1✔
68
   end)
69

70
   self:registerCommand("letter:format:sender", function ()
2✔
NEW
71
      SILE.process(SILE.scratch.letter.sender)
×
72
   end)
73

74
   self:registerCommand("letter:format:recipient", function ()
2✔
75
      SILE.process(SILE.scratch.letter.recipient)
1✔
76
   end)
77

78
   self:registerCommand("letter:format:salutation", function ()
2✔
79
      SILE.process(SILE.scratch.letter.salutation)
1✔
80
   end)
81
end
82

83
return class
1✔
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