I get that sprig wants to keep function names and documentation concise. But the docs for quote and squote look incomplete to me:
# quote and squote
These functions wrap a string in double quotes (`quote`) or single quotes
(`squote`).
These functions do a little more than wrapping, they also escape the contents of the string for the target quoted string format.
E.g. the quote function delegates to Go's fmt.Sprintf function and uses the %q verb, whose documentation says:
a double-quoted string safely escaped with Go syntax
I think that sprig documentation should reflect this piece of information. (Similar for squote).
As a user of sprig, I'd like to know where I can use the resulting strings securely. Looks like I can use them when generating Go code. But are they also safe to embed into other languages and data formats? E.g. C, Java, JS, JSON, or YAML? (E.g. Helm recommends using Sprig's quote function when generating YAML code.)
My I attempt a PR to improve the docs?
I get that sprig wants to keep function names and documentation concise. But the docs for quote and squote look incomplete to me:
These functions do a little more than wrapping, they also escape the contents of the string for the target quoted string format.
E.g. the
quotefunction delegates to Go'sfmt.Sprintffunction and uses the%qverb, whose documentation says:I think that sprig documentation should reflect this piece of information. (Similar for
squote).As a user of sprig, I'd like to know where I can use the resulting strings securely. Looks like I can use them when generating Go code. But are they also safe to embed into other languages and data formats? E.g. C, Java, JS, JSON, or YAML? (E.g. Helm recommends using Sprig's
quotefunction when generating YAML code.)My I attempt a PR to improve the docs?