forked from I2P_Developers/i2p.www
Implement navigation for specs
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
{% block title %}{{ title }}{% endblock %}
|
||||
{% block lastupdated %}{{ meta.lastupdated }}{% endblock %}
|
||||
{% block accuratefor %}{{ meta.accuratefor }}{% endblock %}
|
||||
{% block content_nav %}
|
||||
{% autoescape false %}
|
||||
{{ toc }}
|
||||
{% endautoescape %}
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% autoescape false %}
|
||||
{{ body }}
|
||||
|
@@ -5,6 +5,8 @@ Blockfile and Hosts Database Specification
|
||||
:lastupdated: November 2014
|
||||
:accuratefor: 0.9.17
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,61 +5,12 @@ Common structures Specification
|
||||
:lastupdated: February 2016
|
||||
:accuratefor: 0.9.24
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
This document describes some data types common to all I2P protocols, like
|
||||
[I2NP]_, [I2CP]_, [SSU]_, etc.
|
||||
|
||||
Index
|
||||
=====
|
||||
|
||||
+--------------------------+
|
||||
| Type |
|
||||
+==========================+
|
||||
| Boolean_ |
|
||||
+--------------------------+
|
||||
| Certificate_ |
|
||||
+--------------------------+
|
||||
| Date_ |
|
||||
+--------------------------+
|
||||
| `Delivery Instructions`_ |
|
||||
+--------------------------+
|
||||
| Destination_ |
|
||||
+--------------------------+
|
||||
| Hash_ |
|
||||
+--------------------------+
|
||||
| Integer_ |
|
||||
+--------------------------+
|
||||
| KeysAndCert_ |
|
||||
+--------------------------+
|
||||
| Lease_ |
|
||||
+--------------------------+
|
||||
| LeaseSet_ |
|
||||
+--------------------------+
|
||||
| Mapping_ |
|
||||
+--------------------------+
|
||||
| PrivateKey_ |
|
||||
+--------------------------+
|
||||
| PublicKey_ |
|
||||
+--------------------------+
|
||||
| RouterAddress_ |
|
||||
+--------------------------+
|
||||
| RouterIdentity_ |
|
||||
+--------------------------+
|
||||
| RouterInfo_ |
|
||||
+--------------------------+
|
||||
| `Session Tag`_ |
|
||||
+--------------------------+
|
||||
| Signature_ |
|
||||
+--------------------------+
|
||||
| PrivateKey_ |
|
||||
+--------------------------+
|
||||
| SigningPublicKey_ |
|
||||
+--------------------------+
|
||||
| String_ |
|
||||
+--------------------------+
|
||||
| TunnelId_ |
|
||||
+--------------------------+
|
||||
|
||||
|
||||
Common type specification
|
||||
=========================
|
||||
|
@@ -5,6 +5,8 @@ Configuration File Specification
|
||||
:lastupdated: February 2016
|
||||
:accuratefor: 0.9.25
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Low-level Cryptography Specification
|
||||
:lastupdated: December 2014
|
||||
:accuratefor: 0.9.17
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Datagram Specification
|
||||
:lastupdated: July 2014
|
||||
:accuratefor: 0.9.14
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ GeoIP File Specification
|
||||
:lastupdated: December 2013
|
||||
:accuratefor: 0.9.9
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ I2CP Specification
|
||||
:lastupdated: June 2015
|
||||
:accuratefor: 0.9.21
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ I2NP Specification
|
||||
:lastupdated: January 2016
|
||||
:accuratefor: 0.9.24
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Plugin Specification
|
||||
:lastupdated: February 2016
|
||||
:accuratefor: 0.9.25
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ SSU Protocol Specification
|
||||
:lastupdated: November 2015
|
||||
:accuratefor: 0.9.24
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Streaming Library Specification
|
||||
:lastupdated: June 2015
|
||||
:accuratefor: 0.9.20
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Tunnel Creation Specification
|
||||
:lastupdated: January 2016
|
||||
:accuratefor: 0.9.24
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
.. _tunnelCreate.overview:
|
||||
|
||||
|
@@ -5,6 +5,8 @@ Tunnel Message Specification
|
||||
:lastupdated: February 2014
|
||||
:accuratefor: 0.9.11
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -5,6 +5,8 @@ Software Update Specification
|
||||
:lastupdated: May 2015
|
||||
:accuratefor: 0.9.20
|
||||
|
||||
.. contents::
|
||||
|
||||
|
||||
Overview
|
||||
========
|
||||
|
@@ -1,5 +1,9 @@
|
||||
import codecs
|
||||
from docutils.core import publish_parts
|
||||
from docutils.core import (
|
||||
publish_doctree,
|
||||
publish_from_doctree,
|
||||
publish_parts,
|
||||
)
|
||||
from flask import (
|
||||
abort,
|
||||
g,
|
||||
@@ -13,7 +17,7 @@ from flask import (
|
||||
)
|
||||
import os.path
|
||||
|
||||
from i2p2www import SPEC_DIR
|
||||
from i2p2www import PROPOSAL_DIR, SPEC_DIR
|
||||
from i2p2www import helpers
|
||||
|
||||
|
||||
@@ -64,6 +68,7 @@ def spec_show(name, txt=False):
|
||||
if txt:
|
||||
# Strip out RST
|
||||
content = content.replace('.. meta::\n', '')
|
||||
content = content.replace('.. contents::\n\n', '')
|
||||
content = content.replace('.. raw:: html\n\n', '')
|
||||
content = content.replace('\n.. [', '\n[')
|
||||
content = content.replace(']_.', '].')
|
||||
@@ -81,11 +86,21 @@ def spec_show(name, txt=False):
|
||||
r.mimetype = 'text/plain'
|
||||
return r
|
||||
|
||||
# publish the post with docutils
|
||||
# Render the ToC
|
||||
doctree = publish_doctree(source=rendered_content)
|
||||
bullet_list = doctree[1][1]
|
||||
doctree.clear()
|
||||
doctree.append(bullet_list)
|
||||
toc = publish_from_doctree(doctree, writer_name='html')
|
||||
|
||||
# Remove the ToC from the main document
|
||||
rendered_content = rendered_content.replace('.. contents::\n', '')
|
||||
|
||||
# publish the spec with docutils
|
||||
parts = publish_parts(source=rendered_content, source_path=SPEC_DIR, writer_name="html")
|
||||
meta = get_metadata_from_meta(parts['meta'])
|
||||
|
||||
return render_template('spec/show.html', title=parts['title'], body=parts['fragment'], name=name, meta=meta)
|
||||
return render_template('spec/show.html', title=parts['title'], toc=toc, body=parts['fragment'], name=name, meta=meta)
|
||||
|
||||
def spec_show_txt(name):
|
||||
return spec_show(name, True)
|
||||
|
Reference in New Issue
Block a user