talks/justfile
Oliver Davies 7fdeffb1af Update justfile recipes
* Hide the `default` recipe by renaming it to `_default` (recipes
  prefixed with an underscore are hidden from `just --list`.
* Re-add the `present` recipe for presenting with `pdfpc`, but making
  the duration a required argument.
* Add a `watch` recipe that watches files for changes and re-generates
  the PDF. This is based on a given path,
  e.g. `./src/test-driven-drupal`, and optionally allows for overriding
  the rst filename if I only want to watch a specfic source file, such
  as `demo.rst`.
2024-05-10 10:08:04 +01:00

45 lines
1 KiB
Makefile

pdf_filename := 'slides.pdf'
thumbnail_filename := 'thumbnail.jpg'
_default:
@just --list
clean:
rm -fr dist/*
touch dist/.keep
find . \
-type f \( -name "{{ pdf_filename }}" -o -name *.build_temp -o -name {{ thumbnail_filename }} \) \
-delete
generate talk_path filename="slides.rst": (generate-pdf talk_path filename)
generate-pdf talk_path filename="slides.rst":
#!/usr/bin/env bash
set -o errexit
set -o nounset
talk_slug=$(basename {{ talk_path }})
pushd "{{ talk_path }}"
rst2pdf {{ filename }} \
--break-level 1 \
-e preprocess \
--fit-background-mode scale \
--font-path ../fonts \
--output "../../dist/${talk_slug}.pdf" \
--stylesheets opdavies-light,igor \
--stylesheet-path ../styles
popd
tree dist
present slides_path duration *args:
pdfpc {{ slides_path }} --duration={{ duration }} {{ args }}
watch slides_path rst_file="slides.rst":
find justfile src/styles {{ slides_path }} -type f | \
entr just generate-pdf {{ slides_path }} {{ rst_file }}