Class: Revealize::MarkdownSlide::Slide
- Inherits:
-
Struct
- Object
- Struct
- Revealize::MarkdownSlide::Slide
- Defined in:
- lib/revealize/slide.rb
Instance Attribute Summary collapse
-
#raw_content ⇒ Object
Returns the value of attribute raw_content.
-
#rendered_markdown ⇒ Object
readonly
Returns the value of attribute rendered_markdown.
Instance Method Summary collapse
- #content_without_preamble ⇒ Object
- #render ⇒ Object
- #render_markdown ⇒ Object
- #section_options ⇒ Object
Instance Attribute Details
#raw_content ⇒ Object
Returns the value of attribute raw_content
17 18 19 |
# File 'lib/revealize/slide.rb', line 17 def raw_content @raw_content end |
#rendered_markdown ⇒ Object (readonly)
Returns the value of attribute rendered_markdown.
18 19 20 |
# File 'lib/revealize/slide.rb', line 18 def rendered_markdown @rendered_markdown end |
Instance Method Details
#content_without_preamble ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/revealize/slide.rb', line 28 def content_without_preamble return raw_content unless raw_content.start_with?("---") raw_content = self.raw_content.sub("---\n", '') pre_amble, content = raw_content.split("---\n") = YAML.load(pre_amble) return content end |
#render ⇒ Object
19 20 21 22 |
# File 'lib/revealize/slide.rb', line 19 def render render_markdown Haml::Engine.new("%section#{section_options}\n =rendered_markdown").render(self) end |
#render_markdown ⇒ Object
24 25 26 |
# File 'lib/revealize/slide.rb', line 24 def render_markdown @rendered_markdown = Kramdown::Document.new(content_without_preamble, :auto_ids => false).to_html end |
#section_options ⇒ Object
36 37 38 39 |
# File 'lib/revealize/slide.rb', line 36 def return '' unless return %Q{(#{@options.to_a.map {|option| "data-#{ option.first }='#{option.last}'" }.join(' ')})} end |