diff --git a/.gitignore b/.gitignore index 4a33278..bd3bc9a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # rst2df. /**/*.pdf /**/*.rst.build_temp +/dist/ # pdfpc. /**/*.pdfpc diff --git a/flake.nix b/flake.nix index 430933d..dbfdc33 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,11 @@ formatter = pkgs.nixpkgs-fmt; devshells.default = { - packages = with pkgs; [ python310Packages.rst2pdf ]; + packages = with pkgs; [ + pdfpc + python310Packages.rst2pdf + tree + ]; }; }; }; diff --git a/run b/run index 9b76d13..538318d 100755 --- a/run +++ b/run @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -6,8 +6,9 @@ PDF_FILENAME=slides.pdf RST_FILENAME=slides.rst THUMBNAIL_FILENAME=thumbnail.jpg -function clean:all { - # Clean all generated files. +function clean { + mkdir -p dist + rm -fr dist/* find . \ -type f \( -name "${PDF_FILENAME}*" -o -name *.build_temp -o -name ${THUMBNAIL_FILENAME} \) \ @@ -23,37 +24,28 @@ function help { } function pdf:generate { - # Generate a new PDF file. - DIRECTORY_NAME=$1 shift 1 + pushd "${DIRECTORY_NAME}" - docker run --rm -it \ - -v $HOME/.local/share/fonts:/usr/share/fonts \ - -v $PWD/${DIRECTORY_NAME}:/rst2pdf \ - -w /rst2pdf \ - opdavies/rst2pdf \ - ${RST_FILENAME} \ - --break-level 1 \ - --extension-module preprocess \ - --fit-background-mode scale \ - --font-path /usr/share/fonts \ - --output ${PDF_FILENAME} \ - --stylesheets main,tango \ - "${@}" + rst2pdf "${RST_FILENAME}" \ + --break-level 1 \ + -e preprocess \ + --fit-background-mode scale \ + --font-path ../fonts \ + --output "../dist/${DIRECTORY_NAME}.pdf" \ + --stylesheets ../styles/style-light,tango \ + "${@}" + + popd + tree dist } function pdf:present { TALK_PATH=$1 shift 1 - pdfpc "${@}" "$TALK_PATH/$PDF_FILENAME" \ - --switch-screens -} - -function pdf:watch { - # Generate a new PDF file and watch for changes. - echo "TODO: pdf:watch" + pdfpc "${@}" "dist/${TALK_PATH}.pdf" --switch-screens } function thumbnail:generate { @@ -61,4 +53,5 @@ function thumbnail:generate { echo "TODO: thumbnail:generate" } -eval "${@:-help}" +TIMEFORMAT=$'\nTask completed in %3lR' +time "${@:-help}" diff --git a/styles/style-dark.yaml b/styles/style-dark.yaml new file mode 100644 index 0000000..791ce12 --- /dev/null +++ b/styles/style-dark.yaml @@ -0,0 +1,164 @@ +embeddedFonts: + - - Inconsolata.ttf + - Inconsolata.ttf + - Inconsolata.ttf + - Inconsolata.ttf + - - Helvetica.ttf + - Helvetica-Bold.ttf + - Helvetica.ttf + - Helvetica-Bold.ttf + +fontsAlias: + fontBold: Helvetica-Bold + fontFont: Helvetica + fontItalic: Helvetica + fontMono: Inconsolata + fontMonoBold: Inconsolata + fontMonoBoldItalic: Inconsolata + fontMonoItalic: Inconsolata + +linkColor: '#60a5fa' + +pageSetup: + firstTemplate: coverPage + height: 18cm + margin-bottom: 0cm + margin-gutter: 0cm + margin-left: 0cm + margin-right: 0cm + margin-top: 0cm + size: null + spacing-footer: 2mm + spacing-header: 2mm + width: 32cm + +pageTemplates: + coverPage: + background: ./images/bg-dark.png + frames: + - - 12% + - 10% + - 76% + - 75% + showFooter: false + showHeader: false + + imagePage: + alignment: TA_CENTER + background: ./images/bg-dark.png + frames: + - - 3% + - 3% + - 92% + - 92% + showFooter: true + showHeader: false + + outputPage: + background: ./images/bg-dark.png + frames: + - - 8% + - 10% + - 82% + - 65% + showFooter: false + showHeader: false + + standardPage: + background: ./images/bg-dark.png + frames: + - - 3% + - 3% + - 92% + - 92% + showFooter: true + showHeader: false + + titlePage: + alignment: TA_CENTER + background: ./images/bg-dark.png + frames: + - - 8% + - 8% + - 85% + - 65% + showFooter: true + showHeader: false + +styles: + bodytext: + alignment: TA_LEFT + + bullet-list: + colWidths: + - '20' + - null + commands: + - - LEFTPADDING + - - 0 + - 0 + - - 1 + - -1 + - 5 + - - RIGHTPADDING + - - 0 + - 0 + - - 1 + - -1 + - 0 + textColor: '#ffffff' + + bullet-list-item: + spaceAfter: 0 + spaceBefore: 18 + + centred: + alignment: TA_CENTER + parent: normal + + centredtitle: + alignment: TA_CENTER + fontName: fontBold + fontSize: 48 + leading: 64 + parent: heading + + code: + backColor: '#111111' + borderWidth: 0 + fontSize: 24 + leading: 26 + parent: literal + spaceBefore: 4 + + footer: + alignment: TA_RIGHT + fontName: fontMono + fontSize: 20 + rightIndent: 16 + spaceBefore: 0 + textColor: '#24608a' + + heading: + fontName: fontBold + fontSize: 20 + spaceAfter: 16 + textColor: '#60a5fa' + + literal: + backColor: '#111111' + fontName: fontMono + + normal: + fontSize: 24 + textColor: '#ffffff' + + title: + fontSize: 300% + parent: heading + + titleslideinfo: + alignment: TA_CENTER + fontSize: 140% + parent: normal + diff --git a/styles/style-light.yaml b/styles/style-light.yaml new file mode 100644 index 0000000..9dbb703 --- /dev/null +++ b/styles/style-light.yaml @@ -0,0 +1,157 @@ +embeddedFonts: + - - Inconsolata.ttf + - Inconsolata.ttf + - Inconsolata.ttf + - Inconsolata.ttf + - - Helvetica.ttf + - Helvetica-Bold.ttf + - Helvetica.ttf + - Helvetica-Bold.ttf + +fontsAlias: + fontBold: Helvetica-Bold + fontFont: Helvetica + fontItalic: Helvetica + fontMono: Inconsolata + fontMonoBold: Inconsolata + fontMonoBoldItalic: Inconsolata + fontMonoItalic: Inconsolata + +linkColor: '#24608a' + +pageSetup: + firstTemplate: coverPage + height: 18cm + margin-bottom: 0cm + margin-gutter: 0cm + margin-left: 0cm + margin-right: 0cm + margin-top: 0cm + size: null + spacing-footer: 2mm + spacing-header: 2mm + width: 32cm + +pageTemplates: + coverPage: + frames: + - - 12% + - 10% + - 76% + - 75% + showFooter: false + showHeader: false + + imagePage: + alignment: TA_CENTER + frames: + - - 3% + - 3% + - 92% + - 92% + showFooter: true + showHeader: false + + outputPage: + frames: + - - 8% + - 10% + - 82% + - 65% + showFooter: false + showHeader: false + + standardPage: + frames: + - - 3% + - 3% + - 92% + - 92% + showFooter: true + showHeader: false + + titlePage: + alignment: TA_CENTER + frames: + - - 8% + - 8% + - 85% + - 65% + showFooter: true + showHeader: false + +styles: + bodytext: + alignment: TA_LEFT + + bullet-list: + colWidths: + - '20' + - null + commands: + - - LEFTPADDING + - - 0 + - 0 + - - 1 + - -1 + - 5 + - - RIGHTPADDING + - - 0 + - 0 + - - 1 + - -1 + - 0 + textColor: '#aaaaaa' + + bullet-list-item: + spaceAfter: 0 + spaceBefore: 18 + + centred: + alignment: TA_CENTER + parent: normal + + centredtitle: + alignment: TA_CENTER + fontName: fontBold + fontSize: 48 + leading: 64 + parent: heading + + code: + backColor: white + borderWidth: 0 + fontSize: 22 + leading: 24 + parent: literal + spaceBefore: 0 + + footer: + alignment: TA_RIGHT + fontSize: 20 + rightIndent: 16 + spaceBefore: 0 + textColor: '#aaaaaa' + + heading: + fontName: fontBold + fontSize: 20 + spaceAfter: 16 + textColor: '#24608a' + + literal: + backColor: white + fontName: fontMono + + normal: + fontSize: 24 + textColor: '#383745' + + title: + fontSize: 300% + parent: heading + + titleslideinfo: + alignment: TA_CENTER + fontSize: 140% + parent: normal