# HG changeset patch # User zaitsev.serge # Date 1441215811 0 # Node ID a88ccfbd4103d2aeb12143a847565f3f203c1a03 # Parent 0498cb3afc1d995f3a1f3b61872919e580586840 fixed variable override order diff -r 0498cb3afc1d -r a88ccfbd4103 zs.go --- a/zs.go Wed Sep 02 17:41:06 2015 +0000 +++ b/zs.go Wed Sep 02 17:43:31 2015 +0000 @@ -99,21 +99,23 @@ } s := string(b) - // Copy globals first + // Pick some default values for content-dependent variables v := Vars{} + title := strings.Replace(strings.Replace(path, "_", " ", -1), "-", " ", -1) + v["title"] = strings.ToTitle(title) + v["description"] = "" + + // Copy globals (will override title and description for markdown layouts for name, value := range globals { v[name] = value } - // Override them by default values extracted from file name/path + // Add default values extracted from file name/path if _, err := os.Stat(filepath.Join(ZSDIR, "layout.amber")); err == nil { v["layout"] = "layout.amber" } 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"])