Sha256: 4387de88bb38a6c3ac2d45fc43958e6e962b95666e240f8a690345feddb83c69

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module Jekyll
  module Convertible
    alias_method :do_layout_orig, :do_layout

    def do_layout(payload, layouts)
      # The contentblock tags needs access to the converter to process it while rendering.
      config = Octopress::Ink::Plugins.config
      payload['plugins']   = config['plugins']
      payload['theme']     = config['theme']
      payload['converter'] = self.converter
      payload['octopress'] = {}
      payload['octopress']['version'] = Octopress::Ink.version
      do_layout_orig(payload, layouts)
    end
  end

  # Create a new page class to allow partials to trigger Jekyll Page Hooks.
  class ConvertiblePage
    include Convertible
    
    attr_accessor :name, :content, :site, :ext, :output, :data
    
    def initialize(site, name, content)
      @site     = site
      @name     = name
      @ext      = File.extname(name)
      @content  = content
      @data     = { layout: "no_layout" } # hack
      
    end
    
    def render(payload)
      do_layout(payload, { no_layout: nil })
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.alpha.35 lib/octopress-ink/jekyll/hooks.rb
octopress-ink-1.0.0.alpha.34 lib/octopress-ink/jekyll/hooks.rb
octopress-ink-1.0.0.alpha.33 lib/octopress-ink/jekyll/hooks.rb
octopress-ink-1.0.0.alpha.32 lib/octopress-ink/jekyll/hooks.rb