Files
book/tools/nostarch.sh
Ralf Zerres 88233508fe initial commit: The OrbTK book source tree
All files have a strong relation to the book sources of the
rust-lang project itself. This may help to lower the burden
for intrested people to get involved in OrbTK as well as
reuse workflow habits.

* LICENSE-MIT: The projekt licensing terms
* README.md: Github frontpage
* CONTIRBUTING.md: Advises on howto help improving the book
* style-guide.md: Advises on howto improve the readability of
  generated prose and code.
* tools: layout helper scripts and rust-code
* ci: continius integration helper scripts
* .gitattributes: set git default behaviours
* .gitignore: keep source tree sane
* Cargo.toml: package dependencies
* rustfmt.toml: formatting rules for rust code
* book.toml: mdBook dependencies

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
2020-10-04 16:01:05 +02:00

28 lines
801 B
Bash
Executable File

#!/bin/bash
set -eu
cargo build --release
mkdir -p tmp
rm -rf tmp/*.md
rm -rf tmp/markdown
# Render the book as Markdown to include all the code listings
MDBOOK_OUTPUT__MARKDOWN=1 mdbook build -d tmp
# Get all the Markdown files
ls tmp/markdown/${1:-""}*.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
< "tmp/markdown/$filename" ./target/release/remove_links \
| ./target/release/link2print \
| ./target/release/remove_markup \
| ./target/release/remove_hidden_lines > "tmp/$filename"
done
# Concatenate the files into the `nostarch` dir.
./target/release/concat_chapters tmp nostarch