Sha256: 1ef588d19638a4065d70425c5eb1e2a49be1d1c2e4e37cd6067039ceecff3c12
Contents?: true
Size: 991 Bytes
Versions: 2
Compression:
Stored size: 991 Bytes
Contents
require 'awestruct/util/exception_helper' require 'awestruct/handlers/base_handler' module Awestruct module Handlers class InterpolationHandler < BaseHandler def initialize(site, delegate) super( site, delegate ) end def rendered_content(context, with_layouts=true) content = delegate.raw_content return nil if content.nil? return content unless front_matter.fetch('interpolate', site.interpolate) content = content.gsub( /\\/, '\\\\\\\\' ) content = content.gsub( /\\\\#/, '\\#' ) content = content.gsub( /#(?!\{)/, '\#' ) content = content.gsub( '@', '\@' ) content = "%@#{content}@" begin c = context.instance_eval( content ) rescue Exception => e # Don't barf all over ourselves if an exception is thrown ExceptionHelper.log_building_error e, relative_source_path c = delegate.raw_content end c end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
awestruct-0.5.4.rc3 | lib/awestruct/handlers/interpolation_handler.rb |
awestruct-0.5.4.rc2 | lib/awestruct/handlers/interpolation_handler.rb |