diff options
-rw-r--r-- | commands/new.go | 2 | ||||
-rw-r--r-- | hugolib/menu_old_test.go | 13 | ||||
-rw-r--r-- | parser/frontmatter.go | 18 |
3 files changed, 9 insertions, 24 deletions
diff --git a/commands/new.go b/commands/new.go index d8548ebdc..964102aac 100644 --- a/commands/new.go +++ b/commands/new.go @@ -355,7 +355,7 @@ func newContentPathSection(path string) (string, string) { } func createConfig(fs *hugofs.Fs, inpath string, kind string) (err error) { - in := map[string]interface{}{ + in := map[string]string{ "baseURL": "http://example.org/", "title": "My New Hugo Site", "languageCode": "en-us", diff --git a/hugolib/menu_old_test.go b/hugolib/menu_old_test.go index 704a6f70a..036c855ad 100644 --- a/hugolib/menu_old_test.go +++ b/hugolib/menu_old_test.go @@ -25,7 +25,7 @@ import ( "path/filepath" - toml "github.com/pelletier/go-toml" + "github.com/BurntSushi/toml" "github.com/spf13/hugo/source" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -634,12 +634,7 @@ func setupMenuTests(t *testing.T, pageSources []source.ByteSource, configKeyValu } func tomlToMap(s string) (map[string]interface{}, error) { - tree, err := toml.Load(s) - - if err != nil { - return nil, err - } - - return tree.ToMap(), nil - + var data = make(map[string]interface{}) + _, err := toml.Decode(s, &data) + return data, err } diff --git a/parser/frontmatter.go b/parser/frontmatter.go index b773fe5ce..627d5ef49 100644 --- a/parser/frontmatter.go +++ b/parser/frontmatter.go @@ -20,8 +20,8 @@ import ( "io" "strings" + "github.com/BurntSushi/toml" "github.com/chaseadamsio/goorgeous" - toml "github.com/pelletier/go-toml" "gopkg.in/yaml.v2" ) @@ -52,13 +52,7 @@ func InterfaceToConfig(in interface{}, mark rune, w io.Writer) error { return err case rune(TOMLLead[0]): - tree, err := toml.TreeFromMap(in.(map[string]interface{})) - if err != nil { - return err - } - - _, err = tree.WriteTo(w) - return err + return toml.NewEncoder(w).Encode(in) case rune(JSONLead[0]): b, err := json.MarshalIndent(in, "", " ") if err != nil { @@ -176,14 +170,10 @@ func HandleTOMLMetaData(datum []byte) (interface{}, error) { m := map[string]interface{}{} datum = removeTOMLIdentifier(datum) - tree, err := toml.LoadReader(bytes.NewReader(datum)) - if err != nil { - return m, err - } + _, err := toml.Decode(string(datum), &m) - m = tree.ToMap() + return m, err - return m, nil } // removeTOMLIdentifier removes, if necessary, beginning and ending TOML |