diff options
author | Cameron Moore <moorereason@gmail.com> | 2020-03-23 21:03:52 -0500 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-04-07 20:01:57 +0200 |
commit | 8568928aa8e82a6bd7de4555c3703d8835fbd25b (patch) | |
tree | 8868bac9237f673eaa837b5c9cafc2e14623b3ad /tpl/encoding/init.go | |
parent | 1bc93021e3dca6405628f6fdd2dc32cff9c9836c (diff) |
tpl: Extend Jsonify to support options map
Add support for prefix and indent options used by json.MarshalIndent
from the Go stdlib.
Diffstat (limited to 'tpl/encoding/init.go')
-rw-r--r-- | tpl/encoding/init.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tpl/encoding/init.go b/tpl/encoding/init.go index 8ec9f1a58..f97b17182 100644 --- a/tpl/encoding/init.go +++ b/tpl/encoding/init.go @@ -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]"}, }, ) |