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

Render WebmentionJSTag with a dedicated class #100

Merged
merged 3 commits into from
Sep 14, 2018

Conversation

ashmaroli
Copy link
Contributor

Resolves #99

The rendered output of WebmentionJSTag is the same irrespective of given context. So the content can be rendered once, cached elsewhere and then retrieved from the cache for each call to the tag's :render method.

(This PR also involves a micro-optimization by caching array of supported_templates in the main module itself, to avoid unnecessary allocations)

@ashmaroli ashmaroli force-pushed the js-tag-renderer branch 4 times, most recently from e183827 to f406010 Compare September 13, 2018 19:40
end
end

def self.gathered_templates
Copy link
Owner

Choose a reason for hiding this comment

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

What do you think about renaming this html_templates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think html_templates will do fine 😃

@aarongustafson
Copy link
Owner

I like this approach. Thank you!

I added two questions/comments.

PS - I had not seen the ||= assignment pattern before. Using that with return is pretty clever!

@ashmaroli
Copy link
Contributor Author

I had not seen the ||= assignment pattern before. Using that with return is pretty clever!

🙂 You're welcome.
Jekyll Core has ||= used in various places 😉

Copy link
Owner

@aarongustafson aarongustafson left a comment

Choose a reason for hiding this comment

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

Thank you.

@aarongustafson
Copy link
Owner

This had a noticeable speed improvement. Thank you for making it happen!

@aarongustafson aarongustafson merged commit 187a46d into aarongustafson:master Sep 14, 2018
@ashmaroli ashmaroli deleted the js-tag-renderer branch September 14, 2018 07:14
@ashmaroli
Copy link
Contributor Author

This had a noticeable speed improvement.

There was none at my end though.. (probably coz I'm on Windows....)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants