Skip to content

Commit 4e71125

Browse files
committed
Extensions: Show <supersededby> specs in extension table
1 parent aa80d28 commit 4e71125

3 files changed

Lines changed: 51 additions & 1 deletion

File tree

themes/xmpp.org/layouts/shortcodes/xeps-table.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ <h4>Filter XEPs</h4>
9797
<tr class="xepheader">
9898
<th>Number</th>
9999
<th>Name</th>
100+
<th><i class="fa-solid fa-file-circle-exclamation text-muted" data-bs-toggle="tooltip" title="Additional document information"></i></th>
100101
<th>Type</th>
101102
<th>Status</th>
102103
<th>Date</th>
@@ -119,6 +120,32 @@ <h4>Filter XEPs</h4>
119120
<tr class="XEP-{{ .status }} {{ if $xep_dormant }} XEP-Dormant{{ end }}" id="xep{{- $number_str -}}" data-shortname="{{- .shortname -}}">
120121
<td><a href="/extensions/xep-{{- $number_str -}}.html">XEP-{{- $number_str -}}</a></td>
121122
<td>{{- .title -}}</td>
123+
<td>
124+
{{- if .supersededby -}}
125+
<button
126+
type="button"
127+
class="btn btn-sm btn-outline-secondary"
128+
data-bs-toggle="popover"
129+
data-bs-trigger="focus"
130+
data-bs-title="Superseded by"
131+
data-bs-html="true"
132+
data-bs-content='
133+
{{- range .supersededby -}}
134+
{{- if hasPrefix (. | lower) "xep-" -}}
135+
<a href="/extensions/{{- . | lower -}}.html">{{- . -}}</a>
136+
{{- else if hasPrefix (. | lower) "rfc" -}}
137+
<a href="https://datatracker.ietf.org/doc/{{- replaceRE "(\\s)" "" . | lower -}}/" target="_blank">{{ print "RFC " (index (findRE `\d{4}` . 1) 0) }}</a>
138+
{{- else -}}
139+
<span>{{- . -}}</span>
140+
{{- end -}}
141+
<br>
142+
{{- end -}}
143+
'
144+
>
145+
<i class="fa-solid fa-file-circle-exclamation"></i>
146+
</button>
147+
{{- end -}}
148+
</td>
122149
<td>{{- .type -}}</td>
123150
<td>{{- .status -}}</td>
124151
<td>{{- .last_revision_date -}}</td>

themes/xmpp.org/static/js/scripts.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ document.addEventListener("DOMContentLoaded", () => {
6666
}
6767
}
6868

69-
initialize_bootstrap_tooltips()
69+
initialize_bootstrap_popovers();
70+
71+
initialize_bootstrap_tooltips();
7072

7173
software_resize_extensions_collapse();
7274
});
@@ -76,6 +78,11 @@ function initialize_bootstrap_tooltips() {
7678
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
7779
}
7880

81+
function initialize_bootstrap_popovers() {
82+
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
83+
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
84+
}
85+
7986
// Page /extensions/
8087
function filter_xeps() {
8188
const xeplist = document.getElementById("xeplist");

tools/prepare_xep_list.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,20 @@ def fix_status(status: str) -> str:
6868
if tag.text is not None:
6969
tag_list.append(tag.text) # noqa: PERF401
7070

71+
supersedes_list: list[str] = []
72+
supersedes = xep.find("supersedes")
73+
if supersedes is not None:
74+
for spec in supersedes.findall("spec"):
75+
if spec.text is not None:
76+
supersedes_list.append(spec.text) # noqa: PERF401
77+
78+
supersededby_list: list[str] = []
79+
supersededby = xep.find("supersededby")
80+
if supersededby is not None:
81+
for spec in supersededby.findall("spec"):
82+
if spec.text is not None:
83+
supersededby_list.append(spec.text) # noqa: PERF401
84+
7185
date = None
7286
version = None
7387
initials = None
@@ -100,6 +114,8 @@ def fix_status(status: str) -> str:
100114
"type": xep_type,
101115
"abstract": abstract,
102116
"tags": tag_list,
117+
"supersedes": supersedes_list,
118+
"supersededby": supersededby_list,
103119
},
104120
)
105121
xeps_sorted = sorted(xeps, key=lambda xep: xep["number"])

0 commit comments

Comments
 (0)