From 56b0884d64bac7ffb182672278f76392a429f536 Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Wed, 2 Sep 2015 19:41:06 +0200 Subject: [PATCH] removed fs/walk error check, added title default value heuristics --- zs.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/zs.go b/zs.go index f5e4836..de98d56 100644 --- a/zs.go +++ b/zs.go @@ -111,6 +111,9 @@ func getVars(path string, globals Vars) (Vars, string, error) { } else { v["layout"] = "layout.html" } + title := strings.Replace(strings.Replace(path, "_", " ", -1), "-", " ", -1) + v["title"] = strings.ToTitle(title) + v["description"] = "" v["file"] = path v["url"] = path[:len(path)-len(filepath.Ext(path))] + ".html" v["output"] = filepath.Join(PUBDIR, v["url"]) @@ -129,7 +132,6 @@ func getVars(path string, globals Vars) (Vars, string, error) { } else { for key, value := range vars { v[key] = value - log.Println(key, value) } } if strings.HasPrefix(v["url"], "./") { @@ -324,14 +326,14 @@ func buildAll(watch bool) { vars := globals() for { os.Mkdir(PUBDIR, 0755) - err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error { + filepath.Walk(".", func(path string, info os.FileInfo, err error) error { // ignore hidden files and directories if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") { return nil } // inform user about fs walk errors, but continue iteration if err != nil { - log.Println("ERROR:", err) + fmt.Println("error:", err) return nil } @@ -349,9 +351,6 @@ func buildAll(watch bool) { } return nil }) - if err != nil { - log.Println("ERROR:", err) - } if modified { // At least one file in this build cycle has been modified run(vars, "posthook") -- 2.43.0