const myTemplate = `package blah
const myEmbeddedTemplate = `the sky is crying`
`
I can't seem to find a way to escape the embedded backticks. The spec says "Within the quotes, any character is legal except back quote." and I don't see any other way to accomplish what I'm trying to do.
Any suggestions other than making the templates files and loading them? The application that is using the templates is a command, and I don't want to have to guess where the templates are.
I suppose I could make the template location a command line flag, if there are no other choices.
Input appreciated.
Brian
`sunshine` + "` backticked `" + `desserts`
Chris
--
Chris "allusive" Dollin
That works if I strip all the newlines out of the quoted string. Fortunately it's html so it'll suffice.
Thanks!
Brian
`sunshine` + "`" + `backticked` + "`" + `desserts`, to steal an example.
Or, you can use Sprintf to nest the strings in Go syntax, then use
Printf to output the result in Go syntax. Then, it will all be
properly escaped, so you can just paste that string into your source
file. This might be more work though.
Brian