projects
/
brevno-suite
/
hugo
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b41622b
)
Make 'read a string' code understand float64 (json) and int (yaml) as well as actual...
author
Ask Bjørn Hansen
<ask@develooper.com>
Mon, 17 Feb 2014 09:26:46 +0000
(
01:26
-0800)
committer
spf13
<steve.francia@gmail.com>
Tue, 18 Feb 2014 23:44:56 +0000
(18:44 -0500)
hugolib/metadata.go
patch
|
blob
|
history
diff --git
a/hugolib/metadata.go
b/hugolib/metadata.go
index 6d4a19c1e0104715c94fc0e94481431b5bd3e6fd..38126ad9398338205d5336c4cb8c0b30aa243275 100644
(file)
--- a/
hugolib/metadata.go
+++ b/
hugolib/metadata.go
@@
-149,8
+149,12
@@
func interfaceToString(i interface{}) string {
switch s := i.(type) {
case string:
return s
+ case float64:
+ return strconv.FormatFloat(i.(float64), 'f', -1, 64)
+ case int:
+ return strconv.FormatInt(int64(i.(int)), 10)
default:
- errorf(
"Only Strings are supported for this key"
)
+ errorf(
fmt.Sprintf("Only Strings are supported for this key (got type '%T'): %s", s, s)
)
}
return ""