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

sile-typesetter / sile / 14908152066

08 May 2025 01:49PM UTC coverage: 61.309% (-5.7%) from 67.057%
14908152066

push

github

alerque
chore(registries): Touchup command registry deprecation shims

1 of 2 new or added lines in 2 files covered. (50.0%)

1379 existing lines in 46 files now uncovered.

13556 of 22111 relevant lines covered (61.31%)

11834.23 hits per line

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

39.13
/packages/inputfilter/init.lua
1
local base = require("packages.base")
1✔
2

3
local package = pl.class(base)
1✔
4
package._name = "inputfilter"
1✔
5

6
function package:transformContent (content, transformFunction, extraArgs)
1✔
UNCOV
7
   local newContent = {}
×
UNCOV
8
   for k, v in SU.sortedpairs(content) do
×
UNCOV
9
      if type(k) == "number" then
×
UNCOV
10
         if type(v) == "string" then
×
UNCOV
11
            local transformed = transformFunction(v, content, extraArgs)
×
UNCOV
12
            if type(transformed) == "table" then
×
UNCOV
13
               for i = 1, #transformed do
×
UNCOV
14
                  newContent[#newContent + 1] = transformed[i]
×
15
               end
16
            else
17
               newContent[#newContent + 1] = transformed
×
18
            end
19
         else
20
            newContent[#newContent + 1] = self:transformContent(v, transformFunction, extraArgs)
×
21
         end
22
      else
UNCOV
23
         newContent[k] = v
×
24
      end
25
   end
UNCOV
26
   return newContent
×
27
end
28

29
function package:createCommand (pos, col, lno, command, options, content)
1✔
UNCOV
30
   local position = { lno = lno, col = col, pos = pos }
×
UNCOV
31
   return SU.ast.createCommand(command, options, content, position)
×
32
end
33

34
function package:_init ()
1✔
35
   base._init(self)
1✔
36
end
37

38
package.documentation = [[
39
\begin{document}
40
The \autodoc:package{inputfilter} package provides ways for class authors to transform the input of a SILE document after it is parsed but before it is processed.
41
It does this by allowing you to rewrite the abstract syntax tree representing the document.
42

43
Loading \autodoc:package{inputfilter} into your class with \code{class:loadPackage("inputfilter")} provides you with two new Lua functions: \code{transformContent} and \code{createCommand}.
44
\code{transformContent} takes a content tree and applies a transformation function to the text within it.
45
See \href{https://sile-typesetter.org/examples/inputfilter.sil} for a simple example, and \href{https://sile-typesetter.org/examples/chordmode.sil} for a more complete one.
46
\end{document}
47
]]
1✔
48

49
return package
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

© 2025 Coveralls, Inc