Skip to content

Commit

Permalink
Extensions: Improve 'superseded by' links (jump to new XEP in table)
Browse files Browse the repository at this point in the history
  • Loading branch information
cal0pteryx committed Feb 1, 2025
1 parent c52ce3d commit cbee458
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions themes/xmpp.org/layouts/shortcodes/xeps-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ <h4>Filter XEPs</h4>
,&nbsp;
{{- end -}}
{{- if hasPrefix (. | lower) "xep-" -}}
{{- $xep_number := int (trim (. | lower) "xep-" | replaceRE "^0+" "") -}}
{{- $xep_number := trim (. | lower) "xep-" -}}
{{- $trimmed_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>
{{- if eq (int .number) $trimmed_xep_number -}}
<a href="#xep{{- $xep_number -}}">{{- 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>
<a href="https://datatracker.ietf.org/doc/{{- replaceRE "(\\s)" "" . | lower -}}/" target="_blank">{{ print "RFC " (index (findRE `\d{4}` . 1) 0) }}&nbsp;<i class="fas fa-external-link-alt"></i></a>
{{- else -}}
<span>{{- . -}}</span>
{{- end -}}
Expand Down

0 comments on commit cbee458

Please sign in to comment.