corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | =begin |
2 | Jekyll tag to include Markdown text from _includes directory preprocessing with Liquid. |
||
3 | Usage: |
||
4 | {% markdown <filename> %} |
||
5 | =end |
||
6 | module Jekyll |
||
7 | class MarkdownTag < Liquid::Tag |
||
8 | def initialize(tag_name, text, tokens) |
||
9 | super |
||
10 | @text = text.strip |
||
11 | end |
||
12 | |||
13 | def render(context) |
||
14 | tmpl = File.read File.join context.registers[:site].source, "_includes", @text |
||
15 | site = context.registers[:site] |
||
16 | converter = site.getConverterImpl(Jekyll::Converters::Markdown) |
||
17 | tmpl = (Liquid::Template.parse tmpl).render site.site_payload |
||
18 | html = converter.convert(tmpl) |
||
19 | end |
||
20 | end |
||
21 | end |
||
22 | Liquid::Template.register_tag('markdown', Jekyll::MarkdownTag) |