-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender-rfc.sh
executable file
·64 lines (49 loc) · 1.64 KB
/
render-rfc.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
#!/bin/bash
# This script renders the RFC proposed in a PR as a PDF file
#
# Input: RFC feature name
# Set errors
set -e
# Check whether the RFC proposed in a PR exists in the `text` directory
RFC_FILE=0000-$1.md
if [ ! -f "./text/$RFC_FILE" ]; then
echo "$RFC_FILE does not exist."
exit 1
fi
# If the `src` directory does not exist, create it
if [ ! -d src ]; then
mkdir src
fi
# Create a summary file and add the RFC filename to it
echo "[RFC Proposal]($RFC_FILE)" > src/SUMMARY.md
# Create the symbolic link for the RFC file in the `src` directory
ln -frs text/$RFC_FILE src/$RFC_FILE
# Install wkhtmltopdf dependencies
sudo apt-get update
sudo apt-get install qt5-default
# Install wkhtmltopdf
sudo apt-get install wkhtmltopdf
# Install mdbook
LINK="https://github.com/rust-lang/mdBook/releases/download"
VERSION="0.4.6"
FILENAME="mdbook-v$VERSION-x86_64-unknown-linux-gnu.tar.gz"
curl -L "$LINK/v$VERSION/$FILENAME" | tar xz -C $HOME/.cargo/bin
# Install mdbook-mermaid
LINK="https://github.com/badboy/mdbook-mermaid/releases/download"
VERSION="0.7.1"
FILENAME="mdbook-mermaid-v$VERSION-x86_64-unknown-linux-gnu.tar.gz"
curl -L "$LINK/v$VERSION/$FILENAME" | tar xz -C $HOME/.cargo/bin
# Install mdbook-katex
LINK="https://github.com/lzanini/mdbook-katex/releases/download"
VERSION="0.2.8"
FILENAME="mdbook-katex-v$VERSION-x86_64-unknown-linux-musl.tar.gz"
curl -L "$LINK/v$VERSION/$FILENAME" | tar xz -C $HOME/.cargo/bin
# Run mdbook-mermaid
mdbook-mermaid install .
# Build book
mdbook build
# Create the PDF for RFC
mkdir -p $1
wkhtmltopdf --enable-local-file-access book/0000-$1.html $1/$1.pdf
# Make sure the script exit the requested value
exit 0