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 inspect filter #2850

Closed
wants to merge 2 commits into from
Closed

Conversation

chibicode
Copy link
Contributor

For #2814 - I opted out for debug instead of inspect to mimic the debug helper method in Rails (their implementation). It also escapes HTML tags.

Usage:

<pre>{{ page | debug }}</pre>

Output:

<pre>

---
layout: default
content: |
  ...
name: index.html
path: index.html
url: &quot;/&quot;

</pre>

@chibicode
Copy link
Contributor Author

The test seems to be failing on something irrelevant https://travis-ci.org/jekyll/jekyll/builds/33869200

@parkr
Copy link
Member

parkr commented Aug 29, 2014

This is pretty cool. I still like inspect better because it's more in line with Ruby (most of our users aren't Rails developers anyway), but the code looks ok. Thanks!

@chibicode chibicode changed the title Add debug filter Add inspect filter Aug 29, 2014
@chibicode
Copy link
Contributor Author

@parkr Thanks, renamed!

#
# Returns a YAML representation of the object.
def inspect(input)
CGI.escapeHTML(input.to_yaml)
Copy link
Member

Choose a reason for hiding this comment

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

Why not input.inspect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Again I was basing off Rails's debug and thought that to_yaml would have richer information. But if inspect suffices, will change to it.

@parkr
Copy link
Member

parkr commented Sep 1, 2014

Also if you rebase on the latest master, you'll find that the tests should pass. 👍

@chibicode chibicode mentioned this pull request Sep 1, 2014
@chibicode chibicode closed this Sep 1, 2014
@chibicode
Copy link
Contributor Author

@parkr Thanks, cleaned it up at #2867!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants