Changeset 37 in code


Ignore:
Timestamp:
Sep 2, 2015, 5:43:31 PM (10 years ago)
Author:
zaitsev.serge
Message:

fixed variable override order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zs.go

    r36 r37  
    100100        s := string(b)
    101101
    102         // Copy globals first
     102        // Pick some default values for content-dependent variables
    103103        v := Vars{}
     104        title := strings.Replace(strings.Replace(path, "_", " ", -1), "-", " ", -1)
     105        v["title"] = strings.ToTitle(title)
     106        v["description"] = ""
     107
     108        // Copy globals (will override title and description for markdown layouts
    104109        for name, value := range globals {
    105110                v[name] = value
    106111        }
    107112
    108         // Override them by default values extracted from file name/path
     113        // Add default values extracted from file name/path
    109114        if _, err := os.Stat(filepath.Join(ZSDIR, "layout.amber")); err == nil {
    110115                v["layout"] = "layout.amber"
     
    112117                v["layout"] = "layout.html"
    113118        }
    114         title := strings.Replace(strings.Replace(path, "_", " ", -1), "-", " ", -1)
    115         v["title"] = strings.ToTitle(title)
    116         v["description"] = ""
    117119        v["file"] = path
    118120        v["url"] = path[:len(path)-len(filepath.Ext(path))] + ".html"
Note: See TracChangeset for help on using the changeset viewer.