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.
164 165 166 167 |
# File 'lib/jekyll-page-hooks.rb', line 164 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
171 172 173 |
# File 'lib/jekyll-page-hooks.rb', line 171 def full_url self.site.config['url'] + self.url end |
#is_filterable? ⇒ Boolean
98 99 100 |
# File 'lib/jekyll-page-hooks.rb', line 98 def is_filterable? is_post? or is_page? end |
#is_page? ⇒ Boolean
94 95 96 |
# File 'lib/jekyll-page-hooks.rb', line 94 def is_page? self.class.to_s == 'Jekyll::Page' end |
#is_post? ⇒ Boolean
90 91 92 |
# File 'lib/jekyll-page-hooks.rb', line 90 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.
155 |
# File 'lib/jekyll-page-hooks.rb', line 155 alias_method :old_do_layout, :do_layout |
#old_transform ⇒ Object
Copy the #transform method to #old_transform, so we can redefine #transform method.
142 |
# File 'lib/jekyll-page-hooks.rb', line 142 alias_method :old_transform, :transform |
#post_render ⇒ Object
Call the #post_render methods on all of the loaded page_hook plugins.
Returns nothing
120 121 122 123 124 125 126 |
# File 'lib/jekyll-page-hooks.rb', line 120 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
132 133 134 135 136 137 138 |
# File 'lib/jekyll-page-hooks.rb', line 132 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
106 107 108 109 110 111 112 113 114 |
# File 'lib/jekyll-page-hooks.rb', line 106 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.
148 149 150 151 |
# File 'lib/jekyll-page-hooks.rb', line 148 def transform old_transform post_render if respond_to?(:post_render) end |