~sircmpwn/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH openring] allow custom date formats

Details
Message ID
<20191221194444.23555-1-noah@noahloomans.com>
DKIM signature
missing
Download raw message
Patch: +4 -1
This adds a new datef function instead of changing date function in an
effort to keep backwards compatibility.

datef is intentionally used in the example to make it clear to the user
that it is possible to set a custom date format.
---
 in.html     | 2 +-
 openring.go | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/in.html b/in.html
index d1437e8..a9f63e6 100644
--- a/in.html
+++ b/in.html
@@ -10,7 +10,7 @@
      <small class="source">
        via <a href="{{.SourceLink}}">{{.SourceTitle}}</a>
      </small>
      <small class="date">{{.Date | date}}</small>
      <small class="date">{{.Date | datef "January 2, 2006"}}</small>
    </div>
    {{end}}
  </section>
diff --git a/openring.go b/openring.go
index cbaba1f..4f74631 100644
--- a/openring.go
+++ b/openring.go
@@ -76,6 +76,9 @@ func main() {
			"date": func(t time.Time) string {
				return t.Format("January 2, 2006")
			},
			"datef": func(fmt string, t time.Time) string {
				return t.Format(fmt)
			},
		}).
		Parse(string(input))
	if err != nil {
-- 
2.24.0
Details
Message ID
<BZCC2DXJUB7Z.GR7BOZM8J8QG@homura>
In-Reply-To
<20191221194444.23555-1-noah@noahloomans.com> (view parent)
DKIM signature
missing
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/openring
   6d79d2e..ec47d0b  master -> master
Details
Message ID
<C0UHCOUICEKH.56X9QMPEMWUH@mars>
In-Reply-To
<BZCC2DXJUB7Z.GR7BOZM8J8QG@homura> (view parent)
DKIM signature
pass
Download raw message
Hi,

I just tried to use this tool and got this error:

panic: template: template:13: function "datef" not defined

It looks like it has something to do with this PATCH.

Am I missing something?
Details
Message ID
<C0UI0YQI9EBB.3KDKXZTVCDTY5@mars>
In-Reply-To
<BZCC2DXJUB7Z.GR7BOZM8J8QG@homura> (view parent)
DKIM signature
pass
Download raw message
Okay. If I build it from source it is working. The prebuild binary is
not working.
Review patch Export thread (mbox)