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

sile-typesetter / sile / 7232859119

16 Dec 2023 03:49PM UTC coverage: 66.878% (-7.7%) from 74.62%
7232859119

push

github

web-flow
Merge 05d75c2a3 into 8686730e4

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

1201 existing lines in 56 files now uncovered.

10550 of 15775 relevant lines covered (66.88%)

3347.52 hits per line

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

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

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

6
local typesetMark = function (open, setback, scale, color, mark)
UNCOV
7
  SILE.settings:temporarily(function ()
×
UNCOV
8
    SILE.call("pullquote:mark-font")
×
UNCOV
9
    SILE.call("raise", { height = -(open and (scale+1) or scale) .. "ex" }, function ()
×
UNCOV
10
      SILE.settings:set("font.size", SILE.settings:get("font.size")*scale)
×
UNCOV
11
      SILE.call("color", { color = color }, function ()
×
UNCOV
12
        if open then
×
UNCOV
13
          SILE.typesetter:pushGlue({ width = -setback })
×
UNCOV
14
          SILE.call("rebox", { width = setback, height = 0 }, { mark })
×
15
        else
UNCOV
16
          SILE.typesetter:pushGlue(SILE.nodefactory.hfillglue())
×
UNCOV
17
          local hbox = SILE.typesetter:makeHbox({ mark }) -- for measuring
×
UNCOV
18
          SILE.typesetter:pushGlue({ width = setback - hbox.width })
×
UNCOV
19
          SILE.call("rebox", { width = hbox.width, height = 0 }, { mark })
×
UNCOV
20
          SILE.typesetter:pushGlue({ width = -setback })
×
21
        end
22
      end)
23
    end)
24
  end)
25
end
26

UNCOV
27
function package:_init ()
×
UNCOV
28
  base._init(self)
×
UNCOV
29
  self:loadPackage("color")
×
UNCOV
30
  self:loadPackage("raiselower")
×
UNCOV
31
  self:loadPackage("rebox")
×
32
end
33

UNCOV
34
function package:registerCommands ()
×
35

UNCOV
36
  self:registerCommand("pullquote:font", function (_, _)
×
UNCOV
37
  end, "The font chosen for the pullquote environment")
×
38

UNCOV
39
  self:registerCommand("pullquote:author-font", function (_, _)
×
UNCOV
40
    SILE.settings:set("font.style", "italic")
×
UNCOV
41
  end, "The font style with which to typeset the author attribution.")
×
42

UNCOV
43
  self:registerCommand("pullquote:mark-font", function (_, _)
×
UNCOV
44
    SILE.settings:set("font.family", "Libertinus Serif")
×
UNCOV
45
  end, "The font from which to pull the quotation marks.")
×
46

UNCOV
47
  self:registerCommand("pullquote", function (options, content)
×
UNCOV
48
    SILE.typesetter:leaveHmode()
×
UNCOV
49
    local author = options.author or nil
×
UNCOV
50
    local scale = options.scale or 3
×
UNCOV
51
    local color = options.color or "#999999"
×
UNCOV
52
    SILE.settings:temporarily(function ()
×
UNCOV
53
      SILE.call("pullquote:font")
×
UNCOV
54
      local setback = SU.cast("length", options.setback or "2em"):absolute()
×
UNCOV
55
      SILE.settings:set("document.rskip", SILE.nodefactory.glue(setback))
×
UNCOV
56
      SILE.settings:set("document.lskip", SILE.nodefactory.glue(setback))
×
UNCOV
57
      SILE.call("noindent")
×
UNCOV
58
      typesetMark(true, setback, scale, color, "“")
×
UNCOV
59
      SILE.call("indent")
×
UNCOV
60
      SILE.process(content)
×
UNCOV
61
      typesetMark(false, setback, scale, color, "”")
×
UNCOV
62
      if author then
×
UNCOV
63
        SILE.settings:temporarily(function ()
×
UNCOV
64
          SILE.typesetter:leaveHmode()
×
UNCOV
65
          SILE.call("pullquote:author-font")
×
UNCOV
66
          SILE.call("raggedleft", {}, function ()
×
UNCOV
67
            SILE.typesetter:typeset("— " .. author)
×
68
          end)
69
        end)
70
      else
71
        SILE.call("par")
×
72
      end
73
    end)
UNCOV
74
  end, "Typesets its contents in a formatted blockquote with decorative quotation\
×
UNCOV
75
        marks in the margins.")
×
76

77
end
78

79
package.documentation = [[
80
\begin{document}
81
The \autodoc:package{pullquote} package formats longer quotations in an indented blockquote block with decorative quotation marks in the margins.
82
Here is some text set in a \autodoc:environment{pullquote} environment:
83

84
\begin[author=Anatole France]{pullquote}%
85
An education is not how much you have committed to memory, or even how much you know.
86
It is being able to differentiate between what you do know and what you do not know.
87
\end{pullquote}
88

89
Optional values are available for:
90

91
\begin{itemize}
92
\item{\autodoc:parameter{author} to add an attribution line}
93
\item{\autodoc:parameter{setback} to set the bilateral margins around the block}
94
\item{\autodoc:parameter{color} to change the color of the quote marks}
95
\item{\autodoc:parameter{scale} to change the relative size of the quote marks}
96
\end{itemize}
97

98
If you want to specify what font the \autodoc:environment{pullquote} environment should use, you can redefine the \autodoc:command{\pullquote:font} command.
99
By default it will be the same as the surrounding document.
100
The font style used for the attribution line can likewise be set redefining \autodoc:command{\pullquote:author-font}, and the font used for the quote marks can be set redefining \autodoc:command{\pullquote:mark-font}.
101
\end{document}
UNCOV
102
]]
×
103

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