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 command to dump template variables #1009

Closed
bep opened this issue Mar 29, 2015 · 4 comments
Closed

Add command to dump template variables #1009

bep opened this issue Mar 29, 2015 · 4 comments

Comments

@bep
Copy link
Member

bep commented Mar 29, 2015

See http://discuss.gohugo.io/t/the-never-ending-confusion-over-variables/804/10

  • Not sure on what level this should be performed, site, page?
  • Reflection should be able to read out the exported fields and funcs in a template context
@mdhender
Copy link
Contributor

mdhender commented Apr 1, 2015

I thought that we could write a for loop in the template to iterate through all the values in . and dump the values as needed. I added two functions in PR #1026 to help:

  1. "inspect" is similar to printf "%#v".
  2. "typeOf" returns the type of a variable or value.

@mdhender
Copy link
Contributor

mdhender commented Apr 6, 2015

Future thoughts - given how fast Hugo is, would it be possible to have a template hiding on the back end that did a pretty print of the current environment and passed that through CSS to float a window that displayed the results in a navigable hierarchy?

@bep
Copy link
Member Author

bep commented Apr 6, 2015

Yes - that's a good idea ... but since the current context is per page/node, it should be some kind of DebugWrapper around each html file.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants