diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-04-29 15:10:23 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-04-29 15:10:23 -0600 |
commit | 888c11cebe88008a1fdf64f7a10b010237ad1411 (patch) | |
tree | 7df5aa75e298bbb42e0a57ed77dd6cb85b399b0b | |
parent | 0cfc704ef59edabb1a342ebba5ab4588b1c17f0c (diff) |
imworkingon: DRY
-rw-r--r-- | cmd/generate/imworkingon.html.tmpl | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/cmd/generate/imworkingon.html.tmpl b/cmd/generate/imworkingon.html.tmpl index 43c5173..c1ea442 100644 --- a/cmd/generate/imworkingon.html.tmpl +++ b/cmd/generate/imworkingon.html.tmpl @@ -34,10 +34,8 @@ {{- end }} </section> - <section id="contribs-pending"> - <h2>In-progress work <a href="#contribs-pending">🔗</a></h2> - {{- range $contrib := .Contribs }} - {{- if or (eq $contrib.StatusClass "merged") (eq $contrib.StatusClass "released") }}{{ continue }}{{ end }} +{{- define "contrib" }} + {{ $contrib := . }} {{ $upstream := $contrib | getUpstream }} <article class="contrib {{ $contrib.StatusClass }}-contrib"> <div class="contrib-upstream-name"><a class="em" href="{{ index $upstream.URLs 0 }}">{{ $upstream.Name }}</a></div> @@ -60,34 +58,20 @@ {{- if $contrib.SponsoredBy }}<p>Sponsored-by: {{ $contrib.SponsoredBy }}</p>{{ end -}} </div> </article> +{{- end }} + + <section id="contribs-pending"> + <h2>In-progress work <a href="#contribs-pending">🔗</a></h2> + {{- range $contrib := .Contribs }} + {{- if or (eq $contrib.StatusClass "merged") (eq $contrib.StatusClass "released") }}{{ continue }}{{ end }} + {{ template "contrib" $contrib }} {{- end }} </section> <section id="contribs-completed"> <h2>Completed work <a href="#contribs-completed">🔗</a></h2> {{- range $contrib := .Contribs }} {{- if or (eq $contrib.StatusClass "merged") (eq $contrib.StatusClass "released") | not }}{{ continue }}{{ end }} - {{ $upstream := $contrib | getUpstream }} - <article class="contrib {{ $contrib.StatusClass }}-contrib"> - <div class="contrib-upstream-name"><a class="em" href="{{ index $upstream.URLs 0 }}">{{ $upstream.Name }}</a></div> - <div class="contrib-upstream-desc">{{ $upstream.Desc | md2html }}</div> - <div class="contrib-urls"> - {{- range $url := $contrib.URLs }} - <a href="{{ $url }}"><code>{{ $url }}</code></a><br /> - {{- end }} - </div> - <div class="contrib-tags"> - {{- range $tag := $contrib.Tags }} - <a href="#tag-{{ $tag }}">#{{ $tag }}</a> {{/* */}} - {{- end }} - </div> - <div class="contrib-submitted">Submitted: {{ timeTag $contrib.SubmittedAt "2006-01-02" }}</div> - <div class="contrib-updated">{{ if not $contrib.LastUpdatedAt.IsZero }}Last updated: {{ timeTag $contrib.LastUpdatedAt "2006-01-02" }}{{ end }}</div> - <div class="contrib-status">Status: {{ $contrib.Status }}</div> - <div class="contrib-desc"> - {{- $contrib.Desc | md2html }} - {{- if $contrib.SponsoredBy }}<p>Sponsored-by: {{ $contrib.SponsoredBy }}</p>{{ end -}} - </div> - </article> + {{ template "contrib" $contrib }} {{- end }} </section> <section id="standups"> |