mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-31 22:41:53 +02:00
Support typed bool, int and float in shortcode params
This means that you now can do: {{< vidur 9KvBeKu false true 32 3.14 >}} And the boolean and numeric values will be converted to `bool`, `int` and `float64`. If you want these to be strings, they must be quoted: {{< vidur 9KvBeKu "false" "true" "32" "3.14" >}} Fixes #6371
This commit is contained in:
@@ -126,7 +126,13 @@ func (ns *Namespace) refArgsToMap(args interface{}) (map[string]interface{}, err
|
||||
s string
|
||||
of string
|
||||
)
|
||||
switch v := args.(type) {
|
||||
|
||||
v := args
|
||||
if _, ok := v.([]interface{}); ok {
|
||||
v = cast.ToStringSlice(v)
|
||||
}
|
||||
|
||||
switch v := v.(type) {
|
||||
case map[string]interface{}:
|
||||
return v, nil
|
||||
case map[string]string:
|
||||
@@ -152,6 +158,7 @@ func (ns *Namespace) refArgsToMap(args interface{}) (map[string]interface{}, err
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
"path": s,
|
||||
"outputFormat": of,
|
||||
|
Reference in New Issue
Block a user