Module: Jekyll::Convertible
- Defined in:
- lib/jekyll-page-hooks.rb
Overview
Monkey patch for the Jekyll Convertible module. For the original class, see: github.com/mojombo/jekyll/blob/master/lib/jekyll/convertible.rb
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.
- #is_filterable? ⇒ Boolean
- #is_page? ⇒ Boolean
- #is_post? ⇒ Boolean
-
#old_do_layout ⇒ Object
Copy the #do_layout method to #old_do_layout, so we can redefine #do_layout method.
-
#old_transform ⇒ Object
Copy the #transform method to #old_transform, so we can redefine #transform method.
-
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
-
#post_write ⇒ Object
Call the #post_write methods on all of the loaded page_hook plugins.
-
#pre_render ⇒ Object
Call the #pre_render methods on all of the loaded page_hook plugins.
-
#transform ⇒ Object
Transform the contents based on the content type.
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.
162 163 164 165 |
# File 'lib/jekyll-page-hooks.rb', line 162 def do_layout(payload, layouts) pre_render if respond_to?(:pre_render) old_do_layout(payload, layouts) end |
#full_url ⇒ Object
Returns the full url of the post, including the configured url
169 170 171 |
# File 'lib/jekyll-page-hooks.rb', line 169 def full_url self.site.config['url'] + self.url end |
#is_filterable? ⇒ Boolean
96 97 98 |
# File 'lib/jekyll-page-hooks.rb', line 96 def is_filterable? is_post? or is_page? end |
#is_page? ⇒ Boolean
92 93 94 |
# File 'lib/jekyll-page-hooks.rb', line 92 def is_page? self.class.to_s == 'Jekyll::Page' end |
#is_post? ⇒ Boolean
88 89 90 |
# File 'lib/jekyll-page-hooks.rb', line 88 def is_post? self.class.to_s == 'Jekyll::Post' end |
#old_do_layout ⇒ Object
Copy the #do_layout method to #old_do_layout, so we can redefine #do_layout method.
153 |
# File 'lib/jekyll-page-hooks.rb', line 153 alias_method :old_do_layout, :do_layout |
#old_transform ⇒ Object
Copy the #transform method to #old_transform, so we can redefine #transform method.
140 |
# File 'lib/jekyll-page-hooks.rb', line 140 alias_method :old_transform, :transform |
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
Returns nothing
118 119 120 121 122 123 124 |
# File 'lib/jekyll-page-hooks.rb', line 118 def post_render if self.site.page_hooks and is_filterable? self.site.page_hooks.each do |filter| filter.post_render(self) end end end |
#post_write ⇒ Object
Call the #post_write methods on all of the loaded page_hook plugins.
Returns nothing
130 131 132 133 134 135 136 |
# File 'lib/jekyll-page-hooks.rb', line 130 def post_write if self.site.page_hooks and is_filterable? self.site.page_hooks.each do |filter| filter.post_write(self) end end end |
#pre_render ⇒ Object
Call the #pre_render methods on all of the loaded page_hook plugins.
Returns nothing
104 105 106 107 108 109 110 111 112 |
# File 'lib/jekyll-page-hooks.rb', line 104 def pre_render self.site.load_page_hooks unless self.site.page_hooks if self.site.page_hooks and is_filterable? self.site.page_hooks.each do |filter| filter.pre_render(self) end end end |
#transform ⇒ Object
Transform the contents based on the content type. Then calls the #post_render method if it exists
Returns nothing.
146 147 148 149 |
# File 'lib/jekyll-page-hooks.rb', line 146 def transform old_transform post_render if respond_to?(:post_render) end |