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

sile-typesetter / sile / 11873116275

16 Nov 2024 08:44PM UTC coverage: 56.187% (+25.2%) from 30.99%
11873116275

push

github

alerque
chore(packages): Cleanup default styles of Pandoc content

0 of 3 new or added lines in 1 file covered. (0.0%)

160 existing lines in 8 files now uncovered.

10258 of 18257 relevant lines covered (56.19%)

1293.78 hits per line

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

0.0
/packages/verbatim/init.lua
UNCOV
1
local base = require("packages.base")
×
2

UNCOV
3
local package = pl.class(base)
×
UNCOV
4
package._name = "verbatim"
×
5

UNCOV
6
function package:registerCommands ()
×
UNCOV
7
   self:registerCommand("verbatim:font", function (options, content)
×
UNCOV
8
      options.family = options.family or "Hack"
×
UNCOV
9
      options.size = options.size or SILE.settings:get("font.size") - 3
×
UNCOV
10
      SILE.call("font", options, content)
×
UNCOV
11
   end, "The font chosen for the verbatim environment")
×
12

UNCOV
13
   self:registerCommand("verbatim", function (_, content)
×
UNCOV
14
      SILE.typesetter:pushVglue(6)
×
UNCOV
15
      SILE.typesetter:leaveHmode()
×
UNCOV
16
      local lskip = SILE.settings:get("document.lskip") or SILE.types.node.glue()
×
UNCOV
17
      local rskip = SILE.settings:get("document.rskip") or SILE.types.node.glue()
×
UNCOV
18
      SILE.settings:temporarily(function ()
×
UNCOV
19
         SILE.call("verbatim:font")
×
UNCOV
20
         SILE.call("language", { main = "und" })
×
UNCOV
21
         SILE.settings:set("typesetter.parseppattern", "\n")
×
UNCOV
22
         SILE.settings:set("typesetter.obeyspaces", true)
×
UNCOV
23
         SILE.settings:set("document.lskip", SILE.types.node.glue(lskip.width.length))
×
UNCOV
24
         SILE.settings:set("document.rskip", SILE.types.node.glue(rskip.width.length))
×
UNCOV
25
         SILE.settings:set("document.parindent", SILE.types.node.glue())
×
UNCOV
26
         SILE.settings:set("document.parskip", SILE.types.node.vglue())
×
UNCOV
27
         SILE.settings:set("document.spaceskip", SILE.types.length("1spc"))
×
UNCOV
28
         SILE.settings:set("shaper.variablespaces", false)
×
UNCOV
29
         SILE.process(content)
×
UNCOV
30
         SILE.typesetter:leaveHmode()
×
31
      end)
UNCOV
32
   end, "Typesets its contents in a monospaced font.")
×
33

UNCOV
34
   self:registerCommand("obeylines", function (_, content)
×
35
      SILE.settings:temporarily(function ()
×
36
         SILE.settings:set("typesetter.parseppattern", "\n")
×
37
         SILE.process(content)
×
38
      end)
39
   end)
40
end
41

42
package.documentation = [[
43
\begin{document}
44
The \autodoc:package{verbatim} package is useful when quoting pieces of computer code and other text for which formatting is significant.
45
It changes SILE’s settings so that text is set ragged right, with no hyphenation, no indentation and regular spacing.
46
It tells SILE to honor multiple spaces, and sets a monospaced font.
47

48
\autodoc:note{Despite the name, \autodoc:environment{verbatim} does not alter the way that SILE sees special characters.
49
You still need to escape backslashes and braces: to produce a backslash, you need to write \code{\\\\}.}
50

51
Here is some text set in the \autodoc:environment{verbatim} environment:
52

53
\begin[type=autodoc:codeblock]{raw}
54
local function init (class, _)
55
  class:loadPackage("rebox")
56
  class:loadPackage("raiselower")
57
end
58
\end{raw}
59

60
If you want to specify what font the verbatim environment should use, you can redefine the \autodoc:command{\verbatim:font} command.
61
For example you could change it from XML like this:
62

63
\begin[type=autodoc:codeblock]{raw}
64
<define command="verbatim:font">
65
   <font family="DejaVu Sans Mono" size="9pt"/>
66
</define>
67
\end{raw}
68
\end{document}
UNCOV
69
]]
×
70

UNCOV
71
return package
×
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