diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-10-20 18:33:38 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-10-20 18:33:38 -0400 |
commit | f15fe10c6bb0000f26ada94f4216bf216957ee2a (patch) | |
tree | 0faa7534eee2a3591152fb97ca54b9c727235b51 | |
parent | 6a4d61c2414023417cc332d8424f5bbeb79ea958 (diff) |
include a last-updated timestamp in the HTML output
-rw-r--r-- | pem2html.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pem2html.go b/pem2html.go index 02918cf..fda259f 100644 --- a/pem2html.go +++ b/pem2html.go @@ -75,6 +75,9 @@ var tmpl = template.Must(template.New("pem2html"). </head> <body> <table class=sortable> + <caption> + <p>Updated {{.now.Local.Format "2006-01-02 15:04:05"}}</p> + </caption> <tr> <th>Logged</th> <th>NotBefore</th> @@ -82,7 +85,7 @@ var tmpl = template.Must(template.New("pem2html"). <th>Subject.CN</th> <th>Issuer.O</th> </tr> -{{range $cert := .}} +{{range $cert := .certs}} <tr> <td style="background-color: {{$cert.Updated | green}}"><a target="_blank" href="{{$cert.Url}}">{{$cert.Updated.Local.Format "2006-01-02 15:04:05"}}</a></td> <td><a target="_blank" href="{{$cert.Url}}">{{$cert.X509.NotBefore.Local.Format "2006-01-02"}}</a></td> @@ -93,7 +96,8 @@ var tmpl = template.Must(template.New("pem2html"). {{end}} </table> </body> -</html>`)) +</html> +`)) var now = time.Now() @@ -196,5 +200,5 @@ func main() { } sort.Sort(certs) - handleErr(tmpl.Execute(os.Stdout, certs), "Could not execute template: %v\n") + handleErr(tmpl.Execute(os.Stdout, map[string]interface{}{"certs":certs, "now": now}), "Could not execute template: %v\n") } |