presently 0.26.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57754e7cc66ec20e3ef797b20afbe147fda8979e96aafc14cdb9c35eaedb5495
4
- data.tar.gz: 242278bc2177efc35609ece981bb3f6cb5fed099e628894d6c8ed9dcf77ce020
3
+ metadata.gz: fc69b4f81a2143dbbccc8d591c1fb675bb447057b77ffde4420f1ad1d7b3819a
4
+ data.tar.gz: b49c223f245c7949d72d8510d41d59f3e43efd6eb33b22bfe931bc84c0e1473d
5
5
  SHA512:
6
- metadata.gz: 206d33b334f6d1ed9f4b7df2b328022bb5b332a43a53932840be6bd5c00a5b1a41d8df262b441309d04a17d0fc74bdf6120449f4ff1ec0f84228385856d3df9e
7
- data.tar.gz: 42f72ece55c0c02160fd12b90006651f0cd3cb1d2b4a95fa12516dbc1d88172652d76afd5639a3ff7c7b8edd6e57eb7d7ba6fb6a6303a90109bcff005aefdb2a
6
+ metadata.gz: '00686d6b384cdbbd81b27cc96e33e5301222c4b14a54c18f9221c2795f2b1eb0175ca4fbfc8caf10c3f2bb463df7ea85ba169b76b9b9e7c75049b419663b8be6'
7
+ data.tar.gz: d5348d5212bdde155fd4dcd7ea284606ff893716144fa8b04f202f3c18f0f18688431fe7ca59320c32c521baab047419b80170e31950fc57fe9dbcbaa545f95f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -188,173 +188,9 @@ The defaults are 1920×1080 at up to 30 frames per second. The exporter starts a
188
188
 
189
189
  ## Templates
190
190
 
191
- Templates define the visual layout of each slide. Select a template using the `template` field in the frontmatter.
191
+ Templates define the visual layout of each slide. Select one with the `template` field in the frontmatter; slides without it use `default`. Common choices include `title` for an opening slide, `two_column` for comparisons, and `code` for code walkthroughs.
192
192
 
