Class: Kramdown::Parser::Slider
- Inherits:
-
Kramdown
- Object
- Kramdown
- Kramdown::Parser::Slider
- Defined in:
- lib/slideshift/tool/render/markdown.rb
Overview
ToDo: clean up!
Instance Method Summary collapse
-
#initialize(source, options) ⇒ Slider
constructor
A new instance of Slider.
- #parse_slide_tag ⇒ Object
- #parse_syntax_tag ⇒ Object
Constructor Details
#initialize(source, options) ⇒ Slider
Returns a new instance of Slider.
9 10 11 12 13 |
# File 'lib/slideshift/tool/render/markdown.rb', line 9 def initialize(source, ) super @block_parsers.unshift(:syntax_tag) @block_parsers.unshift(:slide_tag) end |
Instance Method Details
#parse_slide_tag ⇒ Object
24 25 26 27 |
# File 'lib/slideshift/tool/render/markdown.rb', line 24 def @src.pos += @src.matched_size @tree.children << Element.new(:raw, '</section><section class="slide">') end |
#parse_syntax_tag ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/slideshift/tool/render/markdown.rb', line 15 def parse_syntax_tag match = /^```(\w+)\n(.*)\n```$/m.match(@src.matched) @src.pos += @src.matched_size code = Pygments.highlight(match[2], :lexer => match[1], :options => { :encoding => 'utf-8' }) @tree.children << Element.new(:raw, code) end |