1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

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

@@ -14,6 +14,8 @@ func TestFileTranslator(t *testing.T) {
{"foo", "foo/index.html"},
{"foo.html", "foo/index.html"},
{"foo.xhtml", "foo/index.xhtml"},
{"section", "section/index.html"},
{"section/", "section/index.html"},
{"section/foo", "section/foo/index.html"},
{"section/foo.html", "section/foo/index.html"},
{"section/foo.rss", "section/foo/index.rss"},
@@ -34,7 +36,7 @@ func TestFileTranslator(t *testing.T) {
func TestFileTranslatorBase(t *testing.T) {
tests := []struct {
content string
content string
expected string
}{
{"/", "a/base/index.html"},
@@ -64,6 +66,7 @@ func TestTranslateUglyUrls(t *testing.T) {
}{
{"foo.html", "foo.html"},
{"/", "index.html"},
{"section", "section.html"},
{"index.html", "index.html"},
}