When running `make epub`, Make would try to satisfy the target
'src/plfa/acknowledgements_epub.md' by calling run-liquid.lua. But due
to the use of shell redirection, Make would always create the file
acknowledgements_epub.md, even if run-liquid.lua failed, in which case
acknowledgements_epub.md would be empty. This empty file would still
satisfy the 'src/plfa/acknowledgements_epub.md' target, allowing the
pandoc command line in the 'out/plfa.epub' target to proceed---and later
fail.
To avoid this, we now (a) add a bunch of error checking to run-liquid.lua,
and (b) write directly to acknowledgements_epub.md instead of relying on
shell redirection, so that acknowledgements_epub.md will only be created
(or modified) if run-liquid.lua succeeds.
HTML does not permit nested <p> elements, which epubcheck complains
about. This change fixes those remaining warnings.
This change also causes the Dedication on the website to be centered
when viewed in Safari, which it was not before. The EPUB output looks
the same in either version with Thorium reader 1.3 on macOS.
Use liquid-lua to generate acknowledgements_epub.md, which is used by
pandoc to build the EPUB book. Also stop using the '{%-' / '-%}'
syntax, which liquid-lua does not support, in templates.
Also add a vertical space between the first bullet in each bulleted
list so pandoc recognizes bulleted lists as such. This has no effect on
the the website.
This reverts commit dbed30c659.
For whatever reason, some erroneous links are not detected with
this script, but are detected with epubchecker. So let's just use
epubchecker when the time comes.
This should make the link rewriting process easier. As this does
the same job as epubChecker, it can probably be removed once
epubChecker is integrated into the build process.
The EPUB is created with `pandoc` in combination with Lua filters, which
rewrite the abstract syntax tree to be more suitable for EPUB creation.
In particular all headings in the markdown files `part[123]/*.lagda.md`
are shifted up by 1 (e.g., level 1 heading -> level 2 heading), so that
we can make a level 1 heading for Appendix, Frontmatter, and different
parts of the book. This is done to match the structure on the website [1].
Syntax highlighting is done using pandoc's builtin syntax highlighter
(which uses the Haskell library `skylighting`). In other words, we do
not use `highlight.sh`, so the syntax highlighting is slightly different
than the website version of the book. This could certainly be dealt with
later.
What follows is a list of things that are currently broken, which is
probably not exhaustive:
- The `Acknowledgements` section is broken.
- Embedded fonts don't work. They're necessary for some ereaders, like my old Sony PRS-300.
- All inline links are broken. I could rewrite them with a Lua filter
and some regex, although that's not very nice :)
- `epubcheck` validation fails for a variety of reasons.
Closes#112.
[1]: https://plfa.github.io/
[2]: https://github.com/w3c/epubcheck