tpl/time: Re-add the time example - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit a119ef693faf5dc346fec78ca8a18948ec65a993
DIR parent 1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6
HTML 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:
M docs/data/docs.json | 6 ++----
M tpl/time/init.go | 7 +++++++
2 files changed, 9 insertions(+), 4 deletions(-)
---
DIR 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"
]
]
DIR 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
}