Skip to content

Commit

Permalink
Merge branch 'develop' into feat-new-approach-refactor-pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Dec 16, 2023
2 parents ad2faa5 + ad5f09a commit 8fd8be5
Show file tree
Hide file tree
Showing 122 changed files with 231 additions and 27 deletions.
4 changes: 2 additions & 2 deletions build-aux/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[cfg(feature = "manpage")]
use clap_mangen::Man;
#[cfg(feature = "static")]
#[cfg(any(feature = "static", feature = "completions"))]
use std::path::Path;
use std::{collections, env};
use vergen::EmitBuilder;
Expand All @@ -9,7 +9,7 @@ use {
clap::CommandFactory,
clap_complete::generator::generate_to,
clap_complete::shells::{Bash, Elvish, Fish, PowerShell, Zsh},
std::{fs, path::Path},
std::fs,
};

#[cfg(feature = "completions")]
Expand Down
4 changes: 4 additions & 0 deletions documentation/c05-packages.sil
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ This section introduces packages that could not fit in another category.
\status:low
\package-documentation{ifattop}

\subsection{retrograde}
\status:high
\package-documentation{retrograde}

\section{Frames and page layouts}

As we mentioned in the first chapter, SILE uses frames as an indication of where to put text onto
Expand Down
4 changes: 2 additions & 2 deletions packages/balanced-frames/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ local function buildPage (typesetter, independent)
return true
end

