joplin-mdbooks-website/build

29 lines
863 B
Plaintext
Raw Normal View History

2021-11-19 21:13:37 -05:00
#!/bin/bash
set -euxo pipefail
rm -rf public/
2021-11-19 21:21:31 -05:00
if [ -x "$(which mdbook)" ] ; then
2021-11-19 21:21:31 -05:00
echo "mdBook found, running..."
2021-11-19 21:24:09 -05:00
mdbook build -d public
2021-11-19 21:21:31 -05:00
else
echo "mdBook not found, downloading..."
wget https://github.com/rust-lang/mdBook/releases/download/v0.4.13/mdbook-v0.4.13-x86_64-unknown-linux-gnu.tar.gz -O mdbook.tgz
tar zxvf mdbook.tgz
2021-11-19 21:24:09 -05:00
./mdbook build -d public
2021-11-19 21:21:31 -05:00
fi
2021-12-14 19:41:34 -05:00
cp -R static/* public/
# Work around some print.html bugs.
sed -i "s/\(href\|src\)=\"[[:alnum:]\-]*\/\//\1=\"\//g" public/print.html
2021-11-20 10:22:59 -05:00
./move_html_to_dir public/
2021-11-19 21:13:37 -05:00
# Make checkboxes editable, just in case the user wants to keep their own checklist.
find public/ -name "*.html" -type f -exec sed -i 's/input disabled=""/input/g' {} +
2022-02-28 17:24:51 -05:00
# Replace invalid `path_to_root`.
find public/ -name "*.html" -type f -exec sed -i 's/var path_to_root = "\/.";/var path_to_root = "\/";/g' {} +