Mercurial > yakumo_izuru > aya
comparison main.go @ 52:befb74a09424 draft
Code cleanup
author | prologic |
---|---|
date | Thu, 28 Oct 2021 16:10:15 +0000 |
parents | e054275d0938 |
children |
comparison
equal
deleted
inserted
replaced
51:e054275d0938 | 52:befb74a09424 |
---|---|
31 if oldext == "" { | 31 if oldext == "" { |
32 oldext = filepath.Ext(path) | 32 oldext = filepath.Ext(path) |
33 } | 33 } |
34 if oldext == "" || strings.HasSuffix(path, oldext) { | 34 if oldext == "" || strings.HasSuffix(path, oldext) { |
35 return strings.TrimSuffix(path, oldext) + newext | 35 return strings.TrimSuffix(path, oldext) + newext |
36 } else { | 36 } |
37 return path | 37 return path |
38 } | |
39 } | 38 } |
40 | 39 |
41 // globals returns list of global OS environment variables that start | 40 // globals returns list of global OS environment variables that start |
42 // with ZS_ prefix as Vars, so the values can be used inside templates | 41 // with ZS_ prefix as Vars, so the values can be used inside templates |
43 func globals() Vars { | 42 func globals() Vars { |
167 fmt.Println(err) | 166 fmt.Println(err) |
168 } | 167 } |
169 } | 168 } |
170 } | 169 } |
171 } | 170 } |
172 return s, nil | 171 |
173 } | 172 } |
174 | 173 |
175 // Renders markdown with the given layout into html expanding all the macros | 174 // Renders markdown with the given layout into html expanding all the macros |
176 func buildMarkdown(path string, w io.Writer, vars Vars) error { | 175 func buildMarkdown(path string, w io.Writer, vars Vars) error { |
177 v, body, err := getVars(path, vars) | 176 v, body, err := getVars(path, vars) |