Module: Jekyll::Convertible
- Included in:
- ConvertiblePartial
- 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.
- #is_convertible_partial? ⇒ Boolean
- #is_filterable? ⇒ Boolean
- #is_page? ⇒ Boolean
- #is_post? ⇒ Boolean
- #old_do_layout ⇒ Object
- #old_transform ⇒ Object
- #old_write ⇒ Object
-
#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.
-
#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.
237 238 239 240 |
# File 'lib/octopress-hooks.rb', line 237 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
254 255 256 |
# File 'lib/octopress-hooks.rb', line 254 def full_url self.site.config['url'] + self.url end |
#is_convertible_partial? ⇒ Boolean
173 174 175 |
# File 'lib/octopress-hooks.rb', line 173 def is_convertible_partial? self.is_a? Jekyll::ConvertiblePartial end |
#is_filterable? ⇒ Boolean
177 178 179 |
# File 'lib/octopress-hooks.rb', line 177 def is_filterable? is_post? or is_page? or is_convertible_partial? end |
#is_page? ⇒ Boolean
168 169 170 171 |
# File 'lib/octopress-hooks.rb', line 168 def is_page? self.is_a? Jekyll::Page || self.class.to_s == 'Octopress::Ink::Page' end |
#is_post? ⇒ Boolean
164 165 166 |
# File 'lib/octopress-hooks.rb', line 164 def is_post? self.is_a? Jekyll::Post end |
#old_do_layout ⇒ Object
218 |
# File 'lib/octopress-hooks.rb', line 218 alias_method :old_do_layout, :do_layout |
#old_transform ⇒ Object
217 |
# File 'lib/octopress-hooks.rb', line 217 alias_method :old_transform, :transform |
#old_write ⇒ Object
219 |
# File 'lib/octopress-hooks.rb', line 219 alias_method :old_write, :write |
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
Returns nothing
197 198 199 200 201 202 203 |
# File 'lib/octopress-hooks.rb', line 197 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
209 210 211 212 213 214 215 |
# File 'lib/octopress-hooks.rb', line 209 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
185 186 187 188 189 190 191 |
# File 'lib/octopress-hooks.rb', line 185 def pre_render 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.
225 226 227 228 |
# File 'lib/octopress-hooks.rb', line 225 def transform old_transform post_render if respond_to?(:post_render) 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
247 248 249 250 |
# File 'lib/octopress-hooks.rb', line 247 def write(dest) old_write(dest) post_write if respond_to?(:post_write) end |