Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit e358117

Browse files
authoredDec 16, 2021
Re-add mdbook support (#46)
1 parent 3bc29c6 commit e358117

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
 

‎book.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[book]
2+
title = "The Tangle Improvement Proposal (TIP) Book"
3+
4+
[output.html]
5+
no-section-label = true

‎format_tip_header.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
C=0
2+
touch tmp
3+
while IFS= read -r line
4+
do
5+
if [[ $line == "---" && "$C" -eq 0 ]]; then
6+
((C++))
7+
line="<pre>"
8+
fi
9+
if [[ $line == "---" && "$C" -eq 1 ]]; then
10+
((C++))
11+
line="</pre>"
12+
fi
13+
echo $line >> tmp
14+
done < "$1"
15+
16+
mv tmp $1

‎generate_book.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
# SPDX-License-Identifier: Apache-2.0
4+
# Source: https://github.com/rust-lang/rfcs/blob/85c95c7179acc8986eae709f773ff3a91f1e2e43/generate-book.sh
5+
6+
set -e
7+
8+
rm -rf src
9+
mkdir src
10+
cp -r tips src
11+
12+
printf '[Introduction](introduction.md)\n\n' > src/SUMMARY.md
13+
14+
# create summary, extract tip titles and numbers
15+
find ./src ! -type d -name '*.md' ! -path ./src ! -path ./src/SUMMARY.md -print0 \
16+
| sed -e 's/.\/src\///g' \
17+
| sort -z \
18+
| while read -r -d '' file;
19+
do
20+
tipNum=$(sed 's/-0*/-/' <<< $(basename "$file" ".md"))
21+
printf -- '- [%s%s](%s)\n' ${tipNum^^} "$(sed -n 's/^title:\(.*\)$/\1/p' < $file)" "$file"
22+
done >> src/SUMMARY.md
23+
24+
# remove "---" from tip header and replace it h <pre> and </pre>
25+
find ./src ! -type d -name '*.md' ! -path ./src ! -path ./src/SUMMARY.md -print0 \
26+
| sort -z \
27+
| while read -r -d '' file;
28+
do
29+
./format_tip_header.sh $file
30+
done
31+
32+
ln -frs README.md src/introduction.md
33+
34+
mdbook build

0 commit comments

Comments
 (0)
This repository has been archived.