Skip to content

What is the "| quote" syntax in a template? #2109

Answered by twpayne
PaulRBerg asked this question in Q&A
Discussion options

You must be logged in to vote

As described in the templating guide, chezmoi uses Go's text/template. The | quote takes the value of what's on the left hand side of the | and quotes it as a string, including escaping any special characters like \ and ".

You could use

"{{ .email }}"

but, depending on the exact context, this will break if .email contains any backslashes, double quotes, or newlines.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PaulRBerg
Comment options

Answer selected by PaulRBerg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants