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

sile-typesetter / sile / 9428435077

08 Jun 2024 11:35AM UTC coverage: 64.56% (-9.9%) from 74.46%
9428435077

push

github

web-flow
Merge pull request #2047 from alerque/end-pars

23 of 46 new or added lines in 5 files covered. (50.0%)

1684 existing lines in 60 files now uncovered.

11145 of 17263 relevant lines covered (64.56%)

4562.45 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)
×
8
      options.family = options.family or "Hack"
×
9
      options.size = options.size or SILE.settings:get("font.size") - 3
×
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
      SILE.settings:temporarily(function ()
×
UNCOV
17
         SILE.settings:set("typesetter.parseppattern", "\n")
×
UNCOV
18
         SILE.settings:set("typesetter.obeyspaces", true)
×
UNCOV
19
         SILE.settings:set("document.rskip", SILE.types.node.glue("0 plus 10000pt"))
×
UNCOV
20
         SILE.settings:set("document.parindent", SILE.types.node.glue("0"))
×
UNCOV
21
         SILE.settings:set("document.baselineskip", SILE.types.node.vglue("0"))
×
UNCOV
22
         SILE.settings:set("document.lineskip", SILE.types.node.vglue("2pt"))
×
UNCOV
23
         SILE.call("verbatim:font")
×
UNCOV
24
         SILE.settings:set("document.spaceskip", SILE.types.length("1spc"))
×
UNCOV
25
         SILE.settings:set("shaper.variablespaces", false)
×
UNCOV
26
         SILE.settings:set("document.language", "und")
×
UNCOV
27
         SILE.process(content)
×
28
      end)
UNCOV
29
      SILE.typesetter:leaveHmode()
×
UNCOV
30
   end, "Typesets its contents in a monospaced font.")
×
31

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

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

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

49
Here is some text set in the \autodoc:environment{verbatim} environment:
50

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

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

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

UNCOV
69
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