mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-01-23 23:50:25 +08:00
20 lines
567 B
Bash
Executable File
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
|