Then came the panic of the video-presentation.
Kept using Pandoc for the slides, since I already had some content from a
previous talk. It still makes you focus on content with a decent editing setup
(a.k.a. Emacs) and hacking layouts & fonts somewhat separately.
But this was for a video, not a live semi-improvised talk …
⇒ One wants to improve and speed up the speaking flow.
Hereby came the need for speaker notes, and that's when this thing becomes a
glorious hack:
build () {
name=20200828-smondet-smartpy
tmpml=/tmp/ocaml20.ml
sed 's/<!-- *(\*/{< let () = cmt {cmt|/g' slides.md | \
sed 's/\*) *-->/|cmt} >}/g' | \
mpp -l ocaml -so '{:' -sc ':}' > $tmpml
export with_comments=true
ocaml $tmpml | pandoc --self-contained -s -o $name.html \
--number-sections \
--css quick.css
echo "HTML-Done: file://$PWD/$name.html"
export with_comments=false
ocaml $tmpml | pandoc -t beamer \
-V fontsize:11pt \
-V colorlinks:true \
--highlight-style tango \
-V monofont:DejaVuSansMono \
-V monofontoptions:'Scale=0.8' \
-V theme:Rochester \
-V colortheme:dove \
-V aspectratio=169 \
--pdf-engine=xelatex \
-s \
-o $name.pdf
echo "Pandoc done."
exiftool -Title="SmartPy 20200828 @smondet " \
-Author="Seb Mondet" \
-Subject="Slides for OCaml 2020, Aug 28" \
-Keywords="smartpy;python;ocaml" \
-Creator="@smondet" \
-Producer="@smondet" \
$name.pdf
pdftoppm $name.pdf $name -png
echo "Done: file://$PWD/$name.pdf"
}
- Using
mpp
, a.k.a.
ocaml/MPP-language-blender
,
as the glue it's meant to be. - Some
sed
to transform special markdown/HTML comments, like
<!--(* ... *)-->
into mpp
's “guest language” syntax:
let () = cmt {cmt| ... |cmt}
. - There is
exiftool
which is nice for publishing PDFs on the Web without
having to figure out Pandoc's templating. - And
pdftoppm
produces the images that are then manually included in the
video.
It's processed once with "with_comments" set to true
to generate the
speaker script in HTML and once with false
to generate the PDF slides and the
PNG images.
Here is how it looks, with the implementation of the cmt
function:
% ![SmartPy smondet](./img/intro-page.png){ width=55% }
% OCaml Workshop 2020-08-28
% [Seb Mondet](https://seb.mondet.org), [TQ Tezos](https://tqtezos.com/)
{< let cmt s =
match Sys.getenv "with_comments" with
| "true" -> Printf.printf "*``(* %s *)``*" s
| _ -> ()
| exception _ -> () >}
# Slide 0
Bla bla <!--(* Those are speaker notes *)--> more content