Class: MyBlockTagTemplate::MyBlock
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- MyBlockTagTemplate::MyBlock
- Defined in:
- jekyll_block_template.rb
Overview
This class implements the Jekyll tag functionality
Instance Method Summary collapse
-
#initialize(tag_name, arguments, tokens) ⇒ void
constructor
Constructor.
-
#render(context) ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
Constructor Details
#initialize(tag_name, arguments, tokens) ⇒ void
Constructor.
39 40 41 42 43 44 45 |
# File 'jekyll_block_template.rb', line 39 def initialize(tag_name, arguments, tokens) super(tag_name, arguments, tokens) MyTagTemplate.log.info "tag_name [#{tag_name.class}] = '#{tag_name}' [#{tag_name.class}]".green MyTagTemplate.log.info "arguments [#{arguments.class}] = '#{arguments}'".green @arguments = arguments @arguments = '' if @arguments.nil? || @arguments.empty? end |
Instance Method Details
#render(context) ⇒ String
Method prescribed by the Jekyll plugin lifecycle.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'jekyll_block_template.rb', line 49 def render(context) content = super # This magically underdocumented assignment somehow returns the text within the block. @site = context.registers[:site] @config = @site.config @mode = @config['env']['JEKYLL_ENV'] MyBlockTagTemplate.log.info "mode='#{@mode}'".green @page = context.registers[:page] MyBlockTagTemplate.log.info "page.path='#{@page.path}'".green MyBlockTagTemplate.log.info "page.url='#{@page.url}'".green <<~HEREDOC <p style="color: green; background-color: yellow; padding: 1em; border: solid thin grey;"> #{content} </p> HEREDOC end |