Sha256: 104236645dfafb2db21ac830118579170ff91c9f921d80a5547ff8cf943a074b
Contents?: true
Size: 975 Bytes
Versions: 2
Compression:
Stored size: 975 Bytes
Contents
# encoding: utf-8 module Nanoc::Filters class Erubis < Nanoc::Filter requires 'erubis' # The same as `::Erubis::Eruby` but adds `_erbout` as an alias for the # `_buf` variable, making it compatible with nanoc’s helpers that rely # on `_erbout`, such as {Nanoc::Helpers::Capturing}. class ErubisWithErbout < ::Erubis::Eruby include ::Erubis::ErboutEnhancer end # Runs the content through [Erubis](http://www.kuwata-lab.com/erubis/). # This method takes no options. # # @param [String] content The content to filter # # @return [String] The filtered content def run(content, _params = {}) # Create context context = ::Nanoc::Context.new(assigns) # Get binding proc = assigns[:content] ? -> { assigns[:content] } : nil assigns_binding = context.get_binding(&proc) # Get result ErubisWithErbout.new(content, filename: filename).result(assigns_binding) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc-3.8.0 | lib/nanoc/filters/erubis.rb |
nanoc-3.7.5 | lib/nanoc/filters/erubis.rb |