From 1dc63a221695eeacf226e301ec4306e8573e1b79 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 1 Feb 2018 17:51:23 -0800 Subject: list generic templates --- render/render.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'render') diff --git a/render/render.go b/render/render.go index 1606305..ba8e52b 100644 --- a/render/render.go +++ b/render/render.go @@ -1,11 +1,11 @@ package render import ( - "bytes" "adammathes.com/snkt/config" + "adammathes.com/snkt/vlog" + "bytes" "io/ioutil" "log" - "adammathes.com/snkt/vlog" "os" "path" "path/filepath" @@ -27,6 +27,18 @@ type Renderable interface { Target() string } +func TemplateNames() []string { + templateNames := make([]string, len(templates)) + + i := 0 + for tName, _ := range templates { + templateNames[i] = tName + i++ + } + + return templateNames +} + func Write(a Renderable) { if config.Config.Verbose { vlog.Printf("Writing to %s\n", a.Target()) @@ -51,11 +63,10 @@ func Init() { tmplFuncs := template.FuncMap{ "ResolveURLs": ResolveURLs, - "SiteTitle": SiteTitle, - "SiteURL": SiteURL, + "SiteTitle": SiteTitle, + "SiteURL": SiteURL, } - base := path.Join(config.Config.TmplDir, BASE_TEMPLATE) for _, t := range ts { tf := filepath.Base(t) -- cgit v1.2.3