Class: JekyllAlertsPlugin::Tag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, alert_type, tokens) ⇒ Tag

Returns a new instance of Tag.



127
128
129
130
# File 'lib/jekyll-alerts-plugin.rb', line 127

def initialize(tag_name, alert_type, tokens)
  super
  @alert_type = alert_type.strip.downcase
end

Instance Method Details

#render(context) ⇒ Object



132
133
134
135
136
137
138
139
140
# File 'lib/jekyll-alerts-plugin.rb', line 132

def render(context)
  raw = super
  return "" unless JekyllAlertsPlugin::TYPES.include?(@alert_type)

  converter = context.registers[:site]
                     .find_converter_instance(::Jekyll::Converters::Markdown)
  body_html = converter.convert(raw).strip
  JekyllAlertsPlugin.wrap(@alert_type, body_html)
end