aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser/frontmatter.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-02-12 17:32:42 +0100
committerBjørn Erik Pedersen <[email protected]>2018-02-12 18:17:25 +0100
commitd4beef0d2bb8f6481fa80e1d938454a7d4e38814 (patch)
tree8838d2bb578ce0b4fad89ba249a7220be340e546 /parser/frontmatter.go
parent51213e0be19fc19dbca9815afa95c73bd6d159c2 (diff)
downloadhugo-d4beef0d2bb8f6481fa80e1d938454a7d4e38814.tar.gz
hugo-d4beef0d2bb8f6481fa80e1d938454a7d4e38814.zip
parser: Rename stringifyYAMLMapKeys to stringifyMapKeys
Diffstat (limited to 'parser/frontmatter.go')
-rw-r--r--parser/frontmatter.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/parser/frontmatter.go b/parser/frontmatter.go
index 5ed3ec11d..c5aaf807a 100644
--- a/parser/frontmatter.go
+++ b/parser/frontmatter.go
@@ -209,7 +209,7 @@ func HandleYAMLMetaData(datum []byte) (map[string]interface{}, error) {
// gotten from `json`.
if err == nil {
for k, v := range m {
- m[k] = stringifyYAMLMapKeys(v)
+ m[k] = stringifyMapKeys(v)
}
}
@@ -227,30 +227,30 @@ func HandleYAMLData(datum []byte) (interface{}, error) {
// and change all maps to map[string]interface{} like we would've
// gotten from `json`.
if err == nil {
- m = stringifyYAMLMapKeys(m)
+ m = stringifyMapKeys(m)
}
return m, err
}
-// stringifyKeysMapValue recurses into in and changes all instances of
+// stringifyMapKeys recurses into in and changes all instances of
// map[interface{}]interface{} to map[string]interface{}. This is useful to
// work around the impedence mismatch between JSON and YAML unmarshaling that's
// described here: https://github.com/go-yaml/yaml/issues/139
//
// Inspired by https://github.com/stripe/stripe-mock, MIT licensed
-func stringifyYAMLMapKeys(in interface{}) interface{} {
+func stringifyMapKeys(in interface{}) interface{} {
switch in := in.(type) {
case []interface{}:
res := make([]interface{}, len(in))
for i, v := range in {
- res[i] = stringifyYAMLMapKeys(v)
+ res[i] = stringifyMapKeys(v)
}
return res
case map[interface{}]interface{}:
res := make(map[string]interface{})
for k, v := range in {
- res[fmt.Sprintf("%v", k)] = stringifyYAMLMapKeys(v)
+ res[fmt.Sprintf("%v", k)] = stringifyMapKeys(v)
}
return res
default: