presently 0.15.0 → 0.16.0
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/presently/rehearse.rb +8 -8
- data/bake/presently/slides.rb +4 -3
- data/context/getting-started.md +21 -1
- data/lib/presently/application.rb +2 -2
- data/lib/presently/export.rb +1 -1
- data/lib/presently/presentation.rb +30 -26
- data/lib/presently/presenter_view.rb +2 -2
- data/lib/presently/slide.rb +25 -11
- data/lib/presently/version.rb +1 -1
- data/readme.md +4 -4
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c2eaa843e93a1ef3f3c97b0e89c80a3ee4484ddbee4c105ca39bc7c324671ea
|
|
4
|
+
data.tar.gz: bc27aa664ca531b38da8b807e3fcb438a41c4338a180c1ddd39fc1daa0c549ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98959ac207c29fa8a4bf444e0d1e476e584183615d04abed09c8f74cda3a338ed61f9517f67d5e7e5bb40aa624c352100bf1c2f36c61663a81f61ec509fe52d8
|
|
7
|
+
data.tar.gz: 30ca2a30e72d1f0c0dbc71b31786349ecd8d8c70eae5d69f29e701e77cd2f39487909a71a4699b2be9b70169cc170065313da35e46394ab92d0b378f3849e38a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/bake/presently/rehearse.rb
CHANGED
|
@@ -21,8 +21,8 @@ end
|
|
|
21
21
|
#
|
|
22
22
|
# @parameter slides_root [String] The slides directory. Default: `slides`.
|
|
23
23
|
# @parameter speaker [String | Nil] Only rehearse slides for this speaker.
|
|
24
|
-
# @parameter from [String | Nil] Substring match — start at the first slide whose
|
|
25
|
-
# @parameter to [String | Nil] Substring match — stop after the first slide whose
|
|
24
|
+
# @parameter from [String | Nil] Substring match — start at the first slide whose relative path contains this.
|
|
25
|
+
# @parameter to [String | Nil] Substring match — stop after the first slide whose relative path contains this.
|
|
26
26
|
# @parameter resume [Boolean] Resume from the slide after the last one recorded in the log. Keeps prior records and appends new ones.
|
|
27
27
|
# @parameter log [String] Path to write the JSON log. Default: `tmp/rehearsal.json`.
|
|
28
28
|
def rehearse(slides_root: "slides", speaker: nil, from: nil, to: nil, resume: false, log: "tmp/rehearsal.json")
|
|
@@ -31,12 +31,12 @@ def rehearse(slides_root: "slides", speaker: nil, from: nil, to: nil, resume: fa
|
|
|
31
31
|
slides = slides.select{|slide| slide.speaker == speaker} if speaker
|
|
32
32
|
|
|
33
33
|
if from
|
|
34
|
-
start_index = slides.index{|slide|
|
|
34
|
+
start_index = slides.index{|slide| slide.path.include?(from)}
|
|
35
35
|
slides = slides[start_index..] if start_index
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
if to
|
|
39
|
-
end_index = slides.index{|slide|
|
|
39
|
+
end_index = slides.index{|slide| slide.path.include?(to)}
|
|
40
40
|
slides = slides[..end_index] if end_index
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ def rehearse(slides_root: "slides", speaker: nil, from: nil, to: nil, resume: fa
|
|
|
49
49
|
|
|
50
50
|
prior_records = JSON.parse(File.read(log), symbolize_names: true)
|
|
51
51
|
last_path = prior_records.last&.dig(:path)
|
|
52
|
-
resume_index = slides.index{|slide|
|
|
52
|
+
resume_index = slides.index{|slide| slide.path == last_path}
|
|
53
53
|
|
|
54
54
|
if resume_index.nil?
|
|
55
55
|
puts "Last rehearsed slide (#{last_path}) not found in current slide set. Nothing to resume."
|
|
@@ -81,14 +81,14 @@ def rehearse(slides_root: "slides", speaker: nil, from: nil, to: nil, resume: fa
|
|
|
81
81
|
records = []
|
|
82
82
|
offset = prior_records.length
|
|
83
83
|
slides.each_with_index do |slide, index|
|
|
84
|
-
|
|
84
|
+
relative_path = slide.path
|
|
85
85
|
headline = extract_headline(slide)
|
|
86
86
|
absolute = offset + index + 1
|
|
87
87
|
total = offset + slides.length
|
|
88
88
|
|
|
89
89
|
puts
|
|
90
90
|
puts "─" * 72
|
|
91
|
-
puts "[#{absolute}/#{total}] #{
|
|
91
|
+
puts "[#{absolute}/#{total}] #{relative_path} planned: #{format_duration(slide.duration)} speaker: #{slide.speaker || "—"}"
|
|
92
92
|
puts " #{headline}" unless headline.empty?
|
|
93
93
|
if slide.notes
|
|
94
94
|
notes = slide.notes.to_commonmark.strip
|
|
@@ -105,7 +105,7 @@ def rehearse(slides_root: "slides", speaker: nil, from: nil, to: nil, resume: fa
|
|
|
105
105
|
|
|
106
106
|
records << {
|
|
107
107
|
index: absolute,
|
|
108
|
-
path:
|
|
108
|
+
path: relative_path,
|
|
109
109
|
speaker: slide.speaker,
|
|
110
110
|
planned: slide.duration,
|
|
111
111
|
actual: elapsed.round(1),
|
data/bake/presently/slides.rb
CHANGED
|
@@ -58,7 +58,7 @@ def speakers(slides_root: "slides")
|
|
|
58
58
|
puts "#{speaker} — #{format_duration(total_seconds)}"
|
|
59
59
|
|
|
60
60
|
slides.each do |slide|
|
|
61
|
-
puts " #{format_duration(slide.duration)} #{slide.title} (#{
|
|
61
|
+
puts " #{format_duration(slide.duration)} #{slide.title} (#{slide.path})"
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
puts
|
|
@@ -69,9 +69,10 @@ end
|
|
|
69
69
|
|
|
70
70
|
# Renumber slide files sequentially with a consistent step size.
|
|
71
71
|
#
|
|
72
|
-
# Renames all `.md` files in the
|
|
72
|
+
# Renames all `.md` files directly in the given directory to have sequential
|
|
73
73
|
# numeric prefixes (010, 020, 030, ...), preserving their current order.
|
|
74
|
-
# The descriptive part of the filename (after the number prefix) is kept.
|
|
74
|
+
# The descriptive part of the filename (after the number prefix) is kept. It
|
|
75
|
+
# does not recurse; pass a nested directory as `slides_root` to renumber it.
|
|
75
76
|
#
|
|
76
77
|
# @parameter slides_root [String] The slides directory. Default: `slides`.
|
|
77
78
|
# @parameter step [Integer] The step between slide numbers. Default: `10`.
|
data/context/getting-started.md
CHANGED
|
@@ -32,7 +32,27 @@ $ mkdir slides
|
|
|
32
32
|
|
|
33
33
|
### Writing Slides
|
|
34
34
|
|
|
35
|
-
Each slide is a Markdown file in the `slides/` directory. Files are ordered
|
|
35
|
+
Each slide is a Markdown file in the `slides/` directory. Files are ordered by path, and every directory and slide filename must begin with a numeric prefix:
|
|
36
|
+
|
|
37
|
+
``` text
|
|
38
|
+
slides/
|
|
39
|
+
├── 010-welcome.md
|
|
40
|
+
├── 020-performance/
|
|
41
|
+
│ ├── 010-introduction.md
|
|
42
|
+
│ └── 020-results.md
|
|
43
|
+
└── 030-conclusion.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This allows related slides to be grouped in nested directories while retaining an unambiguous presentation order. Markdown files with any unnumbered path component, such as `slides/shared/example.md`, are not treated as slides and can be used for included content.
|
|
47
|
+
|
|
48
|
+
The `presently:slides:renumber` task only renumbers files directly inside the selected directory. Run it without arguments for the top-level slides, or pass a nested directory explicitly:
|
|
49
|
+
|
|
50
|
+
``` shell
|
|
51
|
+
$ bake presently:slides:renumber
|
|
52
|
+
$ bake presently:slides:renumber slides_root=slides/020-performance
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
A slide file contains Markdown with optional frontmatter and presenter notes:
|
|
36
56
|
|
|
37
57
|
``` markdown
|
|
38
58
|
---
|
|
@@ -49,7 +49,7 @@ module Presently
|
|
|
49
49
|
def controller
|
|
50
50
|
@controller ||= begin
|
|
51
51
|
templates = Templates.for(@templates_roots)
|
|
52
|
-
presentation = Presentation.load(@slides_root, templates
|
|
52
|
+
presentation = Presentation.load(@slides_root, templates)
|
|
53
53
|
|
|
54
54
|
PresentationController.new(presentation, state: State.new)
|
|
55
55
|
end
|
|
@@ -81,7 +81,7 @@ module Presently
|
|
|
81
81
|
|
|
82
82
|
if path == "/export"
|
|
83
83
|
options = Export.options_from_query(query)
|
|
84
|
-
presentation = Presentation.load(@slides_root,
|
|
84
|
+
presentation = Presentation.load(@slides_root, controller.templates)
|
|
85
85
|
export = Export.new(presentation: presentation, **options)
|
|
86
86
|
return Protocol::HTTP::Response[200, [["content-type", "text/html"]], [export.call]]
|
|
87
87
|
end
|
data/lib/presently/export.rb
CHANGED
|
@@ -9,40 +9,33 @@ require_relative "templates"
|
|
|
9
9
|
module Presently
|
|
10
10
|
# An immutable collection of slides with configuration.
|
|
11
11
|
#
|
|
12
|
-
# Use {.load} to create a presentation from a directory of Markdown files
|
|
13
|
-
#
|
|
12
|
+
# Use {.load} to create a presentation from a directory of Markdown files.
|
|
13
|
+
# Each loaded {Slide} is attached to its presentation and identified by a
|
|
14
|
+
# path relative to the presentation root.
|
|
14
15
|
class Presentation
|
|
15
|
-
# Load and sort slide files from a directory.
|
|
16
|
-
# @parameter slides_root [String] The directory containing `.md` slide files.
|
|
17
|
-
# @returns [Array(Slide)] The loaded, sorted, non-skipped slides.
|
|
18
|
-
def self.slides_from(slides_root)
|
|
19
|
-
Dir.glob(File.join(slides_root, "*.md")).sort.map{|path| Slide.load(path)}.reject(&:skip?)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
16
|
# Load a presentation from a directory of Markdown slide files.
|
|
23
|
-
# @parameter
|
|
24
|
-
# @parameter
|
|
17
|
+
# @parameter root [String] The directory containing `.md` slide files.
|
|
18
|
+
# @parameter templates [Templates] The template resolver for loading slide templates.
|
|
25
19
|
# @returns [Presentation] A new presentation with slides loaded from the directory.
|
|
26
|
-
def self.load(
|
|
27
|
-
new(
|
|
20
|
+
def self.load(root = "slides", templates = Templates.for)
|
|
21
|
+
new(root, templates)
|
|
28
22
|
end
|
|
29
23
|
|
|
30
24
|
# Initialize a new presentation.
|
|
31
|
-
# @parameter
|
|
32
|
-
# @parameter slides_root [String | Nil] The directory slides were loaded from, used by {#reload}.
|
|
25
|
+
# @parameter root [String] The root directory containing slide files.
|
|
33
26
|
# @parameter templates [Templates] The template resolver for loading slide templates.
|
|
34
|
-
def initialize(
|
|
35
|
-
@
|
|
36
|
-
@slides_root = slides_root
|
|
27
|
+
def initialize(root = "slides", templates = Templates.for)
|
|
28
|
+
@root = File.expand_path(root)
|
|
37
29
|
@templates = templates
|
|
30
|
+
@slides = load_slides
|
|
38
31
|
end
|
|
39
32
|
|
|
33
|
+
# @attribute [String] The absolute root directory containing slide files.
|
|
34
|
+
attr :root
|
|
35
|
+
|
|
40
36
|
# @attribute [Array(Slide)] The ordered list of slides.
|
|
41
37
|
attr :slides
|
|
42
38
|
|
|
43
|
-
# @attribute [String | Nil] The directory slides were loaded from.
|
|
44
|
-
attr :slides_root
|
|
45
|
-
|
|
46
39
|
# @attribute [Templates] The template resolver.
|
|
47
40
|
attr :templates
|
|
48
41
|
|
|
@@ -66,12 +59,23 @@ module Presently
|
|
|
66
59
|
end
|
|
67
60
|
|
|
68
61
|
# Return a new {Presentation} with freshly loaded slides and a cleared template cache.
|
|
69
|
-
#
|
|
70
|
-
# @returns [Presentation] A new presentation instance, or `self` if no slides root is set.
|
|
62
|
+
# @returns [Presentation] A new presentation instance.
|
|
71
63
|
def reload
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
self.class.new(@root, @templates.reload)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
# Load slides recursively in relative path order.
|
|
70
|
+
# @returns [Array(Slide)] The loaded, sorted, non-skipped slides.
|
|
71
|
+
def load_slides
|
|
72
|
+
Dir.glob("**/*.md", base: @root).sort.filter_map do |path|
|
|
73
|
+
components = path.split(File::SEPARATOR)
|
|
74
|
+
next unless components.all?{|component| component.match?(/\A\d/)}
|
|
75
|
+
|
|
76
|
+
slide = Slide.load(self, path)
|
|
77
|
+
slide unless slide.skip?
|
|
78
|
+
end
|
|
75
79
|
end
|
|
76
80
|
end
|
|
77
81
|
end
|
|
@@ -204,10 +204,10 @@ module Presently
|
|
|
204
204
|
if slide
|
|
205
205
|
builder.text(" · ")
|
|
206
206
|
builder.tag(:code, class: "slide-path") do
|
|
207
|
-
builder.text(
|
|
207
|
+
builder.text(slide.path)
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
if editor_url = editor_url_for(slide.
|
|
210
|
+
if editor_url = editor_url_for(slide.source_path)
|
|
211
211
|
builder.tag(:a, href: editor_url, class: "edit-link") do
|
|
212
212
|
builder.text("✎")
|
|
213
213
|
end
|
data/lib/presently/slide.rb
CHANGED
|
@@ -61,15 +61,17 @@ module Presently
|
|
|
61
61
|
module_function
|
|
62
62
|
|
|
63
63
|
# Parse the file and return a {Slide}.
|
|
64
|
-
# @parameter
|
|
64
|
+
# @parameter presentation [Presentation] The presentation which owns the slide.
|
|
65
|
+
# @parameter path [String] The slide path relative to the presentation root.
|
|
65
66
|
# @returns [Slide]
|
|
66
|
-
def load(path)
|
|
67
|
-
|
|
67
|
+
def load(presentation, path)
|
|
68
|
+
source_path = File.join(presentation.root, path)
|
|
69
|
+
raw = File.read(source_path)
|
|
68
70
|
|
|
69
71
|
# Parse once, with native front matter support.
|
|
70
72
|
document = Markly.parse(raw, flags: Markly::UNSAFE | Markly::FRONT_MATTER, extensions: Fragment::EXTENSIONS)
|
|
71
73
|
|
|
72
|
-
expand_includes!(document, File.dirname(
|
|
74
|
+
expand_includes!(document, File.dirname(source_path))
|
|
73
75
|
|
|
74
76
|
# Extract front matter from the first AST node if present.
|
|
75
77
|
front_matter = nil
|
|
@@ -111,7 +113,7 @@ module Presently
|
|
|
111
113
|
script = nil
|
|
112
114
|
end
|
|
113
115
|
|
|
114
|
-
Slide.new(path, front_matter: front_matter, content: content, notes: notes, script: script)
|
|
116
|
+
Slide.new(presentation, path, front_matter: front_matter, content: content, notes: notes, script: script)
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
# Expand `![[path/to/file.md]]` include directives in a parsed document.
|
|
@@ -183,19 +185,22 @@ module Presently
|
|
|
183
185
|
end
|
|
184
186
|
|
|
185
187
|
# Load and parse a slide from a Markdown file.
|
|
186
|
-
# @parameter
|
|
188
|
+
# @parameter presentation [Presentation] The presentation which owns the slide.
|
|
189
|
+
# @parameter path [String] The slide path relative to the presentation root.
|
|
187
190
|
# @returns [Slide]
|
|
188
|
-
def self.load(path)
|
|
189
|
-
Parser.load(path)
|
|
191
|
+
def self.load(presentation, path)
|
|
192
|
+
Parser.load(presentation, path)
|
|
190
193
|
end
|
|
191
194
|
|
|
192
195
|
# Initialize a slide with pre-parsed data.
|
|
193
|
-
# @parameter
|
|
196
|
+
# @parameter presentation [Presentation] The presentation which owns the slide.
|
|
197
|
+
# @parameter path [String] The slide path relative to the presentation root.
|
|
194
198
|
# @parameter front_matter [Hash | Nil] The parsed YAML front_matter.
|
|
195
199
|
# @parameter content [Hash(String, Fragment)] Content sections keyed by heading name.
|
|
196
200
|
# @parameter notes [Fragment | Nil] The presenter notes as a Markly AST fragment.
|
|
197
201
|
# @parameter script [String | Nil] JavaScript to execute after the slide renders.
|
|
198
|
-
def initialize(path, front_matter: nil, content: {}, notes: nil, script: nil)
|
|
202
|
+
def initialize(presentation, path, front_matter: nil, content: {}, notes: nil, script: nil)
|
|
203
|
+
@presentation = presentation
|
|
199
204
|
@path = path
|
|
200
205
|
@front_matter = front_matter
|
|
201
206
|
@content = content
|
|
@@ -203,9 +208,18 @@ module Presently
|
|
|
203
208
|
@script = script
|
|
204
209
|
end
|
|
205
210
|
|
|
206
|
-
# @attribute [
|
|
211
|
+
# @attribute [Presentation] The presentation which owns the slide.
|
|
212
|
+
attr :presentation
|
|
213
|
+
|
|
214
|
+
# @attribute [String] The slide path relative to the presentation root.
|
|
207
215
|
attr :path
|
|
208
216
|
|
|
217
|
+
# The absolute path of the slide source file.
|
|
218
|
+
# @returns [String]
|
|
219
|
+
def source_path
|
|
220
|
+
File.join(@presentation.root, @path)
|
|
221
|
+
end
|
|
222
|
+
|
|
209
223
|
# @attribute [Hash | Nil] The parsed YAML front_matter.
|
|
210
224
|
attr :front_matter
|
|
211
225
|
|
data/lib/presently/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -29,6 +29,10 @@ Please see the [project documentation](https://socketry.github.io/presently/) fo
|
|
|
29
29
|
|
|
30
30
|
Please see the [project releases](https://socketry.github.io/presently/releases/index) for all releases.
|
|
31
31
|
|
|
32
|
+
### v0.16.0
|
|
33
|
+
|
|
34
|
+
- Add support for organizing slides in nested directories. Every directory and slide filename must begin with a numeric prefix, and slides are ordered by relative path.
|
|
35
|
+
|
|
32
36
|
### v0.15.0
|
|
33
37
|
|
|
34
38
|
q
|
|
@@ -80,10 +84,6 @@ q
|
|
|
80
84
|
- Add `Slide#setTimeout(callback, delay)` — a tracked replacement for the global `setTimeout`. All timeouts registered this way are automatically cancelled when the slide changes, preventing stale callbacks from firing after navigation. The global `setTimeout` in slide scripts is shadowed by this method automatically.
|
|
81
85
|
- Add `Slide#cancelTimeouts()` — cancels all pending timeouts registered by the slide's script. Called automatically by the presentation engine on every slide change.
|
|
82
86
|
|
|
83
|
-
### v0.6.0
|
|
84
|
-
|
|
85
|
-
- Add `bake presently:slides:speakers` task to print a timing breakdown grouped by speaker. Each speaker's slides are listed in presentation order with individual and total durations, making it easy to balance talk time in multi-speaker presentations. Slides without a `speaker` key are grouped under `(no speaker)`.
|
|
86
|
-
|
|
87
87
|
## See Also
|
|
88
88
|
|
|
89
89
|
- [lively](https://github.com/socketry/lively) — The real-time application framework that powers Presently.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|