]> git.ipfire.org Git - ipfire.org.git/blame - src/scss/bootstrap-4.0.0-alpha.6/docs/_plugins/callout.rb
Introduce autotools
[ipfire.org.git] / src / scss / bootstrap-4.0.0-alpha.6 / docs / _plugins / callout.rb
CommitLineData
91e44d91
S
1# Source: https://stackoverflow.com/questions/19169849/how-to-get-markdown-processed-content-in-jekyll-tag-plugin
2
3module Jekyll
4 module Tags
5 class CalloutTag < Liquid::Block
6
7 def initialize(tag_name, type, tokens)
8 super
9 type.strip!
10 if %w(info danger warning).include?(type)
11 @type = type
12 else
13 puts "#{type} callout not supported. Defaulting to info"
14 @type = "info"
15 end
16 end
17
18 def render(context)
19 site = context.registers[:site]
20 converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
21 output = converter.convert(super(context))
22 "<div class=\"bd-callout bd-callout-#{@type}\">#{output}</div>"
23 end
24 end
25 end
26end
27
28Liquid::Template.register_tag('callout', Jekyll::Tags::CalloutTag)