Class: Presently::TemplateScope
- Inherits:
-
Object
- Object
- Presently::TemplateScope
- Defined in:
- lib/presently/slide_renderer.rb
Overview
Provides the scope for XRB template rendering.
Templates access slide content via ‘self.section(name)` and slide metadata via `self.slide`.
Instance Attribute Summary collapse
-
#slide ⇒ Object
readonly
Returns the value of attribute slide.
Instance Method Summary collapse
-
#content ⇒ Object
The content sections of the slide.
-
#initialize(slide) ⇒ TemplateScope
constructor
Initialize a new template scope for the given slide.
-
#section(name) ⇒ Object
Get a named content section as raw HTML markup.
-
#section?(name) ⇒ Boolean
Whether the named content section exists and has content.
- #The slide being rendered.=(slidebeingrendered. = (value)) ⇒ Object
Constructor Details
#initialize(slide) ⇒ TemplateScope
Initialize a new template scope for the given slide.
54 55 56 |
# File 'lib/presently/slide_renderer.rb', line 54 def initialize() @slide = end |
Instance Attribute Details
#slide ⇒ Object (readonly)
Returns the value of attribute slide.
59 60 61 |
# File 'lib/presently/slide_renderer.rb', line 59 def @slide end |
Instance Method Details
#content ⇒ Object
The content sections of the slide.
63 64 65 |
# File 'lib/presently/slide_renderer.rb', line 63 def content @slide.content end |
#section(name) ⇒ Object
Get a named content section as raw HTML markup.
78 79 80 |
# File 'lib/presently/slide_renderer.rb', line 78 def section(name) XRB::MarkupString.raw(@slide.content[name]&.to_html || "") end |
#section?(name) ⇒ Boolean
Whether the named content section exists and has content.
70 71 72 73 |
# File 'lib/presently/slide_renderer.rb', line 70 def section?(name) fragment = @slide.content[name] fragment && !fragment.empty? end |
#The slide being rendered.=(slidebeingrendered. = (value)) ⇒ Object
59 |
# File 'lib/presently/slide_renderer.rb', line 59 attr :slide |