Compare commits

...

2 Commits

Author SHA1 Message Date
dependabot[bot] c736f2c9a4 Bump nokogiri from 1.16.2 to 1.16.3
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.16.2 to 1.16.3.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.16.2...v1.16.3)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-17 09:03:55 +00:00
Peter Gillich d8a848cfe5 Configurable font size in PDF 2024-03-17 09:03:47 +00:00
3 changed files with 37 additions and 1 deletions

View File

@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.8.5)
nokogiri (1.16.2)
nokogiri (1.16.3)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
racc (1.7.3)

View File

@ -62,6 +62,7 @@ The build for the above Docker image can be audited at <https://hub.docker.com/r
Requirements:
- Make
- Ruby
- `gem install bundler`
- `bundle install`
@ -79,6 +80,33 @@ BOOK_SLUG='sre_book' ./generate.sh
BOOK_SLUG='srw_book' ./generate.sh
```
### PDF options
Any option can be passed to `pandoc` by `PDF_OPT_` prefix, for example:
```sh
PDF_OPT_GEOMETRY=margin=1.5cm \
PDF_OPT_DOCUMENTCLASS=extbook \
PDF_OPT_FONTSIZE=14pt \
PDF_OPT_MAINFONT=LiberationSerif-Regular.ttf \
PDF_OPT_MAINFONTOPTIONS=BoldFont=LiberationSerif-Bold.ttf,ItalicFont=LiberationSerif-Italic.ttf,BoldItalicFont=LiberationSerif-BoldItalic.ttf \
PDF_OPT_MONOFONT=LiberationMono-Regular.ttf \
PDF_OPT_MONOFONTOPTIONS=BoldFont=LiberationMono-Bold.ttf,ItalicFont=LiberationMono-Italic.ttf,BoldItalicFont=LiberationMono-BoldItalic.ttf \
PDF_OPT_SANSFONT=LiberationSans-Regular.ttf \
PDF_OPT_SANSFONTOPTIONS=BoldFont=LiberationSans-Bold.ttf,ItalicFont=LiberationSans-Italic.ttf,BoldItalicFont=LiberationSans-BoldItalic.ttf \
BOOK_SLUG=sre_book ./generate.sh
```
Default options passed to `pandoc` in `generate.sh` are overloaded by `PDF_OPT_` prefix, see `PDF_OPT_GEOMETRY` in above example.
Fonts in above axample are packed to `fonts-liberation2` on **Ubuntu**.
See more details:
* <https://pandoc.org/MANUAL.html#fonts>
* <https://ctan.org/pkg/extsizes>
* <https://ctan.org/pkg/fontspec>
# Known Issues
- metadata is not complete. There are just too many authors

View File

@ -12,6 +12,13 @@ export ${BOOKS[${BOOK_SLUG^^}]}
# Common vars.
IMGS_DOMAIN="lh3.googleusercontent.com"
PDF_OPTIONS=()
for i in ${!PDF_OPT_*}; do
declare -n val=$i
key=${i#PDF_OPT_}
PDF_OPTIONS+=("-V" "${key,,}=${val}");
done
# Make sure that links are relative \
# # Remove the /sre/ directories
# Save stuff in html/ directory
@ -96,6 +103,7 @@ pandoc --from=html \
-V subparagraph \
-V geometry=margin=2cm \
-V fig_caption=false \
${PDF_OPTIONS[@]} \
--columns=60 \
complete.html