From 03d0a2f837d5b9b2072ca71301e8930fecf7e5b3 Mon Sep 17 00:00:00 2001 From: horus_arch Date: Sat, 29 Aug 2015 17:57:54 +0200 Subject: Initial commit. --- text.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 text.go (limited to 'text.go') diff --git a/text.go b/text.go new file mode 100644 index 0000000..a28c83d --- /dev/null +++ b/text.go @@ -0,0 +1,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) + } + } +} -- cgit v1.2.3