Skip to content

Commit

Permalink
Merge pull request #1849 from alerque/docs-note-style
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque authored Aug 19, 2023
2 parents 649b9e1 + de41cac commit 153fed0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion documentation/c10-classdesign.sil
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ Infonodes work on a per-page basis, so if we want to save them throughout the wh
table.
In order to be useful, we also need to make sure we store their page numbers.

\note{SILE provides the \code{SILE.scratch} variable for you to store global information in.
\autodoc:note{SILE provides the \code{SILE.scratch} variable for you to store global information in.
You should use a portion of this table namespaced to your class or package.}

Here is a routine we can call at the end of each page to move the TOC nodes:
Expand Down
3 changes: 1 addition & 2 deletions documentation/macros.sil
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
\use[module=packages.simpletable]
% Autodoc-related shims
\define[command=examplefont]{\autodoc:example{\process}}
\define[command=note]{\autodoc:note{\process}}
% Document fonts
\define[command=sectionsfont]{\font[weight=600,family=Roboto Condensed]{\process}}
\define[command=tableofcontents:headerfont]{\font[weight=600,size=22pt,family=Roboto Condensed]{\process}}
Expand All @@ -29,7 +28,7 @@
% Custom commands
\define[command=terminal]{\verbatim{\set[parameter=document.lskip,value=36pt]\process\smallskip}}
\define[command=changed]{
\note{\strong{The material in this section has changed significantly since the previous release of SILE.}}
\autodoc:note{\strong{The material in this section has changed significantly since the previous release of SILE.}}
}
\define[command=sup]{\raise[height=0.6ex]{\font[size=0.8em]{\process}}}
\end{document}
18 changes: 12 additions & 6 deletions packages/autodoc/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ local theme = {
bracketed = "#656565", -- some grey
package = "#172557", -- saturated space blue
note = "#525257", -- some asphalt grey hue
class = "#6a2c54" -- some dark shaded magenta
class = "#6a2c54", -- some dark shaded magenta
codeblock = "#303040" -- dark grey with a hint of blue
}

local colorWrapper = function (ctype, content)
Expand Down Expand Up @@ -333,15 +334,19 @@ function package:registerCommands ()
SILE.settings:set("shaper.variablespaces", false)
SILE.settings:set("document.language", "und")
SILE.typesetter:leaveHmode()
SILE.call("color", { color = "#303040" }, function ()
colorWrapper("codeblock", function ()
SILE.call("bigskip")
SILE.call("autodoc:line")
colorWrapper("note", function ()
SILE.call("autodoc:line")
end)
SILE.typesetter:pushVglue(-0.6*ex)
SILE.call("novbreak")
SILE.process(content)
SILE.call("novbreak")
SILE.typesetter:pushVglue(1.4*ex)
SILE.call("autodoc:line")
colorWrapper("note", function ()
SILE.call("autodoc:line")
end)
SILE.call("smallskip")
end)
end)
Expand All @@ -368,7 +373,7 @@ function package:registerCommands ()
local innerindent = SILE.measurement("1em"):absolute()
SILE.settings:temporarily(function ()
SILE.settings:set("document.lskip", leftindent)
SILE.settings:set("document.rskip", SILE.nodefactory.glue())
SILE.settings:set("document.rskip", leftindent)

SILE.call("noindent")
colorWrapper("note", function ()
Expand All @@ -378,10 +383,11 @@ function package:registerCommands ()
SILE.call("hrule", { width = 3 * linedimen, height = linethickness })
SILE.call("hrule", { width = linethickness, height = linethickness, depth = linedimen })

SILE.call("noindent")
SILE.call("novbreak")
SILE.settings:temporarily(function ()
SILE.settings:set("document.lskip", SILE.nodefactory.glue(leftindent + innerindent))
SILE.settings:set("document.rskip", SILE.nodefactory.glue(innerindent))
SILE.settings:set("document.rskip", SILE.nodefactory.glue(leftindent + innerindent))
SILE.call("font", { size = "0.95em", style = "italic "}, content)
SILE.call("novbreak")
end)
Expand Down
4 changes: 2 additions & 2 deletions packages/dropcaps/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ To tweak the position of the dropcap, measurements may be passed to the \autodoc
Other options passed to \autodoc:command{\dropcap} will be passed through to \autodoc:command{\font} when drawing the initial letter(s).
This may be useful for passing OpenType options or other font preferences.
\begin{note}
\begin{autodoc:note}
One caveat is that the size of the initials is calculated using the default linespacing mechanism.
If you are using an alternative method from the \autodoc:package{linespacing} package, you might see strange results.
Set the \autodoc:setting{document.baselineskip} to approximate your effective leading value for best results.
If that doesn't work set the size manually.
Using \code{SILE.setCommandDefaults()} can be helpful for so you don't have to set the size every time.
\end{note}
\end{autodoc:note}
\end{document}
]]

Expand Down
4 changes: 2 additions & 2 deletions packages/image/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ If the size parameters are not given, then the image will be output at its “na
The command also supports a \autodoc:parameter{page=<number>} option, to specify the selected page in formats supporting
several pages (such as PDF).
\begin{note}
\begin{autodoc:note}
With the libtexpdf backend (the default), the images can be in JPEG, PNG, EPS, or PDF formats.
\end{note}
\end{autodoc:note}
Here is a 200x243 pixel image output with \autodoc:command{\img[src=documentation/gutenberg.png]}.
The image has a claimed resolution of 100 pixels per inch, so ends up being two inches (144pt) wide on the page:\par
Expand Down
1 change: 1 addition & 0 deletions packages/specimen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function package:registerCommands ()
local w = 0
for j= 1,#tokens do w = w + tokens[j].width end
local ratio = width.length / w
SILE.call("noindent")
SILE.call("font", {size = fontOptions.size * ratio}, function()
SILE.process({line.string})
SILE.call("par")
Expand Down

0 comments on commit 153fed0

Please sign in to comment.