diff --git a/.travis.yml b/.travis.yml index 38262e038..cd57ac356 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,8 @@ jobs: include: - stage: Prepare XEP list script: python3 ./tools/prepare_xep_list.py + - stage: Prepare RFC list + script: python3 ./tools/prepare_rfc_list.py - stage: Software list linting script: python3 ./tools/lint-list.py clients.json && python3 ./tools/lint-list.py servers.json && python3 ./tools/lint-list.py libraries.json - stage: Generate pages diff --git a/Makefile b/Makefile index 4a4c88ec8..c45bcdbbf 100644 --- a/Makefile +++ b/Makefile @@ -49,16 +49,19 @@ clean: serve: $(PY) $(TOOLSDIR)/prepare_xep_list.py + $(PY) $(TOOLSDIR)/prepare_rfc_list.py $(HUGO) version $(HUGO) server --bind=0.0.0.0 --baseURL="http://localhost/" prepare_docker: $(PY) $(TOOLSDIR)/prepare_xep_list.py + $(PY) $(TOOLSDIR)/prepare_rfc_list.py $(HUGO) version $(HUGO) --baseURL="http://localhost/" publish: $(PY) $(TOOLSDIR)/prepare_xep_list.py + $(PY) $(TOOLSDIR)/prepare_rfc_list.py $(PY) $(TOOLSDIR)/lint-list.py clients.json $(PY) $(TOOLSDIR)/lint-list.py servers.json $(PY) $(TOOLSDIR)/lint-list.py libraries.json diff --git a/content/extensions.md b/content/extensions.md index ff436cff4..9bc1c8e13 100644 --- a/content/extensions.md +++ b/content/extensions.md @@ -14,6 +14,7 @@ aliases: - [RFC 7622](https://datatracker.ietf.org/doc/rfc7622/) XMPP Address Format - [RFC 7590](https://datatracker.ietf.org/doc/rfc7590/) Use of TLS in XMPP - [RFC 7395](https://datatracker.ietf.org/doc/rfc7395/) XMPP over WebSockets +- [View all XMPP RFCs](/rfcs) {{< /col >}} diff --git a/content/rfcs.md b/content/rfcs.md new file mode 100644 index 000000000..b27dbe4c0 --- /dev/null +++ b/content/rfcs.md @@ -0,0 +1,9 @@ +--- +title: XMPP RFCs +layout: "extensions" +--- +The core specifications for XMPP are developed at the [Internet Engineering Task Force (IETF)](https://ietf.org). The XMPP Standards Foundation develops extensions to XMPP in its [XEP series](/extensions). + +Good places for developers to start are the [compliance suites](https://xmpp.org/about/compliance-suites-current), as well as the [technology overview pages](https://xmpp.org/about-xmpp/technology-overview/). + +{{< rfc-list >}} diff --git a/data/rfc_list.json b/data/rfc_list.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/data/rfc_list.json @@ -0,0 +1 @@ +[] diff --git a/themes/xmpp.org/layouts/shortcodes/rfc-list.html b/themes/xmpp.org/layouts/shortcodes/rfc-list.html new file mode 100644 index 000000000..cb45504d9 --- /dev/null +++ b/themes/xmpp.org/layouts/shortcodes/rfc-list.html @@ -0,0 +1,59 @@ +

Basic XMPP RFCs

+ + +

Further XMPP RFCs

+ + +

Obsoleted

+ + +

All XMPP RFCs

+{{ range sort .Site.Data.rfc_list ".number" }} +
+
+
RFC {{ .number }}: {{ .title }}
+

{{ .authors }} ({{ .date }})

+
+
+

{{ .abstract }}

+ {{ if .obsoletes }} +

This RFC obsoletes RFC {{ .obsoletes }}.

+ {{ end }} + {{ if .obsoleted_by }} +

This RFC is obsoleted by RFC {{ .obsoleted_by }}.

+ {{ end }} + {{ if .selfhosted }} +
+ RFC {{ .number }} +

The XSF hosts this document:

+ HTML + TXT File + XML Source +
+ {{ else }} +
+ RFC {{ .number }} +
+ {{ end }} +
+
+
+{{ end }} diff --git a/tools/prepare_rfc_list.py b/tools/prepare_rfc_list.py new file mode 100755 index 000000000..ed7d8d091 --- /dev/null +++ b/tools/prepare_rfc_list.py @@ -0,0 +1,146 @@ +# This file is used to download RFC references and convert them to +# a single JSON file +import sys +import os +import json +import requests +import xml.etree.ElementTree as ET + + +def status_ok(status_code): + # Status codes ranging from 200 (OK) to 300 (redirects) are okay + if status_code >= 200 and status_code < 400: + return True + return False + + +rfc_numbers = [ + 3920, + 3921, + 3922, + 3923, + 4622, + 4854, + 4979, + 5122, + 5437, + 6120, # + 6121, # + 7081, + 7165, + 7247, + 7248, + 7259, + 7395, # + 7572, + 7573, + 7590, # + 7622, # + 7700, + 7702, + 7712, + 8084, + 8266, + 8284, + 8600 +] + +basic_rfc_numbers = [ + 6120, + 6121, + 7395, + 7590, + 7622 +] + +selfhosted_rfcs = [ + 3920, + 3921, + 3922, + 3923, + 4622, + 4854, + 5122, + 6120, + 6121, + 6122 +] + +bibxmlpath = 'https://xml2rfc.tools.ietf.org/public/rfc/bibxml' + +rfcs = [] + +print('Start preparing RFC list') + +for number in rfc_numbers: + request = requests.get(f'{bibxmlpath}/reference.RFC.{number}.xml') + if not status_ok(request.status_code): + quit(f'Error while downloading reference for ' + f'RFC {number} ({request.status_code})') + + try: + root = ET.fromstring(request.content) + except Exception: + quit(f'Error while parsing RFC reference for RFC {number}') + + authors = None + for item in root.iter(): + if item.tag == 'title': + title = item.text + if item.tag == 'date': + date = item.attrib.get('year') + if item.tag == 'author': + if authors is None: + authors = item.attrib.get('fullname') + else: + authors += f", {item.attrib.get('fullname')}" + if item.tag == 'abstract': + abstract = item.find('t').text + + obsoletes = None + obsoleted_by = None + if number == 3920: + obsoleted_by = '6120' + if number == 3921: + obsoleted_by = '6121' + if number == 4622: + obsoleted_by = '5122' + if number == 5122: + obsoletes = '4622' + if number == 6120: + obsoletes = '3920' + if number == 6121: + obsoletes = '3921' + if number == 7248: + obsoleted_by = '8084' + if number == 7700: + obsoleted_by = '8266' + if number == 8084: + obsoletes = '7248' + if number == 8266: + obsoletes = '7700' + + basic = True if number in basic_rfc_numbers else False + selfhosted = True if number in selfhosted_rfcs else False + + rfcs.append( + { + 'number': number, + 'title': title, + 'date': date, + 'authors': authors, + 'abstract': abstract, + 'obsoletes': obsoletes, + 'obsoleted_by': obsoleted_by, + 'basic': basic, + 'selfhosted': selfhosted, + } + ) + print(f'Added RFC {number}') + +base_path = os.path.dirname(os.path.abspath(sys.argv[0])) + +with open(f'{base_path}/../data/rfc_list.json', 'w') as json_file: + json.dump(rfcs, json_file, indent=4) + +print(f'RFC list prepared successfully ({len(rfc_numbers)} RFCs)')