Class: JekyllAlertsPlugin::Tag
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- JekyllAlertsPlugin::Tag
- Defined in:
- lib/jekyll-alerts-plugin.rb
Instance Method Summary collapse
-
#initialize(tag_name, alert_type, tokens) ⇒ Tag
constructor
A new instance of Tag.
- #render(context) ⇒ Object
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 |