From d876629b4676ffc21380dadfbbec2b6d6a147c13 Mon Sep 17 00:00:00 2001 From: Noah Campbell Date: Tue, 13 Aug 2013 14:58:50 -0700 Subject: [PATCH] Formatting cleanup --- hugolib/indexing_test.go | 4 +--- hugolib/path_seperators_test.go | 8 +++----- hugolib/path_seperators_windows_test.go | 2 +- hugolib/site.go | 15 +++++++-------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/hugolib/indexing_test.go b/hugolib/indexing_test.go index 4d7d04f31..8bf74188b 100644 --- a/hugolib/indexing_test.go +++ b/hugolib/indexing_test.go @@ -1,8 +1,8 @@ package hugolib import ( - "testing" "strings" + "testing" ) func TestSitePossibleIndexes(t *testing.T) { @@ -14,5 +14,3 @@ func TestSitePossibleIndexes(t *testing.T) { t.Fatalf("possible indexes do not match [tags categories]. Got: %s", indexes) } } - - diff --git a/hugolib/path_seperators_test.go b/hugolib/path_seperators_test.go index f13eea1ef..9e112f82d 100644 --- a/hugolib/path_seperators_test.go +++ b/hugolib/path_seperators_test.go @@ -23,10 +23,10 @@ func TestDegenerateMissingFolderInPageFilename(t *testing.T) { } func TestNewPageWithFilePath(t *testing.T) { - toCheck := []struct{ - input string + toCheck := []struct { + input string section string - layout string + layout string }{ {filepath.Join("sub", "foobar.html"), "sub", "sub/single.html"}, {filepath.Join("content", "sub", "foobar.html"), "sub", "sub/single.html"}, @@ -47,5 +47,3 @@ func TestNewPageWithFilePath(t *testing.T) { } } } - - diff --git a/hugolib/path_seperators_windows_test.go b/hugolib/path_seperators_windows_test.go index 85b97222b..c6df7f61e 100644 --- a/hugolib/path_seperators_windows_test.go +++ b/hugolib/path_seperators_windows_test.go @@ -7,7 +7,7 @@ import ( func TestTemplatePathSeperator(t *testing.T) { config := Config{ LayoutDir: "c:\\a\\windows\\path\\layout", - Path: "c:\\a\\windows\\path", + Path: "c:\\a\\windows\\path", } s := &Site{Config: config} if name := s.generateTemplateNameFrom("c:\\a\\windows\\path\\layout\\sub1\\index.html"); name != "sub1/index.html" { diff --git a/hugolib/site.go b/hugolib/site.go index adec77f04..b94f2fae1 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -27,7 +27,6 @@ import ( //"sync" ) - var DefaultTimer = nitro.Initalize() type Site struct { @@ -377,7 +376,7 @@ func (s *Site) RenderPages() error { func (s *Site) WritePages() { for _, p := range s.Pages { - s.WritePublic(p.Section + "/" + p.OutFile, p.RenderedContent.Bytes()) + s.WritePublic(p.Section+"/"+p.OutFile, p.RenderedContent.Bytes()) } } @@ -399,7 +398,7 @@ func (s *Site) setOutFile(p *Page) { p.OutFile = replaceExtension(strings.TrimSpace(t), p.Extension) } else { file, _ := fileExt(strings.TrimSpace(t)) - p.OutFile = filepath.Join(file, "index." + p.Extension) + p.OutFile = filepath.Join(file, "index."+p.Extension) } } } @@ -435,7 +434,7 @@ func (s *Site) RenderIndexes() error { base = plural + "/" + k + "/" + "index" } - s.WritePublic(base + ".html", x.Bytes()) + s.WritePublic(base+".html", x.Bytes()) if a := s.Tmpl.Lookup("rss.xml"); a != nil { // XML Feed @@ -447,7 +446,7 @@ func (s *Site) RenderIndexes() error { } n.Permalink = template.HTML(string(n.Site.BaseUrl) + n.Url) s.Tmpl.ExecuteTemplate(y, "rss.xml", n) - s.WritePublic(base + ".xml", y.Bytes()) + s.WritePublic(base+".xml", y.Bytes()) } } } @@ -469,7 +468,7 @@ func (s *Site) RenderIndexesIndexes() (err error) { n.Data["OrderedIndex"] = s.Info.Indexes[plural] x, err := s.RenderThing(n, layout) - s.WritePublic(plural + "/index.html", x.Bytes()) + s.WritePublic(plural+"/index.html", x.Bytes()) return err } } @@ -491,7 +490,7 @@ func (s *Site) RenderLists() error { if err != nil { return err } - s.WritePublic(section + "/index.html", x.Bytes()) + s.WritePublic(section+"/index.html", x.Bytes()) if a := s.Tmpl.Lookup("rss.xml"); a != nil { // XML Feed @@ -499,7 +498,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 + "/index.xml", y.Bytes()) + s.WritePublic(section+"/index.xml", y.Bytes()) } } return nil