Answer the question
In order to leave comments, you need to log in
How to change characters in template by replacing {{ and }} with - in Golang?
There is a handler
func Handler(w http.ResponseWriter, r *http.Request) {
var templates = template.Must(template.ParseGlob("Templates/Main/*/*"))
var doc bytes.Buffer
err := templates.ExecuteTemplate(&doc, "indexPage", nil)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
//templates.Delims("<%", "%>").Funcs(Main_TemplateFuncs).Parse("<%шаблон %>")
fmt.Fprintln(w, &doc)
}
Answer the question
In order to leave comments, you need to log in
template.Must(template.New("").Delims("<%", "%>").ParseGlob("Templates/Main/*/*"))
You can always get into a situation where:
<script>
var title = '{{title}}';
var obj = {{ { }}{{ } }} // var obj = {}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question