Add workspace.yml

Add a workspace.yml file with commands for PDF generating and watching,
generating thumbnail images, and cleaning generated files.
This commit is contained in:
Oliver Davies 2021-01-28 23:10:39 +00:00
parent d409742cfe
commit 398fa3c547
2 changed files with 45 additions and 16 deletions

View file

@ -4,19 +4,3 @@ Talks and Presentations by Oliver Davies
For talk abstracts, event information, and links to video recordings and the generated slides, see my `talks page`_.
.. _talks page: https://www.oliverdavies.uk/talks
Watching for changes and automatically regenerating
===================================================
The easiest way to do this is using nodemon_::
nodemon \
--ext rst,style,txt \
--exec "rst2pdf slides.rst \
--output slides.pdf \
--stylesheets main \
--break-level 1 \
--fit-background-mode scale \
--extension-module preprocess"
.. _nodemon: https://nodemon.io

45
workspace.yml Normal file
View file

@ -0,0 +1,45 @@
workspace('talks'):
description: 'My slide decks'
attributes:
rst2pdf:
command: |
= 'rst2pdf ' ~ @('rst2pdf.filename.rst') ~ '
--break-level 1
--stylesheets main
--fit-background-mode scale
--extension-module preprocess
--output ' ~ @('rst2pdf.filename.pdf')
filename:
pdf: slides.pdf
rst: slides.rst
thumbnail:
filename: thumbnail.png
command('clean all'):
env:
PDF_FILENAME: = @('rst2pdf.filename.pdf')
RST_FILENAME: = @('rst2pdf.filename.rst')
THUMBNAIL_FILENAME: = @('thumbnail.filename')
exec: |
#!bash
run "find . -type f \( -name '$PDF_FILENAME*' -o -name $RST_FILENAME.build_temp -o -name $THUMBNAIL_FILENAME \) -delete"
command('pdf generate <talk>'): |
#!bash|=
cd ={ input.argument('talk') }
passthru ={ @('rst2pdf.command') }
command('pdf watch <talk>'): |
#!bash|=
cd ={ input.argument('talk') }
passthru nodemon -e rst,style,txt -x "={ @('rst2pdf.command') }"
command('thumbnail <talk>'):
env:
PDF_FILENAME: = @('rst2pdf.filename.pdf')
THUMBNAIL_FILENAME: = @('thumbnail.filename')
exec: |
#!bash|=
cd ={ input.argument('talk') }
passthru gs -sDEVICE=png16m -r300 -dDownScaleFactor=4 -sOutputFile=$THUMBNAIL_FILENAME -dLastPage=1 $PDF_FILENAME