2016-08-18 22:49:46 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2016-10-15 02:42:35 +08:00
|
|
|
cargo build --release
|
|
|
|
|
2016-08-18 22:49:46 +08:00
|
|
|
mkdir -p tmp
|
2016-09-28 01:49:09 +08:00
|
|
|
rm -rf tmp/*.md
|
2016-08-18 22:49:46 +08:00
|
|
|
|
|
|
|
# Get all the markdown files in the src dir,
|
|
|
|
ls src/*.md | \
|
|
|
|
# except for SUMMARY.md.
|
|
|
|
grep -v SUMMARY.md | \
|
|
|
|
# Extract just the filename so we can reuse it easily.
|
|
|
|
xargs -n 1 basename | \
|
2016-08-27 07:43:48 +08:00
|
|
|
# Remove all links followed by <!-- ignore -->, then
|
|
|
|
# Change all remaining links from markdown to italicized inline text.
|
2016-08-18 22:49:46 +08:00
|
|
|
while IFS= read -r filename; do
|
2016-08-27 07:43:48 +08:00
|
|
|
< "src/$filename" cargo run --bin remove_links | cargo run --bin link2print > "tmp/$filename"
|
2016-08-18 22:49:46 +08:00
|
|
|
done
|
|
|
|
# Concat the files into the nostarch dir.
|
|
|
|
cargo run --bin concat_chapters tmp nostarch
|