Skip to content

Commit

Permalink
Merge branch 'master' into urlstyle-and-code-command
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Mar 23, 2023
2 parents c1954ee + 40fd272 commit 21cc684
Show file tree
Hide file tree
Showing 63 changed files with 644 additions and 586 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -80,7 +80,7 @@ jobs:
run: |
git fetch --prune --tags ||:
- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v20
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
git fetch --prune --tags ||:
- name: Setup ‘lua’
uses: leafo/gh-actions-lua@v9
uses: leafo/gh-actions-lua@v10
with:
luaVersion: luajit
luaCompileFlags: XCFLAGS=-fPIC
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nix.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
run: |
git fetch --prune --tags ||:
- name: Install Nix
uses: cachix/install-nix-action@v18
uses: cachix/install-nix-action@v20
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -39,7 +39,7 @@ jobs:
run: |
git fetch --prune --tags ||:
- name: Setup ‘lua’
uses: leafo/gh-actions-lua@v9
uses: leafo/gh-actions-lua@v10
with:
luaVersion: ${{ matrix.luaVersion[0] }}
luaCompileFlags: ${{ matrix.luaVersion[1] }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -4,7 +4,7 @@
[![Azure Build Status](https://img.shields.io/azure-devops/build/sile-typesetter/069c3e31-ee59-4bd6-b395-1f1059acd8db/1?label=Windows%20Build&logo=Azuredevops)](https://dev.azure.com/sile-typesetter/sile/_build/latest?definitionId=1&branchName=master)<br />
[![Luacheck Lint Status](https://img.shields.io/github/actions/workflow/status/sile-typesetter/sile/luacheck.yml?branch=master&label=Luacheck&logo=Lua)](https://github.com/sile-typesetter/sile/actions?workflow=Luacheck)
[![Coveralls Coverage Status](https://img.shields.io/coveralls/github/sile-typesetter/sile?label=Coverage&logo=Coveralls)](https://coveralls.io/github/sile-typesetter/sile?branch=master)<br />
[![Chat on Gitter](https://img.shields.io/gitter/room/simoncozens/sile?color=blue&label=Chat&logo=Gitter)](https://gitter.im/simoncozens/sile?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Chat on Gitter](https://img.shields.io/gitter/room/sile-typesetter/sile?color=blue&label=Chat&logo=Gitter)](https://gitter.im/sile-typesetter/sile?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-blue.svg)](https://conventionalcommits.org)
[![Commitizen Friendly](https://img.shields.io/badge/Commitizen-friendly-blue.svg)](http://commitizen.github.io/cz-cli/)

Expand Down Expand Up @@ -293,7 +293,7 @@ Note the comments in [the section about Docker](#docker) regarding version tags.
## Installing third-party packages

Third-party SILE packages can be installed using the `luarocks` package manager.
Packages may be hosted anywhere, ether on the default [luarocks.org](https://luarocks.org/) repository or (as in the example below) listed in a specific server manifest.
Packages may be hosted anywhere, either on the default [luarocks.org](https://luarocks.org/) repository or (as in the example below) listed in a specific server manifest.
For example, to install [markdown.sile](https://github.com/Omikhleia/markdown.sile) (a plugin that provides a SILE inputter that reads and processes Markdown documents) one could run:

```console
Expand Down
2 changes: 1 addition & 1 deletion classes/base.lua
Expand Up @@ -127,7 +127,7 @@ function class.declareSettings (_)
})
SILE.settings:declare({
parameter = "current.hangIndent",
type = "integer or nil",
type = "measurement or nil",
default = nil,
help = "Size of hanging indent"
})
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.69])
AC_INIT([sile],[m4_esyscmd(build-aux/git-version-gen .tarball-version)],[simon@simon-cozens.org])
AC_INIT([sile], [m4_esyscmd(build-aux/git-version-gen .tarball-version)], [simon@simon-cozens.org])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign tar-pax dist-xz dist-zip no-dist-gzip color-tests subdir-objects])
Expand Down Expand Up @@ -31,7 +31,7 @@ AM_CONDITIONAL([DEPENDENCY_CHECKS], [test "x$enable_dependency_checks" != "xno"]

AC_ARG_ENABLE([developer],
AS_HELP_STRING([--enable-developer],
[Check for and enable tooling required only for SILE developers]))
[Check for and enable tooling required only for developers]))
AM_CONDITIONAL([DEVELOPER], [test "x$enable_developer" = "xyes"])

AC_ARG_ENABLE([font-variations],
Expand Down
28 changes: 23 additions & 5 deletions core/utilities.lua
Expand Up @@ -24,6 +24,8 @@ utilities.boolean = function (value, default)
if value == "true" then return true end
if value == "no" then preferbool(); return false end
if value == "yes" then preferbool(); return true end
if value == nil then return default end
SU.error("Expecting a boolean value but got '" .. value .. "'")
return default
end

Expand Down Expand Up @@ -299,11 +301,6 @@ utilities.cast = function (wantedType, value)
wantedType = string.lower(wantedType)
if wantedType:match(actualType) then return value
elseif actualType == "nil" and wantedType:match("nil") then return nil
elseif wantedType:match("integer") or wantedType:match("number") then
if type(value) == "table" and type(value.tonumber) == "function" then
return value:tonumber()
end
return tonumber(value)
elseif wantedType:match("length") then return SILE.length(value)
elseif wantedType:match("measurement") then return SILE.measurement(value)
elseif wantedType:match("vglue") then return SILE.nodefactory.vglue(value)
Expand All @@ -312,6 +309,27 @@ utilities.cast = function (wantedType, value)
elseif actualType == "nil" then SU.error("Cannot cast nil to " .. wantedType)
elseif wantedType:match("boolean") then return SU.boolean(value)
elseif wantedType:match("string") then return tostring(value)
elseif wantedType:match("number") then
if type(value) == "table" and type(value.tonumber) == "function" then
return value:tonumber()
end
local num = tonumber(value)
if not num then SU.error("Cannot cast '" .. value .. "'' to " .. wantedType) end
return num
elseif wantedType:match("integer") then
local num
if type(value) == "table" and type(value.tonumber) == "function" then
num = value:tonumber()
else
num = tonumber(value)
end
if not num then SU.error("Cannot cast '" .. value .. "'' to " .. wantedType) end
if not wantedType:match("number") and num % 1 ~= 0 then
-- Could be an error but since it wasn't checked before, let's just warn:
-- Some packages might have wrongly typed settings, for instance.
SU.warn("Casting an integer but got a float number " .. num)
end
return num
else SU.error("Cannot cast to unrecognized type " .. wantedType)
end
end
Expand Down
35 changes: 18 additions & 17 deletions documentation/c01-whatis.sil
Expand Up @@ -12,7 +12,7 @@ does is to compare it to other systems which you may have heard of.
\section{SILE versus Word}

When most people produce printed documents using a computer, they usually use
desktop oriented word processing software such as Microsoft Word, iWork Pages,
desktop oriented word processing software such as Microsoft Word, Apple Pages,
or LibreOffice Writer. SILE is not a word processor; it is a typesetting
system. There are several important differences.

Expand Down Expand Up @@ -45,7 +45,7 @@ out automatically how it best flows from frame to frame and from page to page.
So when you are preparing content for SILE, you don’t know where the lines
will break until after it has been processed. You may use your text editor to
type and type and type as long a line as you like, and when SILE comes to
process your instructions, it will consider your input (up to) three times
process your instructions, it will consider your input several times
over in order to work out how to best to break the lines to form a paragraph.
For example, if after one pass it finds that it has ended two successive lines
with a hyphenated word, it will go back and try again and see if it can find
Expand Down Expand Up @@ -83,7 +83,7 @@ TrueType fonts, not METAFONTs (\tt{xetex}); PDFs, not DVIs (\tt{pstex},
\tt{pdftex}); Unicode, not 7-bit ASCII (\tt{xetex} again); markup languages
and embedded programming languages, not macro languages (\tt{xmltex},
\tt{luatex}). At this point, the parts of TeX that people actually \em{use}
are 1) the box-and-glue model, 2) the hyphenation algorithm, and 3) the
are (1) the box-and-glue model, (2) the hyphenation algorithm, and (3) the
line-breaking algorithm.

SILE follows exactly in TeX’s footsteps for each of these three areas that have
Expand All @@ -95,25 +95,27 @@ to you, you should already be getting excited.} it is very easy to extend or
alter the behaviour of the SILE typesetter.

For instance, one of the things that TeX can’t do particularly well is
typesetting on a grid. This is something of a must-have feature for anyone
typesetting bibles. Typesetting on a grid means that each line of text will
typesetting on a grid. This a must-have feature for anyone
typesetting bibles and other documents to be printed on thin paper.
Typesetting on a grid means that each line of text will
line up between the front and back of each piece of paper producing much less
visual bleed-through when printed on thin paper. This is virtually impossible
to accomplish in TeX. There are various hacks to try to make it happen, but
they’re all horrible. In SILE, you can alter the behaviour of the typesetter
and write a very short add-on package to enable grid typesetting.
and include a very short add-on package to enable grid typesetting.

Of course, nobody uses plain TeX—they all use LaTeX equivalents plus a huge
repository of packages available from the CTAN. SILE does not benefit from the
In fact, nobody uses plain TeX—they all use LaTeX equivalents plus a huge
repository of packages available from the The Comprehensive TeX Archive Network
(CTAN) archive. SILE does not benefit from the
large ecosystem and community that has grown up around TeX; in that sense, TeX
will remain streets ahead of SILE for some time to come. But in terms of
\em{core capabilities}, SILE is already certainly equivalent to, if not
somewhat more advanced than, TeX.
will remain ahead of SILE for some time to come. But in terms of
\em{core capabilities}, SILE is already equivalent to TeX—if not
somewhat more advanced.

\section{SILE versus InDesign}

The other tool that people reach for when designing printed material on
a computer is InDesign (or similar Desktop Publishing software, such as
a computer is Adobe InDesign (or similar desktop publishing software, such as
Scribus).

% Reduce bug reports about this buggy float with a hack-around
Expand All @@ -124,10 +126,10 @@ Scribus).

\noindent
\float[rightboundary=7pt,bottomboundary=10pt]{\img[src=documentation/fig1.png,width=140]}
DTP software is similar to Word Processing Software in that they are
DTP software is similar to word processing software in that they are
both graphical and largely WYSIWYG, but the paradigm is different. The focus is
usually less on preparing the content than on laying it out on the
page--you click and drag to move areas of text and images around the screen.
pageyou click and drag to move areas of text and images around the screen.

InDesign is a complex, expensive, commercial publishing tool. SILE is a free,
open source typesetting tool which is entirely text-based; you enter commands
Expand All @@ -149,12 +151,11 @@ InDesign is to declare what styling should apply to each XML element, and as
the data is read in, InDesign formats the content according to the rules that
you have declared.

You can do exactly the same thing in SILE, except you have a lot more control
You can do the same thing in SILE, except you have a lot more control
over how the XML elements get styled, because you can run any SILE command you
like for a given element, including calling out to Lua code to style a piece of
XML. Since SILE is a command-line filter, armed with appropriate styling
instructions you can go from an XML file to a PDF in one shot. Which is quite
nice.
instructions you can go from an XML file to a PDF in one shot.

In the final chapters of this book, we’ll look at some extended examples of
creating a \em{class file} for styling a complex XML document into a PDF with
Expand Down

0 comments on commit 21cc684

Please sign in to comment.