Skip to content

Commit

Permalink
Extensions: Show <supersededby> specs in extension table
Browse files Browse the repository at this point in the history
  • Loading branch information
cal0pteryx committed Jan 18, 2025
1 parent aa80d28 commit 8643dc2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
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

0 comments on commit 8643dc2

Please sign in to comment.