Split markdown into a proper directory hierarchy

The structure should now mirror that of the website, which ought to
allow us to check internal links more easily. It also makes content
easier to find and debug.
This commit is contained in:
Ben Edgington
2021-10-22 18:02:16 +01:00
parent 1757dacff8
commit 056cc31ef1
6 changed files with 51 additions and 20 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@ node_modules/
.cache/
public/
tmp/
src/markdown-pages/*.md
src/markdown-pages/pages/

View File

@@ -2,8 +2,8 @@
BEGIN{
n = 0
file_name_format = "markdown-pages/part_%03d.md"
filename = sprintf(file_name_format, n)
filename_prefix = "markdown-pages/pages"
filename = ""
h_part = ""
h_chapter = ""
h_part_no = -1 # Number parts from 0
@@ -18,13 +18,29 @@ BEGIN{
if (n > 0) {
close (filename)
}
n++
filename = sprintf(file_name_format, n)
n = 1
# Generate header contents and output it
# Generate header contents
name = gensub("^#+ (.*) <!-- .* -->$", "\\1", "1", $0)
h_path = gensub("^#+ .* <!-- (.*) -->$", "\\1", "1", $0)
heading = gensub ("^(#+ .*) <!-- .* -->$", "\\1", "1", $0)
# Is this page hidden?
if (h_path ~ /\*$/) {
h_path = substr(h_path, 1, length(h_path) - 1)
h_hide = "true"
} else {
h_hide = "false"
}
# Make filesystem path for writing the file
file_path = h_path
sub(/\/[^/]+$/, "", file_path)
system("mkdir -p " filename_prefix file_path " 2>/dev/null")
filename = filename_prefix h_path ".md"
print filename
switch ($0) {
case /^# /:
h_part = name
@@ -51,10 +67,7 @@ BEGIN{
exit (1)
}
print "---" > filename
if (h_path ~ /\*$/) {
h_path = substr(h_path, 1, length(h_path) - 1)
print "hide: true" > filename
}
print "hide: " h_hide > filename
print "path: " h_path > filename
print "titles: [\"" h_part "\",\"" h_chapter "\",\"" h_section "\"]" > filename
print "index: [" idx "]" > filename

View File

@@ -2,6 +2,6 @@
cd "$(dirname "$0")/../src"
rm -f markdown-pages/part_*.md
rm -rf markdown-pages/pages/
../bin/split.awk book.md

View File

@@ -44,7 +44,7 @@ TODO: Intro
TODO
### Attacks and Defences <!-- /part/goals/attacks* -->
### Attacks and Defences <!-- /part1/goals/attacks* -->
TODO
@@ -312,7 +312,7 @@ The calculation of rewards was overhauled in the Altair upgrade. The total rewar
Note that the sum of five the weights is equal to `WEIGHT_DENOMINATOR`.
<div class="image">
<img src="images/weights.svg" style="width:50%" /><br />
<img src="../../../images/weights.svg" style="width:50%" /><br />
<span>The proportion of the total reward derived from each of the micro-rewards.</span>
</div>
@@ -999,7 +999,7 @@ First, we pick a pivot index $p$. This is pseudorandomly chosen, based on the ro
With this pivot, we then pick the mirror index $m_1$ halfway between $p$ and $0$. That is, $m_1 = p / 2$. (We will simplify by ignoring off-by-one rounding issues for the purposes of this explanation.)
<div class="image">
<img src="images/shuffling_0.svg" /><br />
<img src="../../../images/shuffling_0.svg" /><br />
<span>The pivot and the first mirror index.</span>
</div>
@@ -1014,7 +1014,7 @@ If we do decide to swap, then we exchange the list element at $i$ with that at $
We make the same swap-or-not decision for each index between $m_1$ and $p$.
<div class="image">
<img src="images/shuffling_1.svg" /><br />
<img src="../../../images/shuffling_1.svg" /><br />
<span>Swapping or not from the first mirror up to the pivot.</span>
</div>
@@ -1025,7 +1025,7 @@ The decision as to whether to swap or not is based on hashing together the rando
After considering all the indices $i$ from $m_1$ to $p$, mirroring in $m_1$, we now find a second mirror index at $m_2$, which is the point equidistant between $p$ and the end of the list: $m_2 = m_1 + n / 2$.
<div class="image">
<img src="images/shuffling_2.svg" /><br />
<img src="../../../images/shuffling_2.svg" /><br />
<span>The second mirror index.</span>
</div>
@@ -1034,7 +1034,7 @@ After considering all the indices $i$ from $m_1$ to $p$, mirroring in $m_1$, we
Finally, we repeat the swap-or-not process, considering all the points $j$ from the pivot, $p$ to the second mirror $m_2$. If we choose not to swap, we just move on. If we choose to swap then we exchange the element at $j$ with its image at $j'$ in the mirror index $m_2$. Here, $j' = m_2 + (m_2 - j)$.
<div class="image">
<img src="images/shuffling_3.svg" /><br />
<img src="../../../images/shuffling_3.svg" /><br />
<span>Swapping or not from the pivot to the second mirror.</span>
</div>
@@ -1045,7 +1045,7 @@ At the end of the round, we have considered all the indices between $m_1$ and $m
The next round begins by incrementing (or decrementing for a reverse shuffle) the round number, which gives us a new pivot index, and off we go again.
<div class="image">
<img src="images/shuffling_4.svg" /><br />
<img src="../../../images/shuffling_4.svg" /><br />
<span>The whole process running from one mirror to the other in a single round.</span>
</div>
@@ -1179,11 +1179,11 @@ TODO
TODO
### Disk storage <!-- /part2/storage* -->
### Disk storage <!-- /part2/implementation/storage* -->
TODO
### Checkpoint sync <!-- /part2/checkpoint_sync* -->
### Checkpoint sync <!-- /part2/implementation/checkpoint_sync* -->
TODO

View File

@@ -0,0 +1,8 @@
---
path: /contents
titles: ["Contents","",""]
index: [-1]
---
# Contents

View File

@@ -0,0 +1,10 @@
---
path: /
---
<div class="title-page" style="text-align:center;margin:6ex 20%;">
<h1 style="margin:6ex 0;padding:0;">Upgrading Ethereum</h1>
<h2 style="margin:6ex 0;padding:0;">A technical handbook on Ethereum's move to proof of stake and beyond</h2>
<h3 style="border:none;margin:6ex 0;padding:0;">Altair Edition</h3>
<h4><a href="/contents">Contents</a></h4>
</div>