rust-book-cn/nostarch.sh
2016-08-26 16:43:48 -07:00

20 lines
567 B
Bash
Executable File

#!/bin/bash
set -eu
mkdir -p tmp
# 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 | \
# Remove all links followed by <!-- ignore -->, then
# Change all remaining links from markdown to italicized inline text.
while IFS= read -r filename; do
< "src/$filename" cargo run --bin remove_links | cargo run --bin link2print > "tmp/$filename"
done
# Concat the files into the nostarch dir.
cargo run --bin concat_chapters tmp nostarch