Class: Presently::Slide
- Inherits:
-
Object
- Object
- Presently::Slide
- Defined in:
- lib/presently/slide.rb
Overview
A single slide parsed from a Markdown file.
Each slide has YAML front_matter for metadata (template, duration, focus), content sections split by Markdown headings, and optional presenter notes separated by ‘—`.
Defined Under Namespace
Modules: Parser Classes: Fragment
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#front_matter ⇒ Object
readonly
Returns the value of attribute front_matter.
- #JavaScript to execute after the slide renders on the display.(toexecuteafterthesliderendersonthedisplay.) ⇒ Object readonly
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
- #The content sections keyed by heading name.(contentsectionskeyedbyheadingname.) ⇒ Object readonly
- #The file path of the slide.(filepathoftheslide.) ⇒ Object readonly
- #The presenter notes as a Markly AST fragment.(presenternotesasaMarklyASTfragment.) ⇒ Object readonly
Class Method Summary collapse
-
.load(path) ⇒ Object
Load and parse a slide from a Markdown file.
Instance Method Summary collapse
-
#duration ⇒ Object
The expected duration of this slide in seconds.
-
#focus ⇒ Object
The line range to focus on for code slides.
-
#initialize(path, front_matter: nil, content: {}, notes: nil, script: nil) ⇒ Slide
constructor
Initialize a slide with pre-parsed data.
-
#marker ⇒ Object
The navigation marker for this slide, used in the presenter’s jump-to dropdown.
-
#skip? ⇒ Boolean
Whether this slide should be skipped in the presentation.
-
#speaker ⇒ Object
The name of the speaker presenting this slide.
-
#template ⇒ Object
The template to use for rendering this slide.
- #The parsed YAML front_matter.=(parsedYAMLfront_matter. = (value)) ⇒ Object
-
#title ⇒ Object
The title of this slide.
-
#transition ⇒ Object
The transition type for animating into this slide.
Constructor Details
#initialize(path, front_matter: nil, content: {}, notes: nil, script: nil) ⇒ Slide
Initialize a slide with pre-parsed data.
157 158 159 160 161 162 163 |
# File 'lib/presently/slide.rb', line 157 def initialize(path, front_matter: nil, content: {}, notes: nil, script: nil) @path = path @front_matter = front_matter @content = content @notes = notes @script = script end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
172 173 174 |
# File 'lib/presently/slide.rb', line 172 def content @content end |
#front_matter ⇒ Object (readonly)
Returns the value of attribute front_matter.
169 170 171 |
# File 'lib/presently/slide.rb', line 169 def front_matter @front_matter end |
#JavaScript to execute after the slide renders on the display.(toexecuteafterthesliderendersonthedisplay.) ⇒ Object (readonly)
178 |
# File 'lib/presently/slide.rb', line 178 attr :script |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
175 176 177 |
# File 'lib/presently/slide.rb', line 175 def notes @notes end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
166 167 168 |
# File 'lib/presently/slide.rb', line 166 def path @path end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
178 179 180 |
# File 'lib/presently/slide.rb', line 178 def script @script end |
#The content sections keyed by heading name.(contentsectionskeyedbyheadingname.) ⇒ Object (readonly)
172 |
# File 'lib/presently/slide.rb', line 172 attr :content |
#The file path of the slide.(filepathoftheslide.) ⇒ Object (readonly)
166 |
# File 'lib/presently/slide.rb', line 166 attr :path |
#The presenter notes as a Markly AST fragment.(presenternotesasaMarklyASTfragment.) ⇒ Object (readonly)
175 |
# File 'lib/presently/slide.rb', line 175 attr :notes |
Class Method Details
Instance Method Details
#duration ⇒ Object
The expected duration of this slide in seconds.
188 189 190 |
# File 'lib/presently/slide.rb', line 188 def duration @front_matter&.fetch("duration", 60) || 60 end |
#focus ⇒ Object
The line range to focus on for code slides.
224 225 226 227 228 229 |
# File 'lib/presently/slide.rb', line 224 def focus if range = @front_matter&.fetch("focus", nil) parts = range.to_s.split("-").map(&:to_i) parts.length == 2 ? parts : nil end end |
#marker ⇒ Object
The navigation marker for this slide, used in the presenter’s jump-to dropdown.
206 207 208 |
# File 'lib/presently/slide.rb', line 206 def marker @front_matter&.fetch("marker", nil) end |
#skip? ⇒ Boolean
Whether this slide should be skipped in the presentation.
200 201 202 |
# File 'lib/presently/slide.rb', line 200 def skip? @front_matter&.fetch("skip", false) || false end |
#speaker ⇒ Object
The name of the speaker presenting this slide.
218 219 220 |
# File 'lib/presently/slide.rb', line 218 def speaker @front_matter&.fetch("speaker", nil) end |
#template ⇒ Object
The template to use for rendering this slide.
182 183 184 |
# File 'lib/presently/slide.rb', line 182 def template @front_matter&.fetch("template", "default") || "default" end |
#The parsed YAML front_matter.=(parsedYAMLfront_matter. = (value)) ⇒ Object
169 |
# File 'lib/presently/slide.rb', line 169 attr :front_matter |
#title ⇒ Object
The title of this slide.
194 195 196 |
# File 'lib/presently/slide.rb', line 194 def title @front_matter&.fetch("title", File.basename(@path, ".md")) || File.basename(@path, ".md") end |
#transition ⇒ Object
The transition type for animating into this slide.
212 213 214 |
# File 'lib/presently/slide.rb', line 212 def transition @front_matter&.fetch("transition", nil) end |