Merge pull request #2992 from wbamberg/support-changelogs
Support changelogs
This commit is contained in:
commit
1bfc3de6d6
20 changed files with 165 additions and 21 deletions
83
layouts/shortcodes/changelog/changelog-changes.html
Normal file
83
layouts/shortcodes/changelog/changelog-changes.html
Normal file
|
@ -0,0 +1,83 @@
|
|||
{{/*
|
||||
|
||||
This template is used to render the set of changes in the changelog page.
|
||||
|
||||
It expects to find a directory "changelogs" containing a subdirectory for
|
||||
each of the 5 APIs in the specification. Inside each of these directories
|
||||
it expects to find newsfragments describing changes to that API.
|
||||
|
||||
If the `version.status` setting in config.toml is anything other than
|
||||
"unstable", then it also expects to find a "release.yaml" file in /changelogs,
|
||||
which contains:
|
||||
- `tag`: Git tag for this release
|
||||
- `date`: date of this release
|
||||
It then renders this info a table, before the list of changes.
|
||||
|
||||
*/}}
|
||||
|
||||
{{ $path := path.Join "changelogs" }}
|
||||
{{ $status := .Site.Params.version.status }}
|
||||
|
||||
{{ if ne $status "unstable" }}
|
||||
{{ $release_info := readFile (path.Join $path "release.yaml") | transform.Unmarshal }}
|
||||
<table class="release-info">
|
||||
<tr><th>Git commit</th><td><a href="https://github.com/matrix-org/matrix-doc/tree/{{ $release_info.tag }}">https://github.com/matrix-org/matrix-doc/tree/{{ $release_info.tag }}</a></td>
|
||||
<tr><th>Release date</th><td>{{ $release_info.date }}</td>
|
||||
</table>
|
||||
{{ end }}
|
||||
|
||||
<h2 id=api-changes>Changes since last release</h2>
|
||||
{{ partial "render-api-changes" (dict "title" "Client-Server API" "id" "client-server-api" "path" (path.Join $path "client_server")) }}
|
||||
{{ partial "render-api-changes" (dict "title" "Server-Server API" "id" "server-server-api" "path" (path.Join $path "server_server")) }}
|
||||
{{ partial "render-api-changes" (dict "title" "Application Service API" "id" "application-service-api" "path" (path.Join $path "application_service")) }}
|
||||
{{ partial "render-api-changes" (dict "title" "Identity Service API" "id" "identity-service-api" "path" (path.Join $path "identity_service")) }}
|
||||
{{ partial "render-api-changes" (dict "title" "Push Gateway API" "id" "push-gateway-api" "path" (path.Join $path "push_gateway")) }}
|
||||
|
||||
{{ define "partials/render-api-changes" }}
|
||||
<h3 id="{{.id}}">{{ .title }}</h3>
|
||||
{{ $api_path := .path }}
|
||||
{{ $config_file := path.Join $api_path "pyproject.toml" }}
|
||||
{{ $config := readFile $config_file | transform.Unmarshal }}
|
||||
{{ $news_path := path.Join $api_path "newsfragments" }}
|
||||
{{ partial "render-newsfragments" (dict "config" $config "news_path" $news_path )}}
|
||||
{{ end }}
|
||||
|
||||
{{ define "partials/render-newsfragments" }}
|
||||
{{ $config := .config }}
|
||||
{{ $news_path := .news_path }}
|
||||
|
||||
{{ $types := dict }}
|
||||
{{ range $config.tool.towncrier.type }}
|
||||
{{ $types = merge $types (dict .directory (slice)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ range (readDir $news_path) }}
|
||||
|
||||
{{ $pieces := split .Name "." }}
|
||||
|
||||
{{ $ticket := index $pieces 0 }}
|
||||
{{ $description := readFile (path.Join $news_path .Name ) }}
|
||||
{{ $change_info := (dict "ticket" $ticket "description" $description )}}
|
||||
|
||||
{{ $type := index $pieces 1 }}
|
||||
{{ $instances := index $types $type }}
|
||||
{{ $instances = $instances | append $change_info }}
|
||||
{{ $types = merge $types (dict $type $instances) }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
<ul>
|
||||
{{ range $config.tool.towncrier.type }}
|
||||
{{ $changes_of_type := (index $types .directory) }}
|
||||
{{ if $changes_of_type }}
|
||||
<li><strong>{{.name}}</strong>
|
||||
<p><ul>
|
||||
{{ range $changes_of_type }}
|
||||
<li><a href="https://github.com/matrix-org/matrix-doc/issues/{{.ticket}}"><strong>{{ .ticket }}: </strong></a>{{ .description | markdownify }}</li>
|
||||
{{ end }}
|
||||
</ul></p>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
15
layouts/shortcodes/changelog/changelog-description.html
Normal file
15
layouts/shortcodes/changelog/changelog-description.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{{/*
|
||||
|
||||
This template is used to provide different content for the unstable spec
|
||||
version and for a versioned release.
|
||||
|
||||
*/}}
|
||||
|
||||
{{ $status := .Site.Params.version.status }}
|
||||
|
||||
{{ if eq $status "unstable"}}
|
||||
<p>This is the <strong>unstable</strong> version of the Matrix specification.</p>
|
||||
<p>This changelog lists changes made since the last release of the specification.</p>
|
||||
{{ else }}
|
||||
<p>This is version <strong>{{ .Site.Params.version.number }}</strong> of the Matrix specification.</p>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue