ok tahts better render.go for template tests
This commit is contained in:
@@ -39,13 +39,14 @@ func main() {
|
||||
switch path.Ext(p) {
|
||||
case ".ctmpl":
|
||||
target := path.Join(path.Dir(p), "."+path.Base(p)+".html")
|
||||
defer log.Printf("rendering ...%s as %s", path.Join(path.Base(path.Dir(p)), path.Base(p)), target)
|
||||
f, err := os.Create(path.Join(path.Dir(p), "."+path.Base(p)+".html"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
return t(p).Execute(f, data)
|
||||
templateToExecute := strings.TrimSuffix(path.Base(p), path.Ext(p))
|
||||
defer log.Printf("rendering %s (...%s) as %s", templateToExecute, path.Join(path.Base(path.Dir(p)), path.Base(p)), target)
|
||||
return t(p).Lookup(templateToExecute).Execute(f, data)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user