193
- ### Default
194
-
195
- A general-purpose content slide. An H1 becomes the slide title and the remaining document becomes its body.
196
-
197
- ``` markdown
198
- ---
199
- template: default
200
- duration: 60
201
- ---
202
-
203
- # Key points
204
-
205
- - First point
206
- - Second point
207
- - Third point
208
- ```
209
-
210
- ### Title
211
-
212
- A large title with a short body, centered on the slide.
213
-
214
- ``` markdown
215
- ---
216
- template: title
217
- duration: 30
218
- ---
219
-
220
- # My Presentation Title
221
-
222
- A subtitle or tagline
223
- ```
224
-
225
- ### Section
226
-
227
- A section divider slide with a large heading, optional supporting body, and accent background.
228
-
229
- ``` markdown
230
- ---
231
- template: section
232
- duration: 15
233
- ---
234
-
235
- # Part Two
236
-
237
- Architecture and design
238
- ```
239
-
240
- ### Two Column
241
-
242
- A side-by-side layout with `left` and `right` sections.
243
-
244
- ``` markdown
245
- ---
246
- template: two_column
247
- duration: 90
248
- ---
249
-
250
- # Client and server responsibilities
251
-
252
- The application is split across two cooperating environments.
253
-
254
- ## Left
255
-
256
- **Server Side**
257
-
258
- - Ruby + Lively
259
- - WebSocket connections
260
-
261
- ## Right
262
-
263
- **Client Side**
264
-
265
- - Live DOM updates
266
- - CSS animations
267
- ```
268
-
269
- ### Code
270
-
271
- A syntax-highlighted code slide with optional focus regions for code walkthroughs. Use the `focus` frontmatter to specify which lines to highlight (1-based). Lines outside the focus range are dimmed, and the code scrolls to center the focused region.
272
-
273
- ``` markdown
274
- ---
275
- template: code
276
- duration: 60
277
- focus: 2-8
278
- ---
279
-
280
- # Constructor
281
-
282
- ```ruby
283
- class Presentation
284
- def initialize
285
- @slides = []
286
- @current_index = 0
287
- end
288
-
289
- def advance!
290
- @current_index += 1
291
- end
292
- end
293
- ​```
294
- ```
295
-
296
- Create animated walkthroughs by using multiple slides with the same code but different `focus` ranges. The transition between them smoothly scrolls and shifts the dim overlays.
297
-
298
- ### Statement
299
-
300
- A prominent statement or quote, centered on the slide. Supports an optional `## Translation` placeholder.
301
-
302
- ``` markdown
303
- ---
304
- template: statement
305
- duration: 30
306
- ---
307
-
308
- The best way to predict the future is to create it.
309
-
310
- ## Translation
311
-
312
- 未来を予測する最善の方法は、それを創ることである。
313
- ```
314
-
315
- ### Translations
316
-
317
- Templates can extract an optional `## Translation` section and position it independently from the main document. Every standard template displays it separately in a lighter style.
318
-
319
- ### Image
320
-
321
- A centered image with an optional caption.
322
-
323
- ``` markdown
324
- ---
325
- template: image
326
- duration: 30
327
- ---
328
-
329
- ![Architecture diagram](/images/architecture.png)
330
-
331
- ## Caption
332
-
333
- System architecture overview
334
- ```
335
-
336
- ### Diagram
337
-
338
- A centered canvas for diagrams and other custom visual layouts, with an optional title. A single grid or flex container is usually enough to create a diagram that remains centered as the slide scales:
339
-
340
- ``` markdown
341
- ---
342
- template: diagram
343
- duration: 60
344
- ---
345
-
346
- # Request lifecycle
347
-
348
- <div style="display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2em; width: 80%;">
349
- <div>Browser</div>
350
- <div>→</div>
351
- <div>Server</div>
352
- </div>
353
- ```
354
-
355
- For coordinate-based layouts, wrap the elements in `<div class="diagram-freeform">`. The wrapper fills the canvas and absolutely positions each direct child.
356
-
357
- All other templates also support absolutely positioned overlays since the slide container is `position: relative`. This lets you add callouts, badges, or annotations on top of any template's normal content.
193
+ See the [Templates guide](../templates/index) for built-in layouts, examples, translations, and custom templates.
358
194
 
359
195
  ## Transitions
360
196
 
@@ -400,35 +236,37 @@ The presenter view at `/presenter` provides:
400
236
  - **Progress bar** — visual indicator of time consumed for the current slide.
401
237
  - **Reload button** — reload slides from disk without restarting the server.
402
238
 
403
- ## Custom Templates
239
+ ### Starting the Timer from a Title Slide
404
240
 
405
- You can provide your own `.xrb` template files by configuring the templates root:
241
+ A title slide can stay on screen while the audience settles. Add `timer: start` to its frontmatter to start the presentation timer when you advance to the next slide:
406
242
 
407
- ``` ruby
408
- # In your environment configuration:
409
- service "presently" do
410
- include Presently::Environment::Application
243
+ ``` markdown
244
+ ---
245
+ template: title
246
+ duration: 0
247
+ timer: start
248
+ ---
411
249
 
