From f88f1f40d7929df60c0a6be2724abc0b00952dcf Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 27 Sep 2022 20:11:28 +0300 Subject: [hooks] Added a script for presentation ftag handling --- generate-hooks/make-presentation.sh | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 generate-hooks/make-presentation.sh diff --git a/generate-hooks/make-presentation.sh b/generate-hooks/make-presentation.sh new file mode 100755 index 0000000..c7426a4 --- /dev/null +++ b/generate-hooks/make-presentation.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# A presentation is just a markdown file, with some added ftags for formatting into a presentation layout. +# This means all presentations will change how they look with changes to the main styles.css. It also means +# that they follow the light/dark mode setting. +# Each slide is the size of a horizontal A4 piece of paper. This makes it easy to print (and there is a dedicated +# print button). +# The whole system is based on flexboxes. The only real way to control how items are aligned is via a row and column +# directed flexboxes. This isn't the most efficient, but it's fine. And if there are performance issues, the +# presentation can always be "printed" to a PDF and consumed that way. + +# You really shouldn't have anything before or after a presentation, since it might show up on the print. +# All ftags that have a closing tag, and &&presentation, need one line above and below them (but you don't +# need the first and last line of file to be empty). + +# &&presentation Required. Adds the control panel and JavaScript script. Must be the very first one! +# &&slide Starts a slide. Slides are the main pages that hold content and are used for navigation. +# &&/slide Ends (the last started) slide. +# &&flexer An empty container with flex: 1. Use it for spacing out stuff. +# &¢ered Aligns text to the center. +# &&/centered Ends (the last started) centered text. +# &&fow Flexbox, with flex-direction row. +# &&/fow Ends (the last started) fow. +# &&fol Flexbox, with flex-direction column. +# &&/fol Ends (the last started) fol. + +if [ -z "$1" ]; then + echo First parameter must be a path + exit +fi + +presentation=' + + ' +presentation=$(echo $presentation | sed 's/\//\\\//g') + +# Loop through all HTML files in given directory +for file in $(find "$1" -type f -wholename "*talks/*.html"); do + sed -i "s/

&&presentation<\/p>/$presentation/g; + s/

&&slide<\/p>/

/g;s/

&&/slide<\/p>/<\/div>/g; + s/

&&centered<\/p>/

/g;s/

&&/centered<\/p>/<\/div>/g; + s/&&flexer/

<\/div>/g; + s/

&&fow<\/p>/

/g;s/

&&/fow<\/p>/<\/div>/g" \ + "$file" +done -- cgit v1.3.1-26-gb76a