Add rst2pdf slides

This commit is contained in:
Oliver Davies 2021-01-28 11:33:56 +00:00
parent c78138b63d
commit d409742cfe
15 changed files with 384 additions and 0 deletions

View file

@ -0,0 +1,4 @@
Building and presenting slide decks with rst2pdf
################################################
https://www.oliverdavies.uk/talks/building-presenting-slide-decks-rst2pdf

View file

@ -0,0 +1,12 @@
rst2pdf slides.rst
rst2pdf slides.rst --break-level 1 --stylesheets main
rst2pdf slides.rst \
--output slides.pdf \
--stylesheets main \
--break-level 1 \
--fit-background-mode scale \
--extension-module preprocess

View file

@ -0,0 +1,4 @@
.. code-block:: javascript
:include: code/additional-config-options.txt
:hl_lines: 2 3 4
:linenos:

View file

@ -0,0 +1 @@
.. include:: sections/intro.rst

View file

@ -0,0 +1,3 @@
.. raw:: pdf
PageBreak standardPage

View file

@ -0,0 +1,6 @@
pageTemplates:
standardPage:
frames: []
[3%, 3%, 92%, 92%]
showFooter: true
showHeader: false

View file

@ -0,0 +1,29 @@
linkColor: #24608a
styles:
normal:
fontSize: 24
leading: 32
textColor: #383745
bodytext:
alignment: TA_LEFT
heading:
fontSize: 20
spaceAfter: 16
textColor: #24608a
title:
fontSize: 300%
parent: heading
textColor: white
bullet-list:
commands: []
[LEFTPADDING, [0, 0], [1, -1], 10]
[RIGHTPADDING, [0, 0], [1, -1], 0]
[VALIGN, [0, 0], [-1, -1], TOP]
colWidths: ["20", null]
textColor: #aaaaaa

View file

@ -0,0 +1,14 @@
Building and presenting slide decks with rst2pdf
################################################
.. class:: titleslideinfo
Oliver Davies (@opdavies)
What is rst2pdf?
================
* "Use a text editor. Make a PDF."
* reStructuredText to PDF
* Each slide is a page

View file

@ -0,0 +1,14 @@
.. image:: images/editing.png
:width: 20cm
.. code-block:: php
:startinline: true
:linenos:
echo 'Hello world!';
.. raw:: pdf
TextAnnotation "This is a speaker note."

View file

@ -0,0 +1,8 @@
nodemon --ext rst,style,txt --exec "
rst2pdf slides.rst \
--output slides.pdf \
--stylesheets main \
--break-level 1 \
--fit-background-mode scale \
--extension-module preprocess
"

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View file

@ -0,0 +1,122 @@
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/title.png
frames: []
[12%, 10%, 76%, 75%]
showFooter: false
showHeader: false
titlePage:
alignment: TA_CENTER
frames: []
[8%, 8%, 85%, 65%]
showFooter: true
showHeader: false
standardPage:
frames: []
[3%, 3%, 92%, 92%]
showFooter: true
showHeader: false
imagePage:
alignment: TA_CENTER
frames: []
[12%, 10%, 76%, 80%]
showFooter: true
showHeader: false
outputPage:
frames: []
[8%, 10%, 82%, 65%]
showFooter: false
showHeader: false
linkColor: #24608a
styles:
normal:
fontSize: 24
leading: 32
textColor: #383745
bodytext:
alignment: TA_LEFT
heading:
fontSize: 20
spaceAfter: 16
textColor: #24608a
title:
fontSize: 300%
parent: heading
bullet-list:
commands: []
[LEFTPADDING, [0, 0], [1, -1], 10]
[RIGHTPADDING, [0, 0], [1, -1], 0]
[VALIGN, [0, 0], [-1, -1], TOP]
colWidths: ["20", null]
textColor: #aaaaaa
bullet-list-item:
spaceBefore: 14
spaceAfter: 0
titleslideinfo:
alignment: TA_CENTER
fontSize: 140%
parent: normal
footer:
alignment: TA_RIGHT
fontName: stdMono
fontSize: 20
textColor: #24608a
rightIndent: 16
spaceBefore: 0
literal:
backColor: #eeeeee
fontName: stdMono
code:
backColor: #eeeeee
borderWidth: 0
fontSize: 20
leading: 24
parent: literal
spaceBefore: 4
blockquote:
parent: normal
fontName: stdItalic
leading: 36
attribution:
parent: normal
textColor: #66666
centered:
alignment: TA_CENTER
centredtitle:
alignment: TA_CENTER
fontName: stdBold
fontSize: 48
leading: 64
parent: heading

View file

@ -0,0 +1,167 @@
.. footer:: @opdavies
Building and presenting slide decks with rst2pdf
################################################
|
.. class:: titleslideinfo
Oliver Davies (@opdavies)
.. raw:: pdf
TextAnnotation "Gave my first talk in 2012."
TextAnnotation "A talk about a tool (rst2pdf) that I've been using for the last couple of talks."
.. page:: standardPage
What have I used before?
========================
* **UI based:** Keynote, Google Slides, slides.com
* **HTML/JavaScript:** reveal.js
* **Markdown:** Deckset, Marp, reveal-md
What is rst2pdf?
================
* "Use a text editor. Make a PDF."
* reStructuredText to PDF
* Each slide is a page
* Page templates for layouts
* Not just for slide decks
* Table of contents, page numbers, headers, footers
.. raw:: pdf
TextAnnotation "Use the tools you're familiar with."
TextAnnotation "Similar to Markdown."
TextAnnotation "Primarily used for technical documentation within the Python community."
TextAnnotation "Now maintained by PHPers Rob Allen and Lorna Jane Mitchell."
TextAnnotation "Breaks at titles automatically, or you can add manual page breaks."
Advantages
==========
* Easy to start a new presentation, or update an existing one
* Version controllable
* Portable
* Content is searchable
* Easy to re-use content and/or styling
* Slides uploaded to SpeakerDeck straight away
.. page:: imagePage
.. image:: images/editing.png
:width: 23cm
.. page:: standardPage
Useful reStructuredText
=======================
.. code-block:: rst
:include: code/useful-rst-1.txt
:linenos:
Useful reStructuredText
=======================
.. code-block:: rst
:include: code/useful-rst-2.txt
:linenos:
Page Templates
==============
main.style:
.. code-block:: yaml
:include: code/page-templates-style.txt
slides.rst:
.. code-block:: rst
:include: code/page-templates-rst.txt
Keeping things organised
========================
Split slides into different sections:
.. code-block:: rst
:include: code/includes-sections.txt
|
Including code snippets from separate files:
.. code-block:: rst
:include: code/includes-code.txt
.. raw:: pdf
TextAnnotation "Includes!"
Styling
=======
.. code-block:: yaml
:include: code/styling.txt
:linenos:
Building
========
.. code-block::
:include: code/building.txt
Watching
========
Re-compiling when something changes.
|
.. code-block:: bash
:include: code/watching.txt
Presenting
==========
``pdfpc`` - PDF presenter console
|
.. code-block::
pdfpc slides.pdf
.. page:: imagePage
.. image:: images/pdfpc-1.png
:width: 23cm
.. page::
.. image:: images/pdfpc-2.png
:width: 23cm
.. page:: standardPage
Thanks!
=======
References:
* https://rst2pdf.org
* https://github.com/rst2pdf/rst2pdf
* https://github.com/opdavies/talks
* https://oliverdavies.link/lorna-rst2pdf-talk
|
Me:
* https://www.oliverdavies.uk