summaryrefslogtreecommitdiff
path: root/html.go
diff options
context:
space:
mode:
Diffstat (limited to 'html.go')
-rw-r--r--html.go22
1 files changed, 22 insertions, 0 deletions
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)
+ }
+ }
+}