mirror of
https://git.mills.io/prologic/zs
synced 2024-11-21 21:06:10 +03:00
moved html rendering into a separate function
This commit is contained in:
parent
e91e6930e0
commit
862f4d7162
14
zs.go
14
zs.go
@ -145,15 +145,23 @@ func buildMarkdown(path string) error {
|
||||
return err
|
||||
}
|
||||
v["content"] = string(blackfriday.MarkdownBasic([]byte(content)))
|
||||
b, err = ioutil.ReadFile(filepath.Join(ZSDIR, v["layout"]))
|
||||
return buildPlain(filepath.Join(ZSDIR, v["layout"]), v)
|
||||
}
|
||||
|
||||
func buildPlain(path string, vars map[string]string) error {
|
||||
b, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
content, err = render(string(b), v, eval)
|
||||
content, err := render(string(b), vars, eval)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = ioutil.WriteFile(v["output"], []byte(content), 0666)
|
||||
output := filepath.Join(PUBDIR, path)
|
||||
if s, ok := vars["output"]; ok {
|
||||
output = s
|
||||
}
|
||||
err = ioutil.WriteFile(output, []byte(content), 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user