Sha256: 0c13c2309b9da79ea38a64267cd491de076684c9168a9e4d0f2c4a301266bbef

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

# encoding: UTF-8

module Cutaneous
  class PreviewContext
    include ContextHelper
    include Spontaneous::Render::PreviewContext

    def include(filename, locals={})
      _comment(filename)
      import(filename, true, locals)
    end

    def _decode_params(param, *args)
      if param.respond_to?(:start_inline_edit_marker)
        _comment(param.start_inline_edit_marker) << super << _comment(param.end_inline_edit_marker)
      else
        super
      end
    end

    def _comment(text)
      @_comment_method ||= "_comment_#{_format}".to_sym
      if (respond_to?(@_comment_method))
        self.send(@_comment_method, text)
      end
    end

    def _comment_html(text)
      "<!-- #{escape(text.to_s.escape_html)} -->\n"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spontaneous-0.2.0.alpha2 lib/cutaneous/preview_context.rb
spontaneous-0.2.0.alpha1 lib/cutaneous/preview_context.rb