]> git.proxmox.com Git - rustc.git/blame - src/doc/book/second-edition/nostarch.sh
New upstream version 1.23.0+dfsg1
[rustc.git] / src / doc / book / second-edition / nostarch.sh
CommitLineData
cc61c64b
XL
1#!/bin/bash
2# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
3# file at the top-level directory of this distribution and at
4# http://rust-lang.org/COPYRIGHT.
5#
6# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9# option. This file may not be copied, modified, or distributed
10# except according to those terms.
11
12set -eu
13
14cargo build --release
15
16mkdir -p tmp
17rm -rf tmp/*.md
18
19# Get all the markdown files in the src dir,
abe05a73 20ls src/${1:-""}*.md | \
cc61c64b
XL
21# except for SUMMARY.md.
22grep -v SUMMARY.md | \
23# Extract just the filename so we can reuse it easily.
24xargs -n 1 basename | \
25# Remove all links followed by <!-- ignore -->, then
26# Change all remaining links from markdown to italicized inline text.
27while IFS= read -r filename; do
abe05a73
XL
28 < "src/$filename" ./target/release/remove_links \
29 | ./target/release/link2print \
30 | ./target/release/remove_markup > "tmp/$filename"
cc61c64b
XL
31done
32# Concat the files into the nostarch dir.
abe05a73 33./target/release/concat_chapters tmp nostarch