Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some pre- and post-rendering hooks #1771

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions lib/jekyll/convertible.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,13 @@ def do_layout(payload, layouts)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix

self.content = self.render_liquid(self.content,
payload,
info)
self.pre_render
self.content = self.render_liquid(self.content, payload, info)
self.post_render

self.pre_transform
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need post_render and pre_transform? One procedure is enough.

self.transform
self.post_transform

# output keeps track of what will finally be written
self.output = self.content
Expand All @@ -169,6 +172,22 @@ def write(dest)
File.open(path, 'wb') do |f|
f.write(self.output)
end
post_write
end

def pre_render
end

def post_render
end

def pre_transform
end

def post_transform
end

def post_write
end
end
end