summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspf13 <steve.francia@gmail.com>2013-08-14 10:19:59 -0400
committerspf13 <steve.francia@gmail.com>2013-08-14 10:19:59 -0400
commit3c3fc45d3c34a7dcd1a0e9fd2636e7a5c5933e03 (patch)
treecc1d11530a86f2e7de3ad05eacef1d9d6dd66ab4
parent480e01eb153b6c6c4c11a7569d9802274772a568 (diff)
parent7a51a8a5a32881c01dcd472d818b4d774a487935 (diff)
Merge branch 'master' of github.com:spf13/hugo
-rw-r--r--hugolib/content_directory_test.go25
-rw-r--r--hugolib/path_seperators_windows_test.go2
-rw-r--r--hugolib/site.go13
3 files changed, 37 insertions, 3 deletions
diff --git a/hugolib/content_directory_test.go b/hugolib/content_directory_test.go
new file mode 100644
index 000000000..8b8d7c4f6
--- /dev/null
+++ b/hugolib/content_directory_test.go
@@ -0,0 +1,25 @@
+package hugolib
+
+import (
+ "testing"
+)
+
+func TestIgnoreDotFiles(t *testing.T) {
+ tests := []struct {
+ path string
+ ignore bool
+ } {
+ {"barfoo.md", false},
+ {"foobar/barfoo.md", false},
+ {"foobar/.barfoo.md", true},
+ {".barfoo.md", true},
+ {".md", true},
+ {"", true},
+ }
+
+ for _, test := range tests {
+ if ignored := ignoreDotFile(test.path); test.ignore != ignored {
+ t.Errorf("File not ignored. Expected: %t, got: %t", test.ignore, ignored)
+ }
+ }
+}
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 ad2171f8d..c0bce9f06 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -107,7 +107,9 @@ func (site *Site) Render() (err error) {
site.timerStep("render shortcodes")
site.AbsUrlify()
site.timerStep("absolute URLify")
- site.RenderIndexes()
+ if err = site.RenderIndexes(); err != nil {
+ return
+ }
site.RenderIndexesIndexes()
site.timerStep("render and write indexes")
site.RenderLists()
@@ -200,12 +202,15 @@ func (s *Site) initialize() {
site.Directories = append(site.Directories, path)
return nil
} else {
+ if ignoreDotFile(path) {
+ return nil
+ }
site.Files = append(site.Files, path)
return nil
}
}
- filepath.Walk(s.Config.GetAbsPath(s.Config.ContentDir), walker)
+ filepath.Walk(s.absContentDir(), walker)
s.Info = SiteInfo{
BaseUrl: template.URL(s.Config.BaseUrl),
@@ -217,6 +222,10 @@ func (s *Site) initialize() {
s.Shortcodes = make(map[string]ShortcodeFunc)
}
+func ignoreDotFile(path string) bool {
+ return filepath.Base(path)[0] == '.'
+}
+
func (s *Site) absLayoutDir() string {
return s.Config.GetAbsPath(s.Config.LayoutDir)
}