From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/doc/book/tools/doc-to-md.sh | 13 +- src/doc/book/tools/docx-to-md.xsl | 262 +++++++++++++++++++++++++++++++++++--- 2 files changed, 256 insertions(+), 19 deletions(-) (limited to 'src/doc/book/tools') 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 '' > "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 diff --git a/src/doc/book/tools/docx-to-md.xsl b/src/doc/book/tools/docx-to-md.xsl index 637c7a59c..8deec85c9 100644 --- a/src/doc/book/tools/docx-to-md.xsl +++ b/src/doc/book/tools/docx-to-md.xsl @@ -12,14 +12,41 @@ + + + + + + + + + + + + + + + + + [TOC] + ## Appendix + + : + + + + + + + [TOC] # @@ -27,11 +54,13 @@ - + + ## + ### @@ -51,10 +80,13 @@ - + 1. + + + @@ -63,10 +95,27 @@ - + * + + + + + + + > * + + + + + > + + + + + @@ -81,7 +130,13 @@ - + + Filename: + + + + + @@ -113,39 +168,172 @@ ``` + + + ``` + + + + + + + + + + + ``` + + + + + + + > ``` > + + + > + + + + + + + + + + + > ``` > + + + > ``` + + + + ``` ``` - + + Table + + + - + + : - + + Listing + + + - + + : - + > - - + + > ### + + > + + + > - + + + > + + + + + - > + > Note: + + + + * ** + + **: + + + + + + + + + + + + > * ** + + **: + + + + + + + > + + + + + Figure + + + - + + : + + + + + + + + + + + + | + + |--- + + | + + + + + | + + + + | + + + + + Unmatched: @@ -163,9 +351,13 @@ Unmatched: - ` + + ` + - ` + + ` + @@ -176,7 +368,7 @@ Unmatched: - + @@ -195,15 +387,41 @@ Unmatched: - + + + + + + + + * + + + + + + * + + + + + + + + + + + + + - * + [ - * + ] @@ -214,6 +432,16 @@ Unmatched: + + + <sup> + + + + </sup> + + + -- cgit v1.2.3