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

sile-typesetter / sile / 11770252752

11 Nov 2024 01:09AM UTC coverage: 32.853% (-27.5%) from 60.402%
11770252752

Pull #2164

github

web-flow
chore(deps): Bump DeterminateSystems/nix-installer-action from 14 to 15

Bumps [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action) from 14 to 15.
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](https://github.com/determinatesystems/nix-installer-action/compare/v14...v15)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #2164: chore(deps): Bump DeterminateSystems/nix-installer-action from 14 to 15

5855 of 17822 relevant lines covered (32.85%)

2493.73 hits per line

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

75.76
/packages/base.lua
1
--- SILE package class.
2
-- @interfaces packages
3

4
local package = pl.class()
4✔
5
package.type = "package"
4✔
6
package._name = "base"
4✔
7

8
package._initialized = false
4✔
9
package.class = nil
4✔
10

11
-- For shimming packages that used to have legacy exports
12
package.exports = {}
4✔
13

14
local function script_path ()
15
   local src = debug.getinfo(3, "S").source:sub(2)
43✔
16
   local base = src:match("(.*[/\\])")
43✔
17
   return base
43✔
18
end
19

20
local settingDeclarations = {}
4✔
21
local rawhandlerRegistrations = {}
4✔
22
local commandRegistrations = {}
4✔
23

24
function package:_init (_, reload)
4✔
25
   self.class = SILE.scratch.half_initialized_class or SILE.documentState.documentClass
43✔
26
   if not self.class then
43✔
27
      SU.error("Attempted to initialize package before class, should have been queued in the preamble", true)
×
28
   end
29
   self.basedir = script_path()
86✔
30
   -- Note string.format(%p) would be nicer than tostring() but only LuaJIT and Lua 5.4 support it
31
   local settingsDeclarator = tostring(self.declareSettings)
43✔
32
   if reload or not settingDeclarations[settingsDeclarator] then
43✔
33
      settingDeclarations[settingsDeclarator] = true
9✔
34
      self:declareSettings()
9✔
35
   end
36
   local rawhandlerRegistrator = tostring(self.registerRawHandlers)
43✔
37
   if reload or not rawhandlerRegistrations[rawhandlerRegistrator] then
43✔
38
      rawhandlerRegistrations[rawhandlerRegistrator] = true
7✔
39
      self:registerRawHandlers()
7✔
40
   end
41
   local commandRegistrator = tostring(self.registerCommands)
43✔
42
   if reload or not commandRegistrations[commandRegistrator] then
43✔
43
      commandRegistrations[commandRegistrator] = true
39✔
44
      self:registerCommands()
39✔
45
   end
46
end
47

48
function package:_post_init ()
4✔
49
   self._initialized = true
43✔
50
end
51

52
function package.declareSettings (_) end
10✔
53

54
function package.registerRawHandlers (_) end
10✔
55

56
function package:loadPackage (packname, options, reload)
4✔
57
   return self.class:loadPackage(packname, options, reload)
20✔
58
end
59

60
function package:reloadPackage (packname, options)
4✔
61
   return self.class:reloadPackage(packname, options)
×
62
end
63

64
function package.registerCommands (_) end
7✔
65

66
-- This gives us a hook to match commands with the packages that registered
67
-- them as opposed to core commands or class-provided commands
68

69
--- Register a function as a SILE command.
70
-- Takes any Lua function and registers it for use as a SILE command (which will in turn be used to process any content
71
-- nodes identified with the command name.
72
--
73
-- A similar method is available for classes, `classes:registerCommand`.
74
-- @tparam string name Name of cammand to register.
75
-- @tparam function func Callback function to use as command handler.
76
-- @tparam[opt] nil|string help User friendly short usage string for use in error messages, documentation, etc.
77
-- @tparam[opt] nil|string pack Information identifying the module registering the command for use in error and usage
78
-- messages. Usually auto-detected.
79
-- @see SILE.classes:registerCommand
80
function package:registerCommand (name, func, help, pack)
4✔
81
   self.class:registerCommand(name, func, help, pack)
170✔
82
end
83
function package:registerRawHandler (format, callback)
4✔
84
   self.class:registerRawHandler(format, callback)
1✔
85
end
86

87
-- Using this rather than doing the work directly will give us a way to
88
-- un-export them if we ever need to unload modules and revert functions
89
function package:export (name, func)
4✔
90
   self.class[name] = func
42✔
91
end
92

93
-- Shims for two possible kinds of legacy exports: blind direct stuffing into
94
-- the class but not expecting to be called as a method AND the exports table
95
-- to package modules...
96

97
local _deprecate_class_funcs = [[
98
   Please explicitly use functions provided by packages by referencing them in
99
   the document class's list of loaded packages rather than the legacy solution
100
   that added non-method functions to the class.
101
]]
4✔
102

103
local _deprecate_exports_table = [[
104
   Please explicitly use functions provided by packages by referencing them in
105
   the document class's list of loaded packages rather than the legacy solution
106
   of calling them from an exports table.
107
]]
4✔
108

109
function package:deprecatedExport (name, func, noclass, notable)
4✔
110
   if not noclass then
36✔
111
      self.class[name] = function (...)
36✔
112
         -- http://lua-users.org/wiki/VarargTheSecondClassCitizen
113
         local inputs = { ... }
×
114
         -- local inputs = table.unpack({...}, 1, select("#", ...))
115
         if type(inputs[1]) ~= "table" or inputs[1].type ~= "class" then
×
116
            table.insert(inputs, 1, self.class)
×
117
         end
118
         SU.deprecated(
×
119
            ("class.%s"):format(name),
×
120
            ("class.packages.%s:%s"):format(self._name, name),
×
121
            "0.14.0",
122
            "0.16.0",
123
            _deprecate_class_funcs
124
         )
125
         return func(pl.utils.unpack(inputs, 1, select("#", ...) + 1))
×
126
      end
127
   end
128

129
   if not notable then
36✔
130
      self.exports[name] = function (...)
36✔
131
         local inputs = { ... }
×
132
         if type(inputs[1]) ~= "table" or inputs[1].type ~= "package" then
×
133
            table.insert(inputs, 1, self)
×
134
         end
135
         SU.deprecated(
×
136
            ("require('packages.%s').exports.%s"):format(self._name, name),
×
137
            ("class.packages.%s:%s"):format(self._name, name),
×
138
            "0.14.0",
139
            "0.16.0",
140
            _deprecate_exports_table
141
         )
142
         return func(pl.utils.unpack(inputs, 1, select("#", ...) + 1))
×
143
      end
144
   end
145
end
146

147
return package
4✔
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