Module: Jekyll::Convertible
- Included in:
- ConvertiblePartial
- 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_convertible_partial? ⇒ Boolean
- #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.
185 186 187 188 |
# File 'lib/jekyll-page-hooks.rb', line 185 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
192 193 194 |
# File 'lib/jekyll-page-hooks.rb', line 192 def full_url self.site.config['url'] + self.url end |
#is_convertible_partial? ⇒ Boolean
115 116 117 |
# File 'lib/jekyll-page-hooks.rb', line 115 def is_convertible_partial? self.is_a? Jekyll::ConvertiblePartial end |
#is_filterable? ⇒ Boolean
119 120 121 |
# File 'lib/jekyll-page-hooks.rb', line 119 def is_filterable? is_post? or is_page? or is_convertible_partial? end |
#is_page? ⇒ Boolean
110 111 112 113 |
# File 'lib/jekyll-page-hooks.rb', line 110 def is_page? self.is_a? Jekyll::Page || self.class.to_s == 'Octopress::Ink::Page' end |
#is_post? ⇒ Boolean
106 107 108 |
# File 'lib/jekyll-page-hooks.rb', line 106 def is_post? self.is_a? Jekyll::Post end |
#old_do_layout ⇒ Object
Copy the #do_layout method to #old_do_layout, so we can redefine #do_layout method.
176 |
# File 'lib/jekyll-page-hooks.rb', line 176 alias_method :old_do_layout, :do_layout |
#old_transform ⇒ Object
Copy the #transform method to #old_transform, so we can redefine #transform method.
163 |
# File 'lib/jekyll-page-hooks.rb', line 163 alias_method :old_transform, :transform |
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
Returns nothing
141 142 143 144 145 146 147 |
# File 'lib/jekyll-page-hooks.rb', line 141 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
153 154 155 156 157 158 159 |
# File 'lib/jekyll-page-hooks.rb', line 153 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
127 128 129 130 131 132 133 134 135 |
# File 'lib/jekyll-page-hooks.rb', line 127 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.
169 170 171 172 |
# File 'lib/jekyll-page-hooks.rb', line 169 def transform old_transform post_render if respond_to?(:post_render) end |