Class: Jekyll::Example
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Jekyll::Example
- Defined in:
- lib/jekyll-gl.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, options) ⇒ Example
constructor
A new instance of Example.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, options) ⇒ Example
Returns a new instance of Example.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/jekyll-gl.rb', line 57 def initialize(tag_name, markup, ) super result = [] @example_tag = "div" markup.split.each do |val| case val when "inline" @example_tag = "span" when "full" result << 'gl-full' when "checkers" result << 'gl-checkers' when "dark" result << 'gl-dark' end end result.delete("gl-full") if @css_tag == "span" result.uniq @css_class = result.join(' ') end |
Instance Method Details
#render(context) ⇒ Object
81 82 83 84 85 86 |
# File 'lib/jekyll-gl.rb', line 81 def render(context) '<{{tag}} class="gl {{cssclass}}"> {{content}} </{{tag}}>' .gsub('{{tag}}', @example_tag) .sub('{{cssclass}}', @css_class) .sub('{{content}}', super) end |