Sha256: f3ad3768ffc824a33664b18d13cc813eaff1e793bf76e76d902b34ad5d52196a

Contents?: true

Size: 711 Bytes

Versions: 16

Compression:

Stored size: 711 Bytes

Contents

module RubySlippers
  module Engine
    module Template
      def to_html page, config, &blk
        path = ([:layout, :repo].include?(page) ? Paths[:templates] : Paths[:pages])
        config[:to_html].call(path, page, binding)
      end

      def markdown text
        if (options = @config[:markdown])
          Markdown.new(text.to_s.strip, *(options.eql?(true) ? [] : options)).to_html
        else
          text.strip
        end
      end

      def method_missing m, *args, &blk
        self.keys.include?(m) ? self[m] : super
      end

      def self.included obj
        obj.class_eval do
          define_method(obj.to_s.split('::').last.downcase) { self }
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
ruby_slippers-0.2.15 lib/ruby_slippers/template.rb
ruby_slippers-0.2.8 lib/ruby_slippers/template.rb
ruby_slippers-0.2.4 lib/ruby_slippers/template.rb
ruby_slippers-0.2.3 lib/ruby_slippers/template.rb
ruby_slippers-0.2.0 lib/ruby_slippers/template.rb
ruby-slippers-0.1.43 lib/ruby_slippers/template.rb
ruby-slippers-0.1.40 lib/ruby_slippers/template.rb
ruby-slippers-0.1.11 lib/ruby_slippers/template.rb
ruby-slippers-0.1.7 lib/ruby_slippers/template.rb
ruby-slippers-0.1.2 lib/ruby_slippers/template.rb
ruby-slippers-0.1.1 lib/ruby_slippers/template.rb
ruby-slippers-0.0.26 lib/ruby_slippers/template.rb
ruby-slippers-0.0.25 lib/ruby_slippers/template.rb
ruby-slippers-0.0.13 lib/ruby_slippers/template.rb
ruby-slippers-0.0.5 lib/ruby_slippers/template.rb
ruby-slippers-0.0.1 lib/ruby_slippers/template.rb