Class: Jekyll::Typography

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll-gl.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, options) ⇒ Typography

Returns a new instance of Typography.



93
94
95
96
97
# File 'lib/jekyll-gl.rb', line 93

def initialize(tag_name, markup, options)
  super

  @font_family = markup
end

Instance Method Details

#render(context) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/jekyll-gl.rb', line 99

def render(context)
  content = ''

  super.split(/[,\n]/).each do |val|
    next if val == ''
    content += '<li title="{{glyph}}"> {{glyph}} </li>'.gsub('{{glyph}}', val);
  end

  '<ul class="gl-char-table" style="font-family: {{family}};">{{content}}</ul>'
    .gsub('{{family}}', @font_family)
    .sub('{{content}}', content)
end