Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensions: Show <supersededby> specs in extension table #1472

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions themes/xmpp.org/layouts/shortcodes/xeps-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ <h4>Filter XEPs</h4>
</thead>
<tbody>
{{- if .Site.Data.xeplist -}}
{{- $xeplist := .Site.Data.xeplist -}}
{{- range sort .Site.Data.xeplist ".number" -}}
{{- $number_str := printf "%04g" .number -}}
{{ $last_revision_date := .last_revision_date | time }}
Expand All @@ -118,10 +119,36 @@ <h4>Filter XEPs</h4>

<tr class="XEP-{{ .status }} {{ if $xep_dormant }} XEP-Dormant{{ end }}" id="xep{{- $number_str -}}" data-shortname="{{- .shortname -}}">
<td><a href="/extensions/xep-{{- $number_str -}}.html">XEP-{{- $number_str -}}</a></td>
<td>{{- .title -}}</td>
<td>{{- .type -}}</td>
<td>{{- .status -}}</td>
<td>{{- .last_revision_date -}}</td>
<td>
{{- .title -}}
{{- if .supersededby -}}
<br>
<span class="text-muted small">Superseded by:&nbsp;</span>
<span class="text-muted small">
{{- range $index, $content := .supersededby -}}
{{- if $index -}}
,&nbsp;
{{- end -}}
{{- if hasPrefix (. | lower) "xep-" -}}
{{- $xep_number := int (trim (. | lower) "xep-" | replaceRE "^0+" "") -}}
{{- $spec := . -}}
{{- range $xeplist -}}
{{- if eq (int .number) $xep_number -}}
<a href="/extensions/{{- $spec | lower -}}.html">{{- print ($spec | upper) ": " .title -}}</a>
{{- end -}}
{{- end -}}
{{- else if hasPrefix (. | lower) "rfc" -}}
<a href="https://datatracker.ietf.org/doc/{{- replaceRE "(\\s)" "" . | lower -}}/" target="_blank">{{ print "RFC " (index (findRE `\d{4}` . 1) 0) }}</a>
{{- else -}}
<span>{{- . -}}</span>
{{- end -}}
{{- end -}}
</span>
{{- end -}}
</td>
<td class="text-nowrap">{{- .type -}}</td>
<td class="text-nowrap">{{- .status -}}</td>
<td class="text-nowrap">{{- .last_revision_date -}}</td>
<td>
{{- range .tags -}}
<span class="badge rounded-pill text-bg-secondary mx-1">{{- . -}}</span>
Expand Down
16 changes: 16 additions & 0 deletions tools/prepare_xep_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ def fix_status(status: str) -> str:
if tag.text is not None:
tag_list.append(tag.text) # noqa: PERF401

supersedes_list: list[str] = []
supersedes = xep.find("supersedes")
if supersedes is not None:
for spec in supersedes.findall("spec"):
if spec.text is not None:
supersedes_list.append(spec.text) # noqa: PERF401

supersededby_list: list[str] = []
supersededby = xep.find("supersededby")
if supersededby is not None:
for spec in supersededby.findall("spec"):
if spec.text is not None:
supersededby_list.append(spec.text) # noqa: PERF401

date = None
version = None
initials = None
Expand Down Expand Up @@ -100,6 +114,8 @@ def fix_status(status: str) -> str:
"type": xep_type,
"abstract": abstract,
"tags": tag_list,
"supersedes": supersedes_list,
"supersededby": supersededby_list,
},
)
xeps_sorted = sorted(xeps, key=lambda xep: xep["number"])
Expand Down
Loading