pmd/docs/_plugins/render_block.rb

18 lines
337 B
Ruby
Raw Permalink Normal View History

2019-03-06 01:29:53 +01:00
#
2020-01-24 18:39:58 +01:00
# Apply a second pass of rendering on a block
2019-03-06 01:29:53 +01:00
#
class RenderBlock < Liquid::Block
def initialize(tag_name, arg, tokens)
super
@body = tokens
end
def render(context)
template = @body.render(context)
2019-03-06 02:22:36 +01:00
Liquid::Template.parse(template).render(context)
2019-03-06 01:29:53 +01:00
end
end
Liquid::Template.register_tag('render', RenderBlock)