diff --git a/themes/xmpp.org/layouts/shortcodes/xeps-table.html b/themes/xmpp.org/layouts/shortcodes/xeps-table.html index f5622c46d..7438812a5 100644 --- a/themes/xmpp.org/layouts/shortcodes/xeps-table.html +++ b/themes/xmpp.org/layouts/shortcodes/xeps-table.html @@ -106,6 +106,7 @@

Filter XEPs

{{- 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 }} @@ -118,10 +119,36 @@

Filter XEPs

XEP-{{- $number_str -}} - {{- .title -}} - {{- .type -}} - {{- .status -}} - {{- .last_revision_date -}} + + {{- .title -}} + {{- if .supersededby -}} +
+ Superseded by:  + + {{- range $index, $content := .supersededby -}} + {{- if $index -}} + ,  + {{- end -}} + {{- if hasPrefix (. | lower) "xep-" -}} + {{- $xep_number := int (trim (. | lower) "xep-" | replaceRE "^0+" "") -}} + {{- $spec := . -}} + {{- range $xeplist -}} + {{- if eq (int .number) $xep_number -}} + {{- print ($spec | upper) ": " .title -}} + {{- end -}} + {{- end -}} + {{- else if hasPrefix (. | lower) "rfc" -}} + {{ print "RFC " (index (findRE `\d{4}` . 1) 0) }} + {{- else -}} + {{- . -}} + {{- end -}} + {{- end -}} + + {{- end -}} + + {{- .type -}} + {{- .status -}} + {{- .last_revision_date -}} {{- range .tags -}} {{- . -}} diff --git a/tools/prepare_xep_list.py b/tools/prepare_xep_list.py index 0bebcc546..779748de4 100755 --- a/tools/prepare_xep_list.py +++ b/tools/prepare_xep_list.py @@ -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 @@ -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"])