diff options
author | Bjørn Erik Pedersen <[email protected]> | 2017-03-15 08:04:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2017-03-15 08:04:52 +0100 |
commit | d8923eb676101aeec3e2789aa13e9dc2bb13a8bb (patch) | |
tree | 3f94fcd40cc8ef5cf1a5bc7b1cbeb28ffe6a0163 /parser/frontmatter.go | |
parent | d6093aba4d0b74804378013c2326deb3cca58d7e (diff) | |
download | hugo-d8923eb676101aeec3e2789aa13e9dc2bb13a8bb.tar.gz hugo-d8923eb676101aeec3e2789aa13e9dc2bb13a8bb.zip |
Update to new go-toml API
Closes #3142
Diffstat (limited to 'parser/frontmatter.go')
-rw-r--r-- | parser/frontmatter.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/parser/frontmatter.go b/parser/frontmatter.go index 797c6fcf0..d97bc4c4d 100644 --- a/parser/frontmatter.go +++ b/parser/frontmatter.go @@ -52,12 +52,13 @@ func InterfaceToConfig(in interface{}, mark rune, w io.Writer) error { return err case rune(TOMLLead[0]): - tree := toml.TreeFromMap(in.(map[string]interface{})) - b := []byte(tree.String()) + tree, err := toml.TreeFromMap(in.(map[string]interface{})) + if err != nil { + return err + } - _, err := w.Write(b) + _, err = tree.WriteTo(w) return err - case rune(JSONLead[0]): b, err := json.MarshalIndent(in, "", " ") if err != nil { @@ -107,6 +108,7 @@ func InterfaceToFrontMatter(in interface{}, mark rune, w io.Writer) error { } err = InterfaceToConfig(in, mark, w) + if err != nil { return err } |