diff --git a/i2p2www/pages/global/macros b/i2p2www/pages/global/macros index 7876f332..15b58531 100644 --- a/i2p2www/pages/global/macros +++ b/i2p2www/pages/global/macros @@ -42,6 +42,12 @@ {%- endmacro -%} +{%- macro render_supercedes(supercedes) -%} +{%- if supercedes and supercedes|length -%} +{% for proposal in supercedes %}{{ proposal }}{% if not loop.last %}, {% endif %}{% endfor %} +{%- endif %} +{%- endmacro %} + {%- macro render_categories(categories) -%} {%- if categories and categories|length -%} {{ _('Posted in') }} {% for category in categories %}{{ category }}{% if not loop.last %}, {% endif %}{% endfor %} diff --git a/i2p2www/pages/spec/proposal-show.html b/i2p2www/pages/spec/proposal-show.html index de00a93b..c89f8ed8 100644 --- a/i2p2www/pages/spec/proposal-show.html +++ b/i2p2www/pages/spec/proposal-show.html @@ -1,5 +1,5 @@ {% extends "global/layout.html" %} -{%- from "global/macros" import render_categories with context -%} +{%- from "global/macros" import render_supercedes with context -%} {% block title %}{{ title }}{% endblock %} {% block content_nav %} {% autoescape false %} @@ -19,6 +19,14 @@
Last updated
Status
{{ meta.status }}
+ {% if meta.supercededby -%} +
Superceded by
+
{{ meta.supercededby }}
+ {%- endif %} + {% if meta.supercedes -%} +
Supercedes
+
{{ render_supercedes(meta.supercedes)|safe }}
+ {%- endif %} {% autoescape false %} {{ body }} diff --git a/i2p2www/spec/proposals/106-ntcp-obfuscation.rst b/i2p2www/spec/proposals/106-ntcp-obfuscation.rst index 1da6692e..72704e41 100644 --- a/i2p2www/spec/proposals/106-ntcp-obfuscation.rst +++ b/i2p2www/spec/proposals/106-ntcp-obfuscation.rst @@ -7,6 +7,7 @@ NTCP Obfuscation :thread: http://zzz.i2p/topics/774 :lastupdated: 2014-01-03 :status: Rejected + :supercededby: 111 .. contents:: diff --git a/i2p2www/spec/proposals/111-ntcp-2.rst b/i2p2www/spec/proposals/111-ntcp-2.rst index f8fc9af0..c052a235 100644 --- a/i2p2www/spec/proposals/111-ntcp-2.rst +++ b/i2p2www/spec/proposals/111-ntcp-2.rst @@ -7,6 +7,7 @@ NTCP 2 :thread: http://zzz.i2p/topics/1577 :lastupdated: 2014-09-21 :status: Draft + :supercedes: 106 .. contents:: diff --git a/i2p2www/spec/views.py b/i2p2www/spec/views.py index 14481aab..8bfcacf2 100644 --- a/i2p2www/spec/views.py +++ b/i2p2www/spec/views.py @@ -43,9 +43,12 @@ PROPOSAL_METATAGS = { 'created': None, 'lastupdated': None, 'status': u'Draft', + 'supercededby': None, + 'supercedes': None, 'thread': None, } PROPOSAL_LIST_METATAGS = [ + 'supercedes', ] PROPOSAL_STATUS_SORT = { 'Draft': 1, @@ -60,6 +63,7 @@ METATAG_LABELS = { 'created': u'Created', 'lastupdated': u'Last updated', 'status': u'Status', + 'supercededby': u'Superceded by', 'thread': u'Thread', } diff --git a/i2p2www/templatevars.py b/i2p2www/templatevars.py index 13a26930..1c1d0faf 100644 --- a/i2p2www/templatevars.py +++ b/i2p2www/templatevars.py @@ -2,7 +2,17 @@ import ctags from flask import g, request, safe_join, url_for import os.path -from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, RTL_LANGS, SUPPORTED_LANGS, SUPPORTED_LANG_NAMES, SPEC_DIR, STATIC_DIR, app +from i2p2www import ( + CANONICAL_DOMAIN, + CURRENT_I2P_VERSION, + PROPOSAL_DIR, + RTL_LANGS, + SUPPORTED_LANGS, + SUPPORTED_LANG_NAMES, + SPEC_DIR, + STATIC_DIR, + app, +) INPROXY = '.xyz' # http://zzz.i2p/topics/1771-i2p-xyz-inproxy @@ -46,6 +56,20 @@ def utility_processor(): url = url[:url.index('?')] return url + def get_proposal_url(identifier): + name = None + for f in os.listdir(PROPOSAL_DIR): + if f.startswith(identifier): + name = f[:-4] + break + if not name: + return '' + url = url_for('proposal_show', name=name, _external=True) + # Remove ?lang=xx + if '?' in url: + url = url[:url.index('?')] + return url + def get_ctags_url(value): filename, kind = _lookup_ctag(value) # Handle message types @@ -149,6 +173,7 @@ def utility_processor(): logo_url=get_logo_for_theme, site_url=get_site_url, spec_url=get_spec_url, + proposal_url=get_proposal_url, ctags_url=get_ctags_url, get_url=get_url_with_lang, is_rtl=is_rtl_lang,