forked from zcash/zips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeindex.sh
executable file
·121 lines (99 loc) · 5 KB
/
makeindex.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/sh
cat <<EndOfHeader
Released ZIPs
-------------
.. raw:: html
<embed><table>
<tr> <th>ZIP</th> <th>Title</th> <th>Status</th> </tr>
EndOfHeader
for zipfile in $(cat .zipfilelist.current); do
zipfile=zips/$zipfile
if grep -E '^\s*Status:\s*(Reserved|Draft|Withdrawn|Rejected|Obsolete)' $zipfile >/dev/null; then
# Handled below.
true
else
echo Adding $zipfile to released index. >/dev/stderr
echo " <tr> <td>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</td> <td class=\"left\"><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
fi
done
cat <<EndOfDraftZipHeader
</table></embed>
Draft ZIPs
----------
These are works-in-progress that have been assigned ZIP numbers. These will
eventually become either Proposed (and thus Released), or one of Withdrawn,
Rejected, or Obsolete.
In some cases a ZIP number is reserved by the ZIP Editors before a draft is
written.
.. raw:: html
<embed><table>
<tr> <th>ZIP</th> <th>Title</th> <th>Status</th> </tr>
EndOfDraftZipHeader
for zipfile in $(cat .zipfilelist.current); do
zipfile=zips/$zipfile
if grep -E '^\s*Status:\s*Reserved' $zipfile >/dev/null; then
echo Adding $zipfile to draft index. >/dev/stderr
echo " <tr> <td><span class=\"reserved\">`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</span></td> <td class=\"left\"><a class=\"reserved\" href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
elif grep -E '^\s*Status:\s*Draft' $zipfile >/dev/null; then
echo Adding $zipfile to draft index. >/dev/stderr
echo " <tr> <td>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</td> <td class=\"left\"><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
fi
done
echo " </table></embed>"
if [ $(wc -c <.draftfilelist.current) -gt 1 ]
then
cat <<EndOfDraftHeader
Drafts without assigned ZIP numbers
-----------------------------------
These are works-in-progress, and may never be assigned ZIP numbers if their
ideas become obsoleted or abandoned. Do not assume that these drafts will exist
in perpetuity; instead assume that they will either move to a numbered ZIP, or
be deleted.
.. raw:: html
<embed><table>
<tr> <th>Title</th> </tr>
EndOfDraftHeader
for draftfile in $(cat .draftfilelist.current); do
draftfile=zips/$draftfile
echo Adding $draftfile to index of drafts. >/dev/stderr
echo " <tr> <td class=\"left\"><a href=\"`echo $draftfile`\">`grep '^\s*Title:' $draftfile | sed -E 's@\s*Title:\s*@@'`</a></td>"
done
echo " </table></embed>"
fi
cat <<EndOfStrikeHeader
Withdrawn, Rejected, or Obsolete ZIPs
-------------------------------------
.. raw:: html
<details>
<summary>Click to show/hide</summary>
<embed><table>
<tr> <th>ZIP</th> <th>Title</th> <th>Status</th> </tr>
EndOfStrikeHeader
for zipfile in $(cat .zipfilelist.current); do
zipfile=zips/$zipfile
if grep -E '^\s*Status:\s*(Withdrawn|Rejected|Obsolete)' $zipfile >/dev/null; then
echo Adding $zipfile to struck index. >/dev/stderr
echo " <tr> <td><strike>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</strike></td> <td class=\"left\"><strike><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></strike></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
fi
done
cat <<EndOfIndexHeader
</table></embed>
</details>
Index of ZIPs
-------------
.. raw:: html
<embed><table>
<tr> <th>ZIP</th> <th>Title</th> <th>Status</th> </tr>
EndOfIndexHeader
for zipfile in $(cat .zipfilelist.current); do
zipfile=zips/$zipfile
echo Adding $zipfile to index. >/dev/stderr
if grep -E '^\s*Status:\s*Reserved' $zipfile >/dev/null; then
echo " <tr> <td><span class=\"reserved\">`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</span></td> <td class=\"left\"><a class=\"reserved\" href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
elif grep -E '^\s*Status:\s*(Withdrawn|Rejected|Obsolete)' $zipfile >/dev/null; then
echo " <tr> <td><strike>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</strike></td> <td class=\"left\"><strike><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></strike></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
else
echo " <tr> <td>`basename $(basename $zipfile .rst) .md | sed -E 's@zip-0{0,3}@@'`</td> <td class=\"left\"><a href=\"`echo $zipfile`\">`grep '^\s*Title:' $zipfile | sed -E 's@\s*Title:\s*@@'`</a></td> <td>`grep '^\s*Status:' $zipfile | sed -E 's@\s*Status:\s*@@'`</td>"
fi
done
echo " </table></embed>"