Changeset 36 in code


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

removed fs/walk error check, added title default value heuristics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zs.go

    r35 r36  
    112112                v["layout"] = "layout.html"
    113113        }
     114        title := strings.Replace(strings.Replace(path, "_", " ", -1), "-", " ", -1)
     115        v["title"] = strings.ToTitle(title)
     116        v["description"] = ""
    114117        v["file"] = path
    115118        v["url"] = path[:len(path)-len(filepath.Ext(path))] + ".html"
     
    130133                        for key, value := range vars {
    131134                                v[key] = value
    132                                 log.Println(key, value)
    133135                        }
    134136                }
     
    325327        for {
    326328                os.Mkdir(PUBDIR, 0755)
    327                 err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
     329                filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
    328330                        // ignore hidden files and directories
    329331                        if filepath.Base(path)[0] == '.' || strings.HasPrefix(path, ".") {
     
    332334                        // inform user about fs walk errors, but continue iteration
    333335                        if err != nil {
    334                                 log.Println("ERROR:", err)
     336                                fmt.Println("error:", err)
    335337                                return nil
    336338                        }
     
    350352                        return nil
    351353                })
    352                 if err != nil {
    353                         log.Println("ERROR:", err)
    354                 }
    355354                if modified {
    356355                        // At least one file in this build cycle has been modified
Note: See TracChangeset for help on using the changeset viewer.