Tag datastructure definitions in docs/spec/* for highlighting

Currently the language used for highlighting is auto-detected and not ideal.
A datastructure-definition lexer should be created to optimize highlighting.

Some specifications have links to other parts of the documentation; currently
these would get escaped and highlighted (and so these specifications have not
been tagged). The HighlightExtension needs extending so that sections of text
to not highlight (or escape) can be marked. Alternatively, the HTML formatter
supports adding links using a ctags file, but this would require formalizing
the datastructure-definition format enough to be able to identify names
properly.
This commit is contained in:
str4d
2013-06-10 07:23:39 +00:00
parent aaa5d03bd1
commit 6a1d9daa57
9 changed files with 157 additions and 253 deletions

View File

@ -179,8 +179,7 @@ A certificate is a container for various receipts or proof of works used through
<p>{% trans -%}
1 byte <a href="#type_Integer">Integer</a> specifying certificate type, followed by a 2 <a href="#type_Integer">Integer</a> specifying the size of the certificate payload, then that many bytes.
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+--//
|type| length | payload
+----+----+----+----+----+--//
@ -199,8 +198,7 @@ length :: Integer
payload :: data
length -> $length bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -234,8 +232,7 @@ A set of key/value mappings or properties
<p>{% trans -%}
A 2-byte size Integer followed by a series of String=String; pairs
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| size |key string (len + data) | = |
+----+----+----+----+----+----+----+----+
@ -255,8 +252,7 @@ val string :: String
; :: A single byte containing ';'
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -303,8 +299,7 @@ Defines the way to uniquely identify a particular router
<p>{% trans -%}
<a href="#type_PublicKey">PublicKey</a> followed by <a href="#type_SigningPublicKey">SigningPublicKey</a> and then a <a href="#type_Certificate">Certificate</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| public_key |
+ +
@ -335,8 +330,7 @@ certificate :: Certificate
length -> >= 3 bytes
Total length: 387+ bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%}
@ -354,8 +348,7 @@ A Destination defines a particular endpoint to which messages can be directed fo
<p>{% trans -%}
<a href="#type_PublicKey">PublicKey</a> followed by a <a href="#type_SigningPublicKey">SigningPublicKey</a> and then a <a href="#type_Certificate">Certificate</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| public_key |
+ +
@ -386,8 +379,7 @@ certificate :: Certificate
length -> >= 3 bytes
Total length: 387+ bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4><a href="http://docs.i2p-projekt.de/javadoc/net/i2p/data/Destination.html">Javadoc</a></h4>
@ -401,8 +393,7 @@ Defines the authorization for a particular tunnel to receive messages targeting
SHA256 <a href="#type_Hash">Hash</a> of the
<a href="#struct_RouterIdentity">RouterIdentity</a> of the gateway router, then the <a href="#type_TunnelId">TunnelId</a>, and finally an end <a href="#type_Date">Date</a>
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| tunnel_gw |
+ +
@ -425,8 +416,7 @@ tunnel_id :: TunnelId
end_date :: Date
length -> 8 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -451,8 +441,7 @@ the other being <a href="#struct_RouterInfo">RouterInfo</a>), and is keyed under
then a 1 byte <a href="#type_Integer">Integer</a> specifying how many <a href="#struct_Lease">Lease</a> structures are in the set, followed by the actual <a href="#struct_Lease">Lease</a> structures and finally a <a href="#type_Signature">Signature</a> of the previous
bytes signed by the <a href="#struct_Destination">Destination's</a> <a href="#type_SigningPrivateKey">SigningPrivateKey</a>
{%- endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| destination |
+ +
@ -535,8 +524,7 @@ leases :: [Lease]
signature :: Signature
length -> 40 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -575,8 +563,7 @@ This structure defines the means to contact a router through a transport protoco
After that comes a <a href="#type_String">String</a> defining the transport protocol this router address uses. Finally there is a <a href="#type_Mapping">Mapping</a> containing all of the transport specific options necessary to establish the connection, such as
IP address, port number, email address, URL, etc.
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+
|cost|
+----+----+----+----+----+----+----+----+
@ -602,8 +589,7 @@ transport_style :: String
length -> 1-256 bytes
options :: Mapping
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<ul>
@ -632,8 +618,7 @@ the contained <a href="#struct_RouterIdentity">RouterIdentity</a>.
<p>{% trans -%}
<a href="#struct_RouterIdentity">RouterIdentity</a> followed by the <a href="#type_Date">Date</a>, when the entry was published
{% endtrans %}</p>
<pre>
{% filter escape %}
{% highlight %}
+----+----+----+----+----+----+----+----+
| router_ident |
+ +
@ -706,8 +691,7 @@ options :: Mapping
signature :: Signature
length -> 40 bytes
{% endfilter %}
</pre>
{% endhighlight %}
<h4>{% trans %}Notes{% endtrans %}</h4>
<p>{% trans -%}