commit a119ef693faf5dc346fec78ca8a18948ec65a993
parent 1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6
Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sat, 20 May 2017 11:41:43 +0300
tpl/time: Re-add the time example
Diffstat:
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/docs/data/docs.json b/docs/data/docs.json
@@ -1439,12 +1439,10 @@
"Args": [
"v"
],
- "Aliases": [
- "asTime"
- ],
+ "Aliases": null,
"Examples": [
[
- "{{ (asTime \"2015-01-21\").Year }}",
+ "{{ (time \"2015-01-21\").Year }}",
"2015"
]
]
diff --git a/tpl/time/init.go b/tpl/time/init.go
@@ -58,6 +58,13 @@ func init() {
[][2]string{},
)
+ ns.AddMethodMapping(ctx.AsTime,
+ nil,
+ [][2]string{
+ {`{{ (time "2015-01-21").Year }}`, `2015`},
+ },
+ )
+
return ns
}