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

sile-typesetter / sile / 14334874064

08 Apr 2025 01:31PM UTC coverage: 59.535% (-3.5%) from 63.083%
14334874064

push

github

web-flow
Merge pull request #2259 from Omikhleia/fix-hyphen-minima

Fix hyphen minima logic and update several hyphenation patterns

21 of 34 new or added lines in 14 files covered. (61.76%)

941 existing lines in 51 files now uncovered.

12856 of 21594 relevant lines covered (59.54%)

2362.76 hits per line

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

73.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
48✔
5
   if SILE.typesetter.frame then
48✔
6
      SILE.typesetter.frame:leave(SILE.typesetter)
48✔
7
   end
8
   SILE.typesetter = SILE.typesetters.default(frame)
96✔
9
   SILE.settings:temporarily(func)
48✔
10
   SILE.typesetter:leaveHmode()
48✔
11
   SILE.typesetter:chuck()
48✔
12
   SILE.typesetter.frame:leave(SILE.typesetter)
48✔
13
   SILE.typesetter = saveTypesetter
48✔
14
   if SILE.typesetter.frame then
48✔
15
      SILE.typesetter.frame:enter(SILE.typesetter)
48✔
16
   end
17
end
18

19
local function call (command, options, content)
20
   options = options or {}
2,033✔
21
   content = content or {}
2,033✔
22
   if SILE.traceback and type(content) == "table" and not content.lno then
2,033✔
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)
2,033✔
29
   if not SILE.Commands[command] then
2,033✔
30
      SU.error("Unknown command " .. command)
×
31
   end
32
   local result = SILE.Commands[command](options, content)
2,033✔
33
   SILE.traceStack:pop(pId)
2,033✔
34
   return result
2,033✔
35
end
36

37
local function registerCommand (name, func, help, pack, cheat)
38
   local class = SILE.documentState.documentClass
789✔
39
   if not cheat then
789✔
40
      SU.deprecated(
2✔
41
         "SILE.registerCommand",
1✔
42
         "class:registerCommand / package:registerCommand",
1✔
43
         "0.14.0",
1✔
44
         "0.16.0",
1✔
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
      )
1✔
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
789✔
53
      return SILE.classes.base.registerCommand(nil, name, func, help, pack)
920✔
54
   end
UNCOV
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
17✔
72
      SILE.types.unit[unit] = nil
×
73
   end
74
   SILE.types.unit[unit] = spec
17✔
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 {
131✔
83
   typesetNaturally = typesetNaturally,
131✔
84
   call = call,
131✔
85
   registerCommand = registerCommand,
131✔
86
   setCommandDefaults = setCommandDefaults,
131✔
87
   registerUnit = registerUnit,
131✔
88
   paperSizeParser = paperSizeParser,
131✔
89
}
131✔
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