Class: Kramdown::Parser::Slider
- Inherits:
-
Kramdown
- Object
- Kramdown
- Kramdown::Parser::Slider
- Defined in:
- lib/slider/markdown.rb
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.
7 8 9 10 11 |
# File 'lib/slider/markdown.rb', line 7 def initialize(source, ) super @block_parsers.unshift(:syntax_tag) @block_parsers.unshift(:slide_tag) end |
Instance Method Details
#parse_slide_tag ⇒ Object
22 23 24 25 |
# File 'lib/slider/markdown.rb', line 22 def @src.pos += @src.matched_size @tree.children << Element.new(:raw, '</section><section class="slide">') end |
#parse_syntax_tag ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/slider/markdown.rb', line 13 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 |