]> Nishi Git Mirror - aya.git/commitdiff
removed fs/walk error check, added title default value heuristics
authorSerge A. Zaitsev <zaitsev.serge@gmail.com>
Wed, 2 Sep 2015 17:41:06 +0000 (19:41 +0200)
committerSerge A. Zaitsev <zaitsev.serge@gmail.com>
Wed, 2 Sep 2015 17:41:06 +0000 (19:41 +0200)
zs.go

diff --git a/zs.go b/zs.go
index f5e483606bdd166ab64463a365abd3c05bd6045c..de98d56a3677a7fe6bc77c6326c8bc4f8a1d03ca 100644 (file)
--- 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")