Use / for template names regardless of platform.

The path seperator was causing templates to not be loaded on windows.
Now all template names use / internally.
This commit is contained in:
Noah Campbell
2013-08-12 13:57:47 -07:00
parent 3fdcd0ba7c
commit 8c03141307
4 changed files with 40 additions and 16 deletions

View File

@@ -163,14 +163,18 @@ func (s *Site) loadTemplates() {
return err
}
text := string(filetext)
name := path[len(s.Config.GetAbsPath(s.Config.LayoutDir))+1:]
t := s.Tmpl.New(name)
t := s.Tmpl.New(s.generateTemplateNameFrom(path))
template.Must(t.Parse(text))
}
return nil
}
filepath.Walk(s.Config.GetAbsPath(s.Config.LayoutDir), walker)
filepath.Walk(s.absLayoutDir(), walker)
}
func (s *Site) generateTemplateNameFrom(path string) (name string) {
name = filepath.ToSlash(path[len(s.absLayoutDir())+1:])
return
}
func (s *Site) primeTemplates() {