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

sile-typesetter / sile / 14684598788

26 Apr 2025 07:55PM UTC coverage: 29.023% (-36.3%) from 65.328%
14684598788

push

github

alerque
test(fonts): Update test to work on new ICU instead of old

5840 of 20122 relevant lines covered (29.02%)

379.34 hits per line

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

64.58
/core/misc.lua
1
-- TODO: this probably needs deprecating, moved here just to get out of the way so
2
-- typesetters classing works as expected
3
local function typesetNaturally (frame, func)
4
   local saveTypesetter = SILE.typesetter
14✔
5
   if SILE.typesetter.frame then
14✔
6
      SILE.typesetter.frame:leave(SILE.typesetter)
14✔
7
   end
8
   SILE.typesetter = SILE.typesetters.default(frame)
28✔
9
   SILE.settings:temporarily(func)
14✔
10
   SILE.typesetter:leaveHmode()
14✔
11
   SILE.typesetter:chuck()
14✔
12
   SILE.typesetter.frame:leave(SILE.typesetter)
14✔
13
   SILE.typesetter = saveTypesetter
14✔
14
   if SILE.typesetter.frame then
14✔
15
      SILE.typesetter.frame:enter(SILE.typesetter)
14✔
16
   end
17
end
18

19
local function call (command, options, content)
20
   options = options or {}
231✔
21
   content = content or {}
231✔
22
   if SILE.traceback and type(content) == "table" and not content.lno then
231✔
23
      -- This call is from code (no content.lno) and we want to spend the time
24
      -- to determine everything we need about the caller
25
      local caller = debug.getinfo(2, "Sl")
×
26
      content.file, content.lno = caller.short_src, caller.currentline
×
27
   end
28
   local pId = SILE.traceStack:pushCommand(command, content, options)
231✔
29
   if not SILE.Commands[command] then
231✔
30
      SU.error("Unknown command " .. command)
×
31
   end
32
   local result = SILE.Commands[command](options, content)
231✔
33
   SILE.traceStack:pop(pId)
231✔
34
   return result
231✔
35
end
36

37
local function registerCommand (name, func, help, pack, cheat)
38
   local class = SILE.documentState.documentClass
79✔
39
   if not cheat then
79✔
40
      SU.deprecated(
×
41
         "SILE.registerCommand",
42
         "class:registerCommand / package:registerCommand",
43
         "0.14.0",
44
         "0.16.0",
45
         [[
×
46
            Commands are being scoped to the document classes or packages they are
47
            loaded into rather than using a global registry.
48
         ]]
×
49
      )
50
   end
51
   -- Shimming until we have all scope cheating removed from core
52
   if not cheat or not class or class.type ~= "class" then
79✔
53
      return SILE.classes.base.registerCommand(nil, name, func, help, pack)
92✔
54
   end
55
   return class:registerCommand(name, func, help, pack)
×
56
end
57

58
local function setCommandDefaults (command, options)
59
   local oldCommand = SILE.Commands[command]
×
60
   SILE.Commands[command] = function (defaults, content)
×
61
      for k, v in pairs(options) do
×
62
         defaults[k] = defaults[k] or v
×
63
      end
64
      return oldCommand(defaults, content)
×
65
   end
66
end
67

68
-- TODO: Move to new table entry handler in types.unit
69
local function registerUnit (unit, spec)
70
   -- If a unit exists already, clear it first so we get fresh meta table entries, see #1607
71
   if SILE.types.unit[unit] then
×
72
      SILE.types.unit[unit] = nil
×
73
   end
74
   SILE.types.unit[unit] = spec
×
75
end
76

77
local function paperSizeParser (size)
78
   SU.deprecated("SILE.paperSizeParser", "SILE.papersize", "0.15.0", "0.16.0")
×
79
   return SILE.papersize(size)
×
80
end
81

82
return {
13✔
83
   typesetNaturally = typesetNaturally,
13✔
84
   call = call,
13✔
85
   registerCommand = registerCommand,
13✔
86
   setCommandDefaults = setCommandDefaults,
13✔
87
   registerUnit = registerUnit,
13✔
88
   paperSizeParser = paperSizeParser,
13✔
89
}
13✔
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