Class: IconTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- IconTag
- Defined in:
- lib/jekyll-material-icon-tag.rb
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ IconTag
constructor
A new instance of IconTag.
- #parse_parameters(text) ⇒ Object
- #render(_) ⇒ Object
Constructor Details
#initialize(tag_name, text, tokens) ⇒ IconTag
Returns a new instance of IconTag.
5 6 7 8 |
# File 'lib/jekyll-material-icon-tag.rb', line 5 def initialize(tag_name, text, tokens) super @text = text end |
Instance Method Details
#parse_parameters(text) ⇒ Object
20 21 22 23 |
# File 'lib/jekyll-material-icon-tag.rb', line 20 def parse_parameters(text) text.strip! text.split(/\s+/) end |
#render(_) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/jekyll-material-icon-tag.rb', line 10 def render(_) iconname, type = parse_parameters @text if type.nil? "<i class=\"material-icons\">#{iconname.strip}</i>" else "<i class=\"material-icons-#{type.strip}\">#{iconname.strip}</i>" end end |