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_convertible_page? ⇒ 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.
165 166 167 168 |
# File 'lib/jekyll-page-hooks.rb', line 165 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
172 173 174 |
# File 'lib/jekyll-page-hooks.rb', line 172 def full_url self.site.config['url'] + self.url end |
#is_convertible_page? ⇒ Boolean
95 96 97 |
# File 'lib/jekyll-page-hooks.rb', line 95 def is_convertible_page? self.class.to_s == 'Jekyll::ConvertiblePage' end |
#is_filterable? ⇒ Boolean
99 100 101 |
# File 'lib/jekyll-page-hooks.rb', line 99 def is_filterable? is_post? or is_page? or is_convertible_page? end |
#is_page? ⇒ Boolean
90 91 92 93 |
# File 'lib/jekyll-page-hooks.rb', line 90 def is_page? self.class.to_s == 'Jekyll::Page' || self.class.to_s == 'Octopress::Ink::Page' end |
#is_post? ⇒ Boolean
86 87 88 |
# File 'lib/jekyll-page-hooks.rb', line 86 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.
156 |
# File 'lib/jekyll-page-hooks.rb', line 156 alias_method :old_do_layout, :do_layout |
#old_transform ⇒ Object
Copy the #transform method to #old_transform, so we can redefine #transform method.
143 |
# File 'lib/jekyll-page-hooks.rb', line 143 alias_method :old_transform, :transform |
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
Returns nothing
121 122 123 124 125 126 127 |
# File 'lib/jekyll-page-hooks.rb', line 121 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
133 134 135 136 137 138 139 |
# File 'lib/jekyll-page-hooks.rb', line 133 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
107 108 109 110 111 112 113 114 115 |
# File 'lib/jekyll-page-hooks.rb', line 107 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.
149 150 151 152 |
# File 'lib/jekyll-page-hooks.rb', line 149 def transform old_transform post_render if respond_to?(:post_render) end |