blob: a28c83ddb2f0a5742f1e5000a1a6fd443d06dec0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package main
import (
"log"
"os"
"text/template"
)
func ParseText(templates []string, data interface{}) {
// Parse the template dir
tmpl := template.Must(template.New("template").ParseGlob(*template_dir_f + "/*" + *ext_f))
for _, template := range templates {
if template == "" {
continue
}
err := tmpl.ExecuteTemplate(os.Stdout, template, data)
if err != nil {
log.Fatal(err)
}
}
}
|