From 6a1d9daa571a62421176c783dba3e86a11fc09f5 Mon Sep 17 00:00:00 2001 From: str4d Date: Mon, 10 Jun 2013 07:23:39 +0000 Subject: [PATCH] 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. --- i2p2www/pages/site/docs/spec/blockfile.html | 32 ++-- .../site/docs/spec/common-structures.html | 48 ++--- i2p2www/pages/site/docs/spec/datagrams.html | 4 +- i2p2www/pages/site/docs/spec/geoip.html | 26 +-- i2p2www/pages/site/docs/spec/i2cp.html | 42 ++--- i2p2www/pages/site/docs/spec/i2np.html | 166 ++++++------------ i2p2www/pages/site/docs/spec/ssu.html | 52 +++--- i2p2www/pages/site/docs/spec/streaming.html | 4 +- .../pages/site/docs/spec/tunnel-message.html | 36 ++-- 9 files changed, 157 insertions(+), 253 deletions(-) diff --git a/i2p2www/pages/site/docs/spec/blockfile.html b/i2p2www/pages/site/docs/spec/blockfile.html index 5077195a..f9ed3958 100644 --- a/i2p2www/pages/site/docs/spec/blockfile.html +++ b/i2p2www/pages/site/docs/spec/blockfile.html @@ -50,7 +50,7 @@ The BlockfileNamingService provides synchronization.

{% trans -%} Superblock format: {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-5	Magic number	0x3141de493250 ("1A" 0xde "I2P")
 6	Major version	0x01
@@ -60,12 +60,12 @@ Byte	Contents
 20-21	Mounted flag	0x01 = yes
 22-23	Span size	max number of key/value pairs per span (16 for hostsdb)
 24-1023	unused
-
+{% endhighlight %}

{% trans -%} Skip list block page format: {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-7	Magic number	0x536b69704c697374 "SkipList"
 8-11	First span page
@@ -74,14 +74,14 @@ Byte	Contents
 20-23	Spans (total number of spans - may only be valid at startup)
 24-27	Levels (total number of levels - may only be valid at startup)
 28-1023	unused
-
+{% endhighlight %}

{% trans -%} Skip level block page format is as follows. All levels have a span. Not all spans have levels. {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-7	Magic number	0x42534c6576656c73 "BSLevels"
 8-9	Max height
@@ -89,7 +89,7 @@ Byte	Contents
 12-15	Span page
 16-	Next level pages ('current height' entries, 4 bytes each, lowest first)
 remaining bytes unused
-
+{% endhighlight %}

{% trans -%} @@ -98,7 +98,7 @@ Key/value structures are sorted by key within each span and across all spans. Key/value structures are sorted by key within each span. Spans other than the first span may not be empty. {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-3	Magic number	0x5370616e "Span"
 4-7	First continuation page or 0
@@ -107,17 +107,17 @@ Byte	Contents
 16-17	Max keys (16 for hostsdb)
 18-19	Size (current number of keys)
 20-1023	key/value structures
-
+{% endhighlight %}

{% trans -%} Span Continuation block page format: {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-3	Magic number	0x434f4e54 "CONT"
 4-7	Next continuation page or 0
 8-1023	key/value structures
-
+{% endhighlight %}

{% trans -%} @@ -128,34 +128,34 @@ be at offset 8 in the continuation page. Key and value data may be split across pages. Max key and value lengths are 65535 bytes. {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-1	key length in bytes
 2-3	value length in bytes
 4-	key data
 	value data
-
+{% endhighlight %}

{% trans -%} Free list block page format: {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-7	Magic number	0x2366724c69737423 "#frList#"
 8-11	Next free list block or 0 if none
 12-15	Number of valid free pages in this block (0 - 252)
 16-1023	Free pages (4 bytes each), only the first (valid number) are valid
-
+{% endhighlight %}

{% trans -%} Free page block format: {%- endtrans %}

-
+{% highlight %}
 Byte	Contents
 0-7	Magic number	0x7e2146524545217e "~!FREE!~"
 8-1023	unused
-
+{% endhighlight %}

{% trans -%} The metaindex (located at page 2) is a mapping of US-ASCII strings to 4-byte integers. diff --git a/i2p2www/pages/site/docs/spec/common-structures.html b/i2p2www/pages/site/docs/spec/common-structures.html index 21b93321..0d25580f 100644 --- a/i2p2www/pages/site/docs/spec/common-structures.html +++ b/i2p2www/pages/site/docs/spec/common-structures.html @@ -179,8 +179,7 @@ A certificate is a container for various receipts or proof of works used through

{% trans -%} 1 byte Integer specifying certificate type, followed by a 2 Integer specifying the size of the certificate payload, then that many bytes. {% endtrans %}

-
-{% filter escape %}
+{% highlight %}
 +----+----+----+----+----+--//
 |type| length  | payload
 +----+----+----+----+----+--//
@@ -199,8 +198,7 @@ length :: Integer
 
 payload :: data
            length -> $length bytes
-{% endfilter %}
-
+{% endhighlight %}

{% trans %}Notes{% endtrans %}