From: Noah Campbell Date: Tue, 13 Aug 2013 21:47:14 +0000 (-0700) Subject: Removing the use of slash X-Git-Tag: v0.9~156^2~1 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ec821739bc31e2decb568bec1153a871a82a1cc7;p=brevno-suite%2Fhugo Removing the use of slash An oversight on my behalf. The FromSlash method is used when writing out the public file name. There is one place where the slashes are required which is setting the output file. I replaced those instances with filepath.Join which should do the right thing depending on the OS. --- diff --git a/hugolib/site.go b/hugolib/site.go index 5011cf6b..a35300d2 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -28,8 +28,6 @@ import ( //"sync" ) -const slash = string(os.PathSeparator) - var DefaultTimer = nitro.Initalize() type Site struct { @@ -452,7 +450,7 @@ func (s *Site) RenderIndexes() error { for k, o := range s.Indexes[plural] { n := s.NewNode() n.Title = strings.Title(k) - url := Urlize(plural + slash + k) + url := Urlize(plural + "/" + k) plink := url if s.Config.UglyUrls { n.Url = url + ".html" @@ -465,7 +463,7 @@ func (s *Site) RenderIndexes() error { n.Date = o[0].Date n.Data[singular] = o n.Data["Pages"] = o - layout := "indexes" + slash + singular + ".html" + layout := "indexes/" + singular + ".html" x, err := s.RenderThing(n, layout) if err != nil { return err @@ -498,7 +496,7 @@ func (s *Site) RenderIndexes() error { } func (s *Site) RenderIndexesIndexes() (err error) { - layout := "indexes" + slash + "indexes.html" + layout := "indexes/indexes.html" if s.Tmpl.Lookup(layout) != nil { for singular, plural := range s.Config.Indexes { n := s.NewNode() @@ -512,7 +510,7 @@ func (s *Site) RenderIndexesIndexes() (err error) { n.Data["OrderedIndex"] = s.Info.Indexes[plural] x, err := s.RenderThing(n, layout) - s.WritePublic(plural+slash+"index.html", x.Bytes()) + s.WritePublic(plural+"/index.html", x.Bytes()) return err } } @@ -528,13 +526,13 @@ func (s *Site) RenderLists() error { n.RSSlink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(section+".xml"))) n.Date = data[0].Date n.Data["Pages"] = data - layout := "indexes" + slash + section + ".html" + layout := "indexes/" + section + ".html" x, err := s.RenderThing(n, layout) if err != nil { return err } - s.WritePublic(section+slash+"index.html", x.Bytes()) + s.WritePublic(section+"/index.html", x.Bytes()) if a := s.Tmpl.Lookup("rss.xml"); a != nil { // XML Feed @@ -546,7 +544,7 @@ func (s *Site) RenderLists() error { n.Permalink = template.HTML(string(n.Site.BaseUrl) + n.Url) y := s.NewXMLBuffer() s.Tmpl.ExecuteTemplate(y, "rss.xml", n) - s.WritePublic(section+slash+"index.xml", y.Bytes()) + s.WritePublic(section+"/index.xml", y.Bytes()) } } return nil @@ -587,7 +585,7 @@ func (s *Site) RenderHomePage() error { func (s *Site) Stats() { fmt.Printf("%d pages created \n", len(s.Pages)) for _, pl := range s.Config.Indexes { - fmt.Printf("%d %s created\n", len(s.Indexes[pl]), pl) + fmt.Printf("%d %s index created\n", len(s.Indexes[pl]), pl) } }