From 03d0a2f837d5b9b2072ca71301e8930fecf7e5b3 Mon Sep 17 00:00:00 2001 From: horus_arch Date: Sat, 29 Aug 2015 17:57:54 +0200 Subject: Initial commit. --- html.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 html.go (limited to 'html.go') diff --git a/html.go b/html.go new file mode 100644 index 0000000..534132a --- /dev/null +++ b/html.go @@ -0,0 +1,22 @@ +package main + +import ( + "html/template" + "log" + "os" +) + +func ParseHTML(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