Sha256: b48d0f6e07a9907c04feb18108be4426423f0eabf5d07c0efdfe04035cd9d1d0

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'webgen/content_processor'
webgen_require 'erubis'

module Webgen
  class ContentProcessor

    # Processes embedded Ruby statements with the +erubis+ library.
    module Erubis

      # Including Erubis because of problem with resolving Erubis::XmlHelper et al
      include ::Erubis

      # Process the Ruby statements embedded in the content of +context+.
      def self.call(context)
        options = context.website.config['content_processor.erubis.options']
        erubis = if context.website.config['content_processor.erubis.use_pi']
                   ::Erubis::PI::Eruby.new(context.content, options)
                 else
                   ::Erubis::Eruby.new(context.content, options)
                 end
        erubis.filename = context.ref_node.alcn
        context.content = erubis.result(binding)
        context
      end

    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
webgen-1.2.0 lib/webgen/content_processor/erubis.rb
webgen-1.1.0 lib/webgen/content_processor/erubis.rb
webgen-1.0.0 lib/webgen/content_processor/erubis.rb
webgen-1.0.0.beta3 lib/webgen/content_processor/erubis.rb
webgen-1.0.0.beta2 lib/webgen/content_processor/erubis.rb
webgen-1.0.0.beta1 lib/webgen/content_processor/erubis.rb