function package:_init (class)
base._init(self, class)
function package:_init (options)
base._init(self, options)
self.class:registerPostinit(function(_)
if not unbalanced_buildPage then
unbalanced_buildPage = SILE.typesetter.buildPage
Expand Down
4 changes: 2 additions & 2 deletions packages/boustrophedon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ local base = require("packages.base")
local package = pl.class(base)
package._name = "boustrophedon"

function package:_init (class)
base._init(self, class)
function package:_init (options)
base._init(self, options)
SILE.hyphenator.languages.grc = { patterns={} }
SILE.nodeMakers.grc = pl.class(SILE.nodeMakers.unicode)
function SILE.nodeMakers.grc.iterator (node, items)
Expand Down
84 changes: 84 additions & 0 deletions packages/retrograde/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
local base = require("packages.base")

local package = pl.class(base)
package._name = "retrograde"

local semver = require("semver")

local semver_descending = function (a, b)
a, b = semver(a), semver(b)
return a > b
end

-- Default settings that have gone out of fashion
package.default_settings = {
["0.15.0"] = {
["shaper.spaceenlargementfactor"] = 1.2,
},
}

function package:_init (options)
base._init(self, options)
self:defaults(options.target)
end

function package:defaults (target)
target = semver(target and target or SILE.version)
local target_hit = false
for version, settings in pl.tablex.sort(self.default_settings, semver_descending) do
version = semver(version)
for parameter, value in pairs(settings) do
SU.debug("defaults", ("Resetting '%s' to '%s' as it was prior to v%s"):format(parameter, tostring(value), version))
SILE.settings:set(parameter, value, true)
end
if target_hit then break end
if version <= target then target_hit = true end
end
end

function package:registerCommands ()

self:registerCommand("defaults", function (options, content)
if content then
SILE.settings:temporarily(function ()
self:defaults(options.target)
end)
else
self:defaults(options.target)
end
end)

end

local doctarget = "v" .. tostring(semver(SILE.version))
package.documentation = ([[
\begin{document}
From time to time, the default behavior of a function or value of a setting in SILE might change with a new release.
If these changes are expected to cause document reflows they will be noted in release notes as breaking changes.
That generally means old documents will have to be updated to keep rending the same way.
On a best-effort basis (not a guarantee) this package tries to restore earlier default behaviors and settings.
For settings this is relatively simple.
You just set the old default value explicitly in your document or project.
But first, knowing what those are requires a careful reading of the release notes.
Then you have to chase down the incantations to set the old values.
This package tries to restore as many previous setting values as possible to make old documents render like they would have in previous releases without changing the documents themselves (beyond loading this package).
For functions things are a little more complex, but for as many cases as possible we'll try to allow swapping old versions of code.
None of this is a guarantee that your old document will be stable in new versions of SILE.
All of this is a danger zone.
From inside a document, use \autodoc:command{\use[module=packages.retrograde,target=%s]} to load features from SILE %s.
This can also be triggered from the command line with no changes to a document:
\begin{autodoc:codeblock}
$ sile -u 'packages.retrograde[target=%s]'
\end{autodoc:codeblock}
\end{document}
]]):format(doctarget, doctarget, doctarget)

return package
2 changes: 1 addition & 1 deletion shapers/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-- end

SILE.settings:declare({ parameter = "shaper.variablespaces", type = "boolean", default = true })
SILE.settings:declare({ parameter = "shaper.spaceenlargementfactor", type = "number or integer", default = 1.2 })
SILE.settings:declare({ parameter = "shaper.spaceenlargementfactor", type = "number or integer", default = 1 })
SILE.settings:declare({ parameter = "shaper.spacestretchfactor", type = "number or integer", default = 1/2 })
SILE.settings:declare({ parameter = "shaper.spaceshrinkfactor", type = "number or integer", default = 1/3 })

Expand Down
1 change: 1 addition & 0 deletions tests/alignment.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\use[module=packages.lorem]
\font[family=Libertinus Serif]
Expand Down
1 change: 1 addition & 0 deletions tests/amharic.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\font[family=Noto Sans Ethiopic,language=am]
የሰው፡ልጅ፡ሁሉ፡ሲወለድ፡ነጻና፡በክብርና፡በመብትም፡እኩልነት፡ያለው፡ነው።፡የተፈጥሮ፡ማስተዋልና፡ሕሊና፡ስላለው፡አንዱ፡ሌላውን፡በወንድማማችነት፡መንፈስ፡መመልከት፡ይገባዋል።

Expand Down
1 change: 1 addition & 0 deletions tests/arabic-scripts.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\use[module=packages.bidi]
\font[family=LateefGR,size=16pt,language=en]
Expand Down
1 change: 1 addition & 0 deletions tests/bibtex.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\use[module=packages.bibtex]
Expand Down
1 change: 1 addition & 0 deletions tests/bidi.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\font[family=SBL Hebrew,language=he]
\font[size=25pt]
\set[parameter=document.baselineskip,value=29pt]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1044.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\neverindent
\font[family=Libertinus Serif]{Ta of}
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1101.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[class=jplain,layout=tate,papersize=a4]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios

Expand Down
1 change: 1 addition & 0 deletions tests/bug-117.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
%nice script from SILE book
\begin{script}
for i=1,10 do
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1259.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\use[module=packages.rules]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1280.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=15cm x 6cm]{document}
\use[module=packages.retrograde,target=v0.15.0]
\font[filename=.fonts/NotoSerifCJK-Regular.ttc]
\nofolios
\neverindent
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1297-hyph-fr-ca.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=6in x 9in]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\language[main=fr]

Expand Down
1 change: 1 addition & 0 deletions tests/bug-1317.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[direction=RTL,papersize=a7]{document}
\use[module=packages.retrograde,target=v0.15.0]
\font[family=Amiri,size=30pt]
\nofolios
\neverindent
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1320.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\use[module=packages.rules]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1343-dotfill-stretch.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\use[module=packages.leaders]
\use[module=packages.lorem]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1359.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=6in x 9in]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\neverindent
\language[main=fr]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1362.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\language[main=en]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1430.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\use[module=packages.grid,spacing=50pt]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1495-inline-math-layout.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\neverindent
\use[module=packages.math]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1580.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[class=plain,papersize=a7]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\use[module=packages.masters]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-162.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
Both lines below should end in a period.

\font[language=cs]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1647.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a7]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\set[parameter=document.parskip, value=50pt]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-1674.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\script{SILE.processString("Foo \\em{bar} \\em{baz}", "sil")}
Expand Down
3 changes: 2 additions & 1 deletion tests/bug-1708.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a7,class=book]{document}
\use[module=packages.retrograde,target=v0.15.0]
\neverindent
\nofolios
\set[parameter=document.letterspaceglue, value=5pt]
Expand All @@ -9,4 +10,4 @@ Lorem ipsum\footnote{test}

