Add rst2pdf slides
This commit is contained in:
parent
c78138b63d
commit
d409742cfe
15 changed files with 384 additions and 0 deletions
4
building-presenting-slide-decks-rst2pdf/README.rst
Normal file
4
building-presenting-slide-decks-rst2pdf/README.rst
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Building and presenting slide decks with rst2pdf
|
||||||
|
################################################
|
||||||
|
|
||||||
|
https://www.oliverdavies.uk/talks/building-presenting-slide-decks-rst2pdf
|
12
building-presenting-slide-decks-rst2pdf/code/building.txt
Normal file
12
building-presenting-slide-decks-rst2pdf/code/building.txt
Normal 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
|
|
@ -0,0 +1,4 @@
|
||||||
|
.. code-block:: javascript
|
||||||
|
:include: code/additional-config-options.txt
|
||||||
|
:hl_lines: 2 3 4
|
||||||
|
:linenos:
|
|
@ -0,0 +1 @@
|
||||||
|
.. include:: sections/intro.rst
|
|
@ -0,0 +1,3 @@
|
||||||
|
.. raw:: pdf
|
||||||
|
|
||||||
|
PageBreak standardPage
|
|
@ -0,0 +1,6 @@
|
||||||
|
pageTemplates:
|
||||||
|
standardPage:
|
||||||
|
frames: []
|
||||||
|
[3%, 3%, 92%, 92%]
|
||||||
|
showFooter: true
|
||||||
|
showHeader: false
|
29
building-presenting-slide-decks-rst2pdf/code/styling.txt
Normal file
29
building-presenting-slide-decks-rst2pdf/code/styling.txt
Normal 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
|
||||||
|
|
|
@ -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
|
|
@ -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."
|
|
@ -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
|
||||||
|
"
|
BIN
building-presenting-slide-decks-rst2pdf/images/editing.png
Normal file
BIN
building-presenting-slide-decks-rst2pdf/images/editing.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 225 KiB |
BIN
building-presenting-slide-decks-rst2pdf/images/pdfpc-1.png
Normal file
BIN
building-presenting-slide-decks-rst2pdf/images/pdfpc-1.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 71 KiB |
BIN
building-presenting-slide-decks-rst2pdf/images/pdfpc-2.png
Normal file
BIN
building-presenting-slide-decks-rst2pdf/images/pdfpc-2.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 119 KiB |
122
building-presenting-slide-decks-rst2pdf/main.style
Normal file
122
building-presenting-slide-decks-rst2pdf/main.style
Normal 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
|
167
building-presenting-slide-decks-rst2pdf/slides.rst
Normal file
167
building-presenting-slide-decks-rst2pdf/slides.rst
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue