Module: Jekyll::Convertible
- Defined in:
- lib/octopress-hooks.rb
Overview
Monkey patch for the Jekyll Convertible module.
Instance Method Summary collapse
-
#do_layout(payload, layouts) ⇒ Object
Calls the pre_render method if it exists and then adds any necessary layouts to this convertible document.
-
#full_url ⇒ Object
Returns the full url of the post, including the configured url.
- #hooks ⇒ Object
- #merge_payload(payload) ⇒ Object
- #old_do_layout ⇒ Object
- #old_write ⇒ Object
- #post_init ⇒ Object
- #post_render ⇒ Object
- #post_write ⇒ Object
- #pre_render ⇒ Object
-
#write(dest) ⇒ Object
Write the generated post file to the destination directory.
Instance Method Details
#do_layout(payload, layouts) ⇒ Object
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 => “layout”.
Returns nothing.
346 347 348 349 350 351 352 353 354 355 356 |
# 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 |
#full_url ⇒ Object
Returns the full url of the post, including the configured url
407 408 409 |
# File 'lib/octopress-hooks.rb', line 407 def full_url File.join(site.config['url'], url) end |
#hooks ⇒ Object
368 369 370 |
# File 'lib/octopress-hooks.rb', line 368 def hooks [] end |
#merge_payload(payload) ⇒ Object
378 379 380 381 382 383 384 385 |
# 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 ⇒ Object
336 |
# File 'lib/octopress-hooks.rb', line 336 alias_method :old_do_layout, :do_layout |
#old_write ⇒ Object
337 |
# File 'lib/octopress-hooks.rb', line 337 alias_method :old_write, :write |
#post_init ⇒ Object
372 373 374 375 376 |
# File 'lib/octopress-hooks.rb', line 372 def post_init hooks.each do |hook| hook.post_init(self) end end |
#post_render ⇒ Object
393 394 395 396 397 |
# File 'lib/octopress-hooks.rb', line 393 def post_render hooks.each do |hook| hook.post_render(self) end end |
#post_write ⇒ Object
399 400 401 402 403 |
# File 'lib/octopress-hooks.rb', line 399 def post_write hooks.each do |hook| hook.post_write(self) end end |
#pre_render ⇒ Object
387 388 389 390 391 |
# File 'lib/octopress-hooks.rb', line 387 def pre_render hooks.each do |hook| hook.pre_render(self) end end |
#write(dest) ⇒ Object
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
363 364 365 366 |
# File 'lib/octopress-hooks.rb', line 363 def write(dest) old_write(dest) post_write if respond_to?(:post_write) && hooks end |