Lorem ipsum% Should still have letterspacing at 5pt

\end{document}
\end{document}
1 change: 1 addition & 0 deletions tests/bug-192.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\font[family=Noto Naskh Arabic,language=urd,size=18pt]
\hbox\skip[height=95%fh]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-200.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\font[family=Gentium Plus,size=16pt,language=en]
\begin{raggedright}
Expand Down
3 changes: 2 additions & 1 deletion tests/bug-226.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin{document}
\use[module=packages.retrograde,target=v0.15.0]
\hfill Filler content here: Par 1 (One)

\hfill Par 2 (Two)
Expand All @@ -8,4 +9,4 @@
\hfill Out,

\hfill Caleb Maclennan
\end{document}
\end{document}
1 change: 1 addition & 0 deletions tests/bug-241.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\font[family=Gentium Plus,size=9pt]
\center{TITILE\break{}Then vfill to logo\vfill{}<logo>\par\break}
Expand Down
1 change: 1 addition & 0 deletions tests/bug-243.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\use[module=packages.leaders]
\font[size=50pt]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-244.sil
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
\begin[papersize=a4,class=jplain,layout=tate]{document}
\use[module=packages.retrograde,target=v0.15.0]
\latin-in-tate{Hello world.}
\end{document}
1 change: 1 addition & 0 deletions tests/bug-252.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a7,class=book]{document}
\use[module=packages.retrograde,target=v0.15.0]
\use[module=packages.frametricks]
\use[module=packages.lorem]
This is a test\footnote{What happens to frames?}.
Expand Down
3 changes: 2 additions & 1 deletion tests/bug-252a.sil
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
\begin[papersize=a7,class=book]{document}
\use[module=packages.retrograde,target=v0.15.0]
\use[module=packages.lorem]
\use[module=packages.rebox]
\footnote:separator{\skip[height=5pt]}
\define[command=deepbox]{\rebox[depth=60pt,height=10pt]{x}}
This is a test\footnote{\deepbox}.
\end{document}
\end{document}
3 changes: 2 additions & 1 deletion tests/bug-254.sil
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\raggedright{
\font[weight=600]{This} is a sample of bogus\break
extra space.

\font[weight=600]{This} does not have\break
{}extra space.
}
\end{document}
\end{document}
1 change: 1 addition & 0 deletions tests/bug-255.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\use[module=packages.frametricks]
\script{
SILE.registerCommand("donothing", function (options, content)
Expand Down
1 change: 1 addition & 0 deletions tests/bug-255b.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\use[module=packages.frametricks]
\script{
SILE.registerCommand("donothing", function(o,c)
Expand Down
1 change: 1 addition & 0 deletions tests/bug-262.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a5]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
\use[module=packages.lorem]
\hbox
Expand Down
1 change: 1 addition & 0 deletions tests/bug-264.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a7,class=book]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios
Footnote\skip[height=170pt plus 50pt]
marker.\footnote{Same page\hfill\break as marker?}
Expand Down
3 changes: 2 additions & 1 deletion tests/bug-264b.sil
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
\begin[papersize=a5,class=book]{document}
\use[module=packages.retrograde,target=v0.15.0]
% Note: The failure case for this involves an infinite loop when it
% erroniously matched penalty types that arent actually page breaks
% erroneously matched penalty types that aren't actually page breaks
\use[module=packages.linespacing]
\set[parameter=linespacing.method,value=fit-font]
\set[parameter=linespacing.fit-font.extra-space,value=15pt plus 0.5pt minus 0.5pt]
Expand Down
1 change: 1 addition & 0 deletions tests/bug-266.sil
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
\begin[papersize=a6]{document}
\use[module=packages.retrograde,target=v0.15.0]
\nofolios

Word\glue[width=1ex]to the wise
Expand Down
Loading

0 comments on commit 8fd8be5

Please sign in to comment.