Normalize paths within hugo

filepath was used inconsistently throughout the hugolib.  With the
introduction of source and target modules, all path are normalized to
"/".  This simplifies the processing of paths.  It does mean that
contributors need to be aware of using path/filepath in any module other
than source or target is not recommended.  The current exception is
hugolib/config.go
This commit is contained in:
Noah Campbell
2013-09-12 10:48:59 -07:00
parent 998b2f73f8
commit 74b55fc7c8
8 changed files with 46 additions and 43 deletions

View File

@@ -3,7 +3,6 @@ package hugolib
import (
"bytes"
"io"
"path/filepath"
"strings"
"testing"
)
@@ -49,8 +48,8 @@ func TestPageCount(t *testing.T) {
s := &Site{Target: target}
s.prepTemplates()
must(s.addTemplate("indexes/blue.html", INDEX_TEMPLATE))
s.Pages = append(s.Pages, mustReturn(ReadFrom(strings.NewReader(SLUG_DOC_1), filepath.FromSlash("content/blue/doc1.md"))))
s.Pages = append(s.Pages, mustReturn(ReadFrom(strings.NewReader(SLUG_DOC_2), filepath.FromSlash("content/blue/doc2.md"))))
s.Pages = append(s.Pages, mustReturn(ReadFrom(strings.NewReader(SLUG_DOC_1), "content/blue/doc1.md")))
s.Pages = append(s.Pages, mustReturn(ReadFrom(strings.NewReader(SLUG_DOC_2), "content/blue/doc2.md")))
if err := s.BuildSiteMeta(); err != nil {
t.Errorf("Unable to build site metadata: %s", err)
@@ -60,7 +59,7 @@ func TestPageCount(t *testing.T) {
t.Errorf("Unable to render site lists: %s", err)
}
blueIndex := target.files["blue/index.html"]
blueIndex := target.files["blue"]
if blueIndex == nil {
t.Errorf("No indexed rendered. %v", target.files)
}