Fix name logic for Amber templates
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 19 Jul 2015 18:12:05 +0000 (20:12 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 19 Jul 2015 18:12:05 +0000 (20:12 +0200)
tpl/template.go

index 14a912901980d69daab9c9f15c3cf609815c5d7f..60fc91746fd56a3515aef339efcb4c1bd833d8d8 100644 (file)
@@ -190,13 +190,14 @@ func (t *GoHTMLTemplate) AddTemplateFile(name, baseTemplatePath, path string) er
        ext := filepath.Ext(path)
        switch ext {
        case ".amber":
+               templateName := strings.TrimSuffix(name, filepath.Ext(name)) + ".html"
                compiler := amber.New()
                // Parse the input file
                if err := compiler.ParseFile(path); err != nil {
                        return nil
                }
 
-               if _, err := compiler.CompileWithTemplate(t.New(name)); err != nil {
+               if _, err := compiler.CompileWithTemplate(t.New(templateName)); err != nil {
                        return err
                }
        case ".ace":