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 16, 2025
1 parent aa80d28 commit 4e71125
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
27 changes: 27 additions & 0 deletions themes/xmpp.org/layouts/shortcodes/xeps-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h4>Filter XEPs</h4>
<tr class="xepheader">
<th>Number</th>
<th>Name</th>
<th><i class="fa-solid fa-file-circle-exclamation text-muted" data-bs-toggle="tooltip" title="Additional document information"></i></th>
<th>Type</th>
<th>Status</th>
<th>Date</th>
Expand All @@ -119,6 +120,32 @@ <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>
{{- if .supersededby -}}
<button
type="button"
class="btn btn-sm btn-outline-secondary"
data-bs-toggle="popover"
data-bs-trigger="focus"
data-bs-title="Superseded by"
data-bs-html="true"
data-bs-content='
{{- range .supersededby -}}
{{- if hasPrefix (. | lower) "xep-" -}}
<a href="/extensions/{{- . | lower -}}.html">{{- . -}}</a>
{{- 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 -}}
<br>
{{- end -}}
'
>
<i class="fa-solid fa-file-circle-exclamation"></i>
</button>
{{- end -}}
</td>
<td>{{- .type -}}</td>
<td>{{- .status -}}</td>
<td>{{- .last_revision_date -}}</td>
Expand Down
9 changes: 8 additions & 1 deletion themes/xmpp.org/static/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ document.addEventListener("DOMContentLoaded", () => {
}
}

initialize_bootstrap_tooltips()
initialize_bootstrap_popovers();

initialize_bootstrap_tooltips();

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

function initialize_bootstrap_popovers() {
const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
}

// Page /extensions/
function filter_xeps() {
const xeplist = document.getElementById("xeplist");
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 4e71125

Please sign in to comment.