From ca97293cb236843779c3c8764288ca2e6317206f Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien <mechiel@ueber.net> Date: Thu, 21 Dec 2023 09:46:01 +0100 Subject: [PATCH] add last commit date to cross-reference page --- rfc/Makefile | 2 +- rfc/xr.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/rfc/Makefile b/rfc/Makefile index 017578e..354c56e 100644 --- a/rfc/Makefile +++ b/rfc/Makefile @@ -7,4 +7,4 @@ link: go run -tags link link.go -- ../*.go ../*/*.go xr: - go run xr.go -- xr-dev $$(git rev-parse --short HEAD) $$(git tag | tail -n1) ../*.go ../*/*.go + go run xr.go -- xr-dev $$(git rev-parse --short HEAD) $$(git log -1 --date=format:"%Y-%m-%d" --format="%ad") $$(git tag | tail -n1) ../*.go ../*/*.go diff --git a/rfc/xr.go b/rfc/xr.go index 52195a3..6088b11 100644 --- a/rfc/xr.go +++ b/rfc/xr.go @@ -42,20 +42,21 @@ func main() { var release bool flag.BoolVar(&release, "release", false, "generate cross-references for a release, highlighting the release version as active page") flag.Usage = func() { - log.Println("usage: go run xr.go destdir revision latestrelease ../*.go ../*/*.go") + log.Println("usage: go run xr.go destdir revision date latestrelease ../*.go ../*/*.go") flag.PrintDefaults() os.Exit(2) } flag.Parse() args := flag.Args() - if len(args) < 3 { + if len(args) < 4 { flag.Usage() } destdir = args[0] revision := args[1] - latestRelease := args[2] - srcfiles := args[3:] + date := args[2] + latestRelease := args[3] + srcfiles := args[4:] // Generate code.html index. srcdirs := map[string][]string{} @@ -278,6 +279,7 @@ for (const a of document.querySelectorAll('a')) { index = strings.ReplaceAll(index, "REVISIONWEIGHT", "bold") } index = strings.ReplaceAll(index, "REVISION", revision) + index = strings.ReplaceAll(index, "DATE", date) index = strings.ReplaceAll(index, "RELEASE", latestRelease) xwritefile("index.html", []byte(index)) } @@ -294,7 +296,7 @@ body { margin: 0; padding: 0; font-family: 'ubuntu', 'lato', sans-serif; } </head> <body> <div style="display: flex; flex-direction: column; height: 100vh"> - <div style="padding: .5em"><a href="../../">mox</a>, <span title="The mox code contains references to RFCs, often with specific line numbers. RFCs are generated that point back to the source code. This page shows code and RFCs side by side, with cross-references hyperlinked.">cross-referenced code and RFCs</span>: <a href="../RELEASE/" style="font-weight: RELEASEWEIGHT" title="released version">RELEASE</a> <a href="../dev/" style="font-weight: REVISIONWEIGHT" title="branch main">dev</a> (<a href="https://github.com/mjl-/mox/commit/REVISION" title="Source code commit for this revision.">commit REVISION</a>)</div> + <div style="padding: .5em"><a href="../../">mox</a>, <span title="The mox code contains references to RFCs, often with specific line numbers. RFCs are generated that point back to the source code. This page shows code and RFCs side by side, with cross-references hyperlinked.">cross-referenced code and RFCs</span>: <a href="../RELEASE/" style="font-weight: RELEASEWEIGHT" title="released version">RELEASE</a> <a href="../dev/" style="font-weight: REVISIONWEIGHT" title="branch main">dev</a> (<a href="https://github.com/mjl-/mox/commit/REVISION" title="Source code commit for this revision.">commit REVISION</a>, DATE)</div> <div style="flex-grow: 1; display: flex; align-items: stretch"> <div style="flex-grow: 1; margin: 1ex; position: relative; display: flex; flex-direction: column"> <div style="margin-bottom: .5ex"><span id="codefile" style="font-weight: bold">...</span>, <a href="code.html" target="code">index</a></div>