module Jekyll::Convertible

Monkey patch for the Jekyll Convertible module.

Public Instance Methods

do_layout(payload, layouts) click to toggle source

Calls the pre_render method if it exists and then adds any necessary layouts to this convertible document.

payload - The site payload Hash. layouts - A Hash of {“name” => “layout”}.

Returns nothing.

# File lib/octopress-hooks.rb, line 346
def do_layout(payload, layouts)
  pre_render if respond_to?(:pre_render) && hooks

  if respond_to?(:merge_payload) && hooks
    old_do_layout(merge_payload(payload.dup), layouts)
  else
    old_do_layout(payload, layouts)
  end

  post_render if respond_to?(:post_render) && hooks
end
Also aliased as: old_do_layout
full_url() click to toggle source

Returns the full url of the post, including the configured url

# File lib/octopress-hooks.rb, line 407
def full_url
  File.join(site.config['url'], url)
end
hooks() click to toggle source
# File lib/octopress-hooks.rb, line 368
def hooks
  []
end
merge_payload(payload) click to toggle source
# File lib/octopress-hooks.rb, line 378
def merge_payload(payload)
  hooks.each do |hook|
    p = hook.merge_payload(payload, self)
    next unless p && p.is_a?(Hash)
    payload = hook.deep_merge_payload(payload, p)
  end
  payload
end
old_do_layout(payload, layouts)
Alias for: do_layout
old_write(dest)
Alias for: write
post_init() click to toggle source
# File lib/octopress-hooks.rb, line 372
def post_init
  hooks.each do |hook|
    hook.post_init(self)
  end
end
post_render() click to toggle source
# File lib/octopress-hooks.rb, line 393
def post_render
  hooks.each do |hook|
    hook.post_render(self)
  end
end
post_write() click to toggle source
# File lib/octopress-hooks.rb, line 399
def post_write
  hooks.each do |hook|
    hook.post_write(self)
  end
end
pre_render() click to toggle source
# File lib/octopress-hooks.rb, line 387
def pre_render
  hooks.each do |hook|
    hook.pre_render(self)
  end
end
write(dest) click to toggle source

Write the generated post file to the destination directory. It then calls any post_write methods that may exist.

+dest+ is the String path to the destination dir

Returns nothing

# File lib/octopress-hooks.rb, line 363
def write(dest)
  old_write(dest)
  post_write if respond_to?(:post_write) && hooks
end
Also aliased as: old_write