diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:23 +0000 |
commit | 20431706a863f92cb37dc512fef6e48d192aaf2c (patch) | |
tree | 2867f13f5fd5437ba628c67d7f87309ccadcd286 /src/doc/book/tools/doc-to-md.sh | |
parent | Releasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | src/doc/book/tools/doc-to-md.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/doc/book/tools/doc-to-md.sh b/src/doc/book/tools/doc-to-md.sh index cffe4c04b..8c802a71f 100755 --- a/src/doc/book/tools/doc-to-md.sh +++ b/src/doc/book/tools/doc-to-md.sh @@ -7,6 +7,15 @@ find tmp -name '*.docx' -print0 | \ # Extract just the filename so we can reuse it easily. xargs -0 basename -s .docx | \ while IFS= read -r filename; do + # Truncate the `nostarch` dir file and put the "no editing" warning back. + # Tell shellcheck to ignore this because I want the `/src/` printed + # literally, not expanded. + # shellcheck disable=SC2016 + echo '<!-- DO NOT EDIT THIS FILE. + +This file is periodically generated from the content in the `/src/` +directory, so all fixes need to be made in `/src/`. +-->' > "nostarch/$filename.md" # Make a directory to put the XML in. mkdir -p "tmp/$filename" # Unzip the docx to get at the XML. @@ -15,6 +24,6 @@ while IFS= read -r filename; do xsltproc tools/docx-to-md.xsl "tmp/$filename/word/document.xml" | \ # Hard wrap at 80 chars at word bourdaries. fold -w 80 -s | \ - # Remove trailing whitespace and save in the `nostarch` dir for comparison. - sed -e "s/ *$//" > "nostarch/$filename.md" + # Remove trailing whitespace and append to the file in the `nostarch` dir for comparison. + sed -e "s/ *$//" >> "nostarch/$filename.md" done |