mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
tpl: Extend Jsonify to support options map
Add support for prefix and indent options used by json.MarshalIndent from the Go stdlib.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
1bc93021e3
commit
8568928aa8
@@ -1,4 +1,4 @@
|
||||
// Copyright 2017 The Hugo Authors. All rights reserved.
|
||||
// Copyright 2020 The Hugo Authors. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
@@ -48,7 +48,7 @@ func init() {
|
||||
[]string{"jsonify"},
|
||||
[][2]string{
|
||||
{`{{ (slice "A" "B" "C") | jsonify }}`, `["A","B","C"]`},
|
||||
{`{{ (slice "A" "B" "C") | jsonify " "}}`, "[\n \"A\",\n \"B\",\n \"C\"\n]"},
|
||||
{`{{ (slice "A" "B" "C") | jsonify (dict "indent" " ") }}`, "[\n \"A\",\n \"B\",\n \"C\"\n]"},
|
||||
},
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user