412
- def templates_root
413
- File.expand_path("templates", self.root)
414
- end
415
- end
416
- ```
250
+ # My Presentation
417
251
 
418
- Templates receive a {ruby Presently::TemplateScope}. `self.slide_header` renders the semantic H1 title and optional section metadata, while `self.document` renders the remaining slide body. `self.extract(name)` removes an H2 placeholder with that exact heading text from the body and returns its rendered content. Extract placeholders before rendering the remaining document:
419
-
420
- ``` xrb
421
- <?r translation = self.extract("Translation") ?>
422
- #{self.slide_header}
423
- <div class="slide-body">
424
- #{self.document}
425
- </div>
426
- <?r if translation ?>
427
- <div class="slide-translation">#{translation}</div>
428
- <?r end ?>
252
+ We'll begin shortly.
429
253
  ```
430
254
 
431
- Extraction stops at the next heading of the same or a higher level, so lower-level headings remain inside the extracted fragment. Placeholder names are case-sensitive and must match the heading text exactly. Only placeholders requested by the template are removed; other headings remain ordinary document content.
255
+ The timer stays stopped while the title is displayed. Advancing from it in `/presenter` or `/display` starts the timer before showing the next slide. Setting `duration: 0` excludes the waiting slide from the expected presentation duration and pacing calculations. The `title` template itself does not control the timer.
256
+
257
+ Durations are read as floating-point seconds, including numeric strings. Negative, invalid, or non-finite values are treated as `0.0`. An unspecified or null duration defaults to `0.0` seconds, meaning no time has been allocated to that slide. Set explicit durations, or apply recorded narration durations, to establish a pacing schedule. When the total allocated duration is zero, the presenter shows elapsed time without pacing indicators, a progress bar, or a remaining-time estimate.
258
+
259
+ The `timer` field supports these actions:
260
+
261
+ | Value | Effect when advancing from this slide |
262
+ |---|---|
263
+ | `start` | Starts the timer only if it has never started. Revisiting the slide does not reset elapsed time or resume a manually paused timer. |
264
+ | `pause` | Pauses the timer, preserving elapsed time. Has no effect before the timer starts. |
265
+ | `resume` | Resumes a started timer, preserving elapsed time. Has no effect before the timer starts or while it is already running. |
266
+
267
+ For a break, put `timer: pause` on the slide immediately before the break slide, and `timer: resume` on the break slide itself. Give the break slide `duration: 0` to exclude the break from pacing calculations. Advancing into the break pauses timing; advancing out resumes it.
268
+
269
+ Timer actions run only when **Next** successfully moves to another slide. Going backwards, jumping directly to a slide, reloading, reconnecting, and restoring saved state do not trigger them. Neither does navigation in `/record`, or recorded playback. Slides without a recognized timer action leave the timer unchanged; the manual timer controls remain available.
432
270
 
433
271
  ## Customizing the Application
434
272
 
@@ -438,8 +276,8 @@ For advanced customization, create an `application.rb` and run with `presently a
438
276
  #!/usr/bin/env presently
439
277
 
440
278
  class Application < Presently::Application
441
- def title
442
- "My Conference Talk"
443
- end
279
+ def title
280
+ "My Conference Talk"
281
+ end
444
282
  end
445
283
  ```
data/context/index.yaml CHANGED
@@ -10,6 +10,10 @@ files:
10
10
  title: Getting Started
11
11
  description: This guide explains how to use `presently` to create and deliver web-based
12
12
  presentations using Markdown slides.
13
+ - path: templates.md
14
+ title: Templates
15
+ description: This guide explains how to choose slide templates and create custom
16
+ layouts in Presently.
13
17
  - path: animating-slides.md
14
18
  title: Animating Slides
15
19
  description: This guide explains how to animate content within slides using the
@@ -0,0 +1,207 @@
1
+ # Templates
2
+
3
+ This guide explains how to choose slide templates and create custom layouts in Presently.
4
+
5
+ ## Built-in Templates
6
+
7
+ Templates define the visual layout of each slide. Select a template using the `template` field in the frontmatter.
8
+
9
+ ### Default
10
+
11
+ A general-purpose content slide. An H1 becomes the slide title and the remaining document becomes its body.
12
+
13
+ ``` markdown
14
+ ---
15
+ template: default
16
+ duration: 60
17
+ ---
18
+
19
+ # Key points
20
+
21
+ - First point
22
+ - Second point
23
+ - Third point
24
+ ```
25
+
26
+ ### Title
27
+
28
+ A large title with a short body, centered on the slide.
29
+
30
+ ``` markdown
31
+ ---
32
+ template: title
33
+ duration: 30
34
+ ---
35
+
36
+ # My Presentation Title
37
+
38
+ A subtitle or tagline
39
+ ```
40
+
41
+ ### Section
42
+
43
+ A section divider slide with a large heading, optional supporting body, and accent background.
44
+
45
+ ``` markdown
46
+ ---
47
+ template: section
48
+ duration: 15
49
+ ---
50
+
51
+ # Part Two
52
+
53
+ Architecture and design
54
+ ```
55
+
56
+ ### Two Column
57
+
58
+ A side-by-side layout with `left` and `right` sections.
59
+
60
+ ``` markdown
61
+ ---
62
+ template: two_column
63
+ duration: 90
64
+ ---
65
+
66
+ # Client and server responsibilities
67
+
68
+ The application is split across two cooperating environments.
69
+
70
+ ## Left
71
+
72
+ **Server Side**
73
+
74
+ - Ruby + Lively
75
+ - WebSocket connections
76
+
77
+ ## Right
78
+
79
+ **Client Side**
80
+
81
+ - Live DOM updates
82
+ - CSS animations
83
+ ```
84
+
85
+ ### Code
86
+
87
+ A syntax-highlighted code slide with optional focus regions for code walkthroughs. Use the `focus` frontmatter to specify which lines to highlight (1-based). Lines outside the focus range are dimmed, and the code scrolls to center the focused region.
88
+
89
+ ```` markdown
90
+ ---
91
+ template: code
92
+ duration: 60
93
+ focus: 2-8
94
+ ---
95
+
96
+ # Constructor
97
+
98
+ ```ruby
99
+ class Presentation
100
+ def initialize
101
+ @slides = []
102
+ @current_index = 0
103
+ end
104
+
105
+ def advance!
106
+ @current_index += 1
107
+ end
108
+ end
109
+ ```
110
+ ````
111
+
112
+ Create animated walkthroughs by using multiple slides with the same code but different `focus` ranges. The transition between them smoothly scrolls and shifts the dim overlays.
113
+
114
+ ### Statement
115
+
116
+ A prominent statement or quote, centered on the slide. Supports an optional `## Translation` placeholder.
117
+
118
+ ``` markdown
119
+ ---
120
+ template: statement
121
+ duration: 30
122
+ ---
123
+
124
+ The best way to predict the future is to create it.
125
+
126
+ ## Translation
127
+
128
+ 未来を予測する最善の方法は、それを創ることである。
129
+ ```
130
+
131
+ ### Image
132
+
133
+ A centered image with an optional caption.
134
+
135
+ ``` markdown
136
+ ---
137
+ template: image
138
+ duration: 30
139
+ ---
140
+
141
+ ![Architecture diagram](/images/architecture.png)
142
+
143
+ ## Caption
144
+
145
+ System architecture overview
146
+ ```
147
+
148
+ ### Diagram
149
+
150
+ A centered canvas for diagrams and other custom visual layouts, with an optional title. A single grid or flex container is usually enough to create a diagram that remains centered as the slide scales:
151
+
152
+ ``` markdown
153
+ ---
154
+ template: diagram
155
+ duration: 60
156
+ ---
157
+
158
+ # Request lifecycle
159
+
160
+ <div style="display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2em; width: 80%;">
161
+ <div>Browser</div>
162
+ <div>→</div>
163
+ <div>Server</div>
164
+ </div>
165
+ ```
166
+
167
+ For coordinate-based layouts, wrap the elements in `<div class="diagram-freeform">`. The wrapper fills the canvas and absolutely positions each direct child.
168
+
169
+ All other templates also support absolutely positioned overlays since the slide container is `position: relative`. This lets you add callouts, badges, or annotations on top of any template's normal content.
170
+
171
+ ## Translations
172
+
173
+ Templates can extract an optional `## Translation` section and position it independently from the main document. Every standard template displays it separately in a lighter style.
174
+
175
+ ## Custom Templates
176
+
177
+ For layouts specific to your presentation, put `.xrb` files in a `templates/` directory alongside `slides/`. Presently searches this directory before its bundled templates, so you can add new layouts or override individual built-in templates.
178
+
179
+ To search additional directories, configure `templates_roots`, which returns an ordered array of paths:
180
+
181
+ ``` ruby
182
+ # In your environment configuration:
183
+ service "presently" do
184
+ include Presently::Environment::Application
185
+
186
+ def templates_roots
187
+ [File.expand_path("shared-templates", self.root)] + super
188
+ end
189
+ end
190
+ ```
191
+
192
+ For example, save the following template as `templates/custom.xrb` and select it with `template: custom` in a slide's frontmatter.
193
+
194
+ Templates receive a {ruby Presently::TemplateScope}. `self.slide_header` renders the semantic H1 title and optional section metadata, while `self.document` renders the remaining slide body. `self.extract(name)` removes an H2 placeholder with that exact heading text from the body and returns its rendered content. Extract placeholders before rendering the remaining document:
195
+
196
+ ``` xrb
197
+ <?r translation = self.extract("Translation") ?>
198
+ #{self.slide_header}
199
+ <div class="slide-body">
200
+ #{self.document}
201
+ </div>
202
+ <?r if translation ?>
203
+ <div class="slide-translation">#{translation}</div>
204
+ <?r end ?>
205
+ ```
206
+
207
+ Extraction stops at the next heading of the same or a higher level, so lower-level headings remain inside the extracted fragment. Placeholder names are case-sensitive and must match the heading text exactly. Only placeholders requested by the template are removed; other headings remain ordinary document content.
@@ -5,5 +5,5 @@
5
5
 
6
6
  # @namespace
7
7
  module Presently
8
- VERSION = "0.26.0"
8
+ VERSION = "0.26.1"
9
9
  end
data/readme.md CHANGED
@@ -26,6 +26,8 @@ Please see the [project documentation](https://socketry.github.io/presently/) fo
26
26
 
27
27
  - [Getting Started](https://socketry.github.io/presently/guides/getting-started/index) - This guide explains how to use `presently` to create and deliver web-based presentations using Markdown slides.
28
28
 
29
+ - [Templates](https://socketry.github.io/presently/guides/templates/index) - This guide explains how to choose slide templates and create custom layouts in Presently.
30
+
29
31
  - [Animating Slides](https://socketry.github.io/presently/guides/animating-slides/index) - This guide explains how to animate content within slides using the slide scripting system.
30
32
 
31
33
  - [Animated Diagrams](https://socketry.github.io/presently/guides/animated-diagrams/index) - This guide explains how to design responsive, lifecycle-safe animated diagrams in Presently using semantic markup, slide-specific CSS, and Anime.js choreography.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presently
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -122,6 +122,7 @@ files:
122
122
  - context/animating-slides.md
123
123
  - context/getting-started.md
124
124
  - context/index.yaml
125
+ - context/templates.md
125
126
  - lib/presently.rb
126
127
  - lib/presently/application.rb
127
128
  - lib/presently/clock.rb
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- [�����h���A�F�N=��"UO �yV��7�7� �DC�^�$�:�pn~�m�3@��I�1M�o4l�j�-< "f�7��WT&�u?k��B�{���*z�~�A�
2
- ���s�x���_:��u����x-��j�'-���/�u��r˃+��C/�9�H>�� ����MxW�F���P�
1
+ 2���$ZD����?bD�l��*��!(M�c�~�%��`|��&M
2
+ @R�(K������}��X�\Ϯ,-sϺ{%����'ߊ�^� ��$����N��`�/�X���!=�hkݯ�HZ
3
+ ^��#�<�h�h��A|��oe��G�B�ݕY��}s��+1 z6���� �L�5�)̄��� ��5�t���X7��|ӳDi]>Y�w�aަ���qf-�X+h��@�FĜb<��V�6Ӟ�]�����t����I�d��R� ݛ���>�!y�/�|��$N�&ҫ:