Generate changelog release info with Hugo rather than when generating changelog (#2033)
parent
baa60bf728
commit
6f1e64cb12
@ -1,15 +0,0 @@
|
||||
<!--
|
||||
This is a header file for the generated changelog.
|
||||
|
||||
Variables:
|
||||
VERSION = Replaced by the version number (eg: v1.2)
|
||||
DATE = Replaced by the date (eg: April 01, 2021)
|
||||
-->
|
||||
|
||||
<table class="release-info">
|
||||
<tr><th>Git commit</th><td><a href="https://github.com/matrix-org/matrix-spec/tree/VERSION">https://github.com/matrix-org/matrix-spec/tree/VERSION</a></td>
|
||||
<tr><th>Release date</th><td>DATE</td>
|
||||
<tr><th>Checklist</th><td><a href="{{< relref path="changelog/VERSION" outputFormat="Checklist" >}}">checklist.md</a></td>
|
||||
</table>
|
||||
|
||||
<!-- Intentionally blank line to ensure headers work in the concatenated changelog -->
|
||||
@ -0,0 +1 @@
|
||||
Generate the changelog release info with Hugo, rather than the changelog generation script.
|
||||
@ -1,4 +0,0 @@
|
||||
{{ .RawContent
|
||||
| replaceRE "\n- " "\n- [ ] "
|
||||
| replaceRE "<!--(.|\\s)*?-->\n?" ""
|
||||
| replaceRE "<tr><th>Checklist.*\n" "" }}
|
||||
@ -0,0 +1,34 @@
|
||||
{{- /*
|
||||
|
||||
Template to render a page with a `changelog` layout as a markdown checklist.
|
||||
|
||||
This transforms the markdown source of the changelog to change list items,
|
||||
which in turn are them transformed into a rendered checklist.
|
||||
|
||||
Stable releases will additionally have a table at the top of the page with
|
||||
information about the release, including:
|
||||
|
||||
* A link to the matrix-spec repository at the time of the release, with the
|
||||
version taken from the `linkTitle` in the frontmatter of the page.
|
||||
* The date of the release, taken from the `date` in the frontmatter of the
|
||||
page.
|
||||
|
||||
*/ -}}
|
||||
|
||||
{{ $version := lower .LinkTitle -}}
|
||||
# Matrix Specification {{ .Title }}
|
||||
|
||||
{{ if ne $version "unstable" -}}
|
||||
{{- /*
|
||||
|
||||
Most markdown parsers require the header to recognize a markdown table,
|
||||
so add an empty header.
|
||||
|
||||
*/ -}}
|
||||
| | |
|
||||
|---|---|
|
||||
| Git commit | {{ printf "https://github.com/matrix-org/matrix-spec/tree/%s" $version }} |
|
||||
| Release date | {{ .Date | time.Format ":date_long" }} |
|
||||
{{ end -}}
|
||||
|
||||
{{ .RawContent | replaceRE "\n- " "\n- [ ] " }}
|
||||
@ -0,0 +1,46 @@
|
||||
{{- /*
|
||||
|
||||
Template to render a page with a `changelog` layout or the `changelog`
|
||||
section page. This conflation seems to be a limitation of Hugo currently, it
|
||||
uses this template for both cases.
|
||||
|
||||
For the `changelog` section page, this redirects the page to the latest
|
||||
version's changelog page.
|
||||
|
||||
For a page with a `changelog` layout, this adds a table at the top of the
|
||||
page with information about the release:
|
||||
|
||||
* A link to the matrix-spec repository at the time of the release, with the
|
||||
version taken from the `linkTitle` in the frontmatter of the page, unless
|
||||
it is the unstable changelog.
|
||||
* The date of the release, taken from the `date` in the frontmatter of the
|
||||
page, unless it is the unstable changelog.
|
||||
* A link to the markdown checklist format of the changelog. The `outputs` in
|
||||
the frontmatter of the page must include `checklist`.
|
||||
|
||||
*/ -}}
|
||||
|
||||
{{ define "main" }}
|
||||
{{ if .IsSection -}}
|
||||
{{ with index .RegularPages.ByDate.Reverse 0 -}}
|
||||
<meta http-equiv="refresh" content="0; url={{ .RelPermalink }}">
|
||||
{{ end -}}
|
||||
{{ else -}}
|
||||
{{ $version := lower .LinkTitle -}}
|
||||
<div class="td-content">
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
<table class="release-info">
|
||||
{{ if ne $version "unstable" -}}
|
||||
{{ $commitLink := printf "https://github.com/matrix-org/matrix-spec/tree/%s" $version -}}
|
||||
<tr><th>Git commit</th><td><a href="{{ $commitLink }}">{{ $commitLink }}</a></td>
|
||||
<tr><th>Release date</th><td>{{ .Date | time.Format ":date_long" }}</td>
|
||||
{{ end -}}
|
||||
{{ $checklist := .OutputFormats.Get "checklist" -}}
|
||||
<tr><th>Checklist</th><td><a href="{{ $checklist.RelPermalink }}">checklist.md</a></td>
|
||||
</table>
|
||||
|
||||
{{ .Content }}
|
||||
</div>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
@ -1,8 +0,0 @@
|
||||
{{/*
|
||||
This template is used to redirect the changelog section under
|
||||
"content/changelogs" to the latest version's changelog page.
|
||||
*/}}
|
||||
|
||||
{{ with index .Page.RegularPages.ByDate.Reverse 0 }}
|
||||
<meta http-equiv="refresh" content="0; url={{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
Loading…
Reference in New Issue