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 template debugging functions #1026

Closed
wants to merge 1 commit into from
Closed

Add template debugging functions #1026

wants to merge 1 commit into from

Conversation

mdhender
Copy link
Contributor

@mdhender mdhender commented Apr 1, 2015

Template developers frequently need to show variable values while
debugging templates. Issue #1009 requests better support for this.

The printf "%#v" idiom is powerful but requires some knowledge
of Hugo's internal representation of Go value types. Not all
template designers will have that knowledge. The two functions
inspect and typeOf provide a path towards easier to use and
understand printing of variables and values.

The inspect function replaces the printf call. This version
relies on the default string conversion for the result. This
provides a path towards pretty-printing variables and values.

Templates may use typeOf to determine the best formatting
for variables and values.

Template developers frequently need to show variable values while
debugging templates. Issue #1009 requests better support for this.

The `printf "%#v"` idiom is powerful but requires some knowledge
of Hugo's internal representation of Go value types. Not all
template designers will have that knowledge. The two functions
`inspect` and `typeOf` provide a path towards easier to use and
understand printing of variables and values.

The `inspect` function replaces the `printf` call. This version
relies on the default `string` conversion for the result. This
provides a path towards pretty-printing variables and values.

Templates may use `typeOf` to determine the best formatting
for variables and values.
@mdhender mdhender closed this Apr 2, 2015
@mdhender mdhender deleted the new-inspect-commands branch April 2, 2015 20:35
@mdhender
Copy link
Contributor Author

mdhender commented Apr 4, 2015

Rebuilt as PR #1042

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

This pull request 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 Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant