From e66631b543020c8d3a2fd016c6175c7de9f2a0a2 Mon Sep 17 00:00:00 2001
From: Landon Curt Noll
Date: Sat, 22 Jun 2024 23:48:49 -0700
Subject: [PATCH] convert leading TAB chars into 8 spaces before running pandoc
The `bin/pandoc-wrapper.sh` tool will use `expand(1)` to expand
leading ASCII TAB characters into multiples of 8 ASCII space
characters on all markdown data before piping it into `pandoc(1)`.
Thus, any leading ASCII TAB character in markdown files will be
automatically converted into spaces using 8 character tabs.
Changed `bin/pandoc-wrapper.sh` VERSION from "1.6.3 2024-06-22"
to "1.7 2024-06-22" to preform the above.
Perform `make www` to perform the above and test under macOS.
It turns out that only one other HTML file was impacted: `bugs.html`.
All other leading ASCII tab characters have been rendered
[Mostly Harmless](https://en.wikipedia.org/wiki/Mostly_Harmless). :)
---
bin/pandoc-wrapper.sh | 23 +++++++++++++++--------
bugs.html | 2 +-
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/bin/pandoc-wrapper.sh b/bin/pandoc-wrapper.sh
index 9547f0a5f..f7f1bd5c8 100755
--- a/bin/pandoc-wrapper.sh
+++ b/bin/pandoc-wrapper.sh
@@ -99,11 +99,17 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
-export VERSION="1.6.3 2024-06-22"
+export VERSION="1.7 2024-06-22"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
export PANDOC_TOOL
+EXPAND_TOOL=$(type -P expand)
+export EXPAND_TOOL
+if [[ -z "$EXPAND_TOOL" ]]; then
+ echo "$0: FATAL: expand tool is not installed or not in \$PATH" 1>&2
+ exit 5
+fi
GIT_TOOL=$(type -P git)
export GIT_TOOL
if [[ -z "$GIT_TOOL" ]]; then
@@ -351,8 +357,9 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: VERSION=$VERSION" 1>&2
echo "$0: debug[3]: NAME=$NAME" 1>&2
echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2
- echo "$0: debug[3]: PANDOC_TOOL=$PANDOC_TOOL" 1>&2
+ echo "$0: debug[3]: EXPAND_TOOL=$EXPAND_TOOL" 1>&2
echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2
+ echo "$0: debug[3]: PANDOC_TOOL=$PANDOC_TOOL" 1>&2
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: PANDOC_TOOL=$PANDOC_TOOL" 1>&2
for index in "${!PANDOC_OPTION[@]}"; do
@@ -400,16 +407,16 @@ fi
#
if [[ -z $NOOP ]]; then
if [[ $V_FLAG -ge 1 ]]; then
- echo "$0: debug[1]: will execute pandoc as: $PANDOC_TOOL ${PANDOC_OPTION[*]} -o $HTML_OUTPUT $MARKDOWN_INPUT" 1>&2
+ echo "$0: debug[1]: will execute pandoc as: $EXPAND_TOOL -t 8 -- $MARKDOWN_INPUT | $PANDOC_TOOL ${PANDOC_OPTION[*]} -o $HTML_OUTPUT" 1>&2
fi
- "$PANDOC_TOOL" "${PANDOC_OPTION[@]}" -o "$HTML_OUTPUT" "$MARKDOWN_INPUT"
- status="$?"
+ "$EXPAND_TOOL" -t 8 -- "$MARKDOWN_INPUT" | "$PANDOC_TOOL" "${PANDOC_OPTION[@]}" -o "$HTML_OUTPUT"
+ status="${PIPESTATUS[1]}"
else
if [[ $V_FLAG -ge 1 ]]; then
- echo "$0: debug[3]: will execute pandoc as: $PANDOC_TOOL ${PANDOC_OPTION[*]} -o /dev/null $MARKDOWN_INPUT" 1>&2
+ echo "$0: debug[3]: will execute pandoc as: $EXPAND_TOOL -t 8 -- $MARKDOWN_INPUT | $PANDOC_TOOL ${PANDOC_OPTION[*]} -o /dev/null" 1>&2
fi
- "$PANDOC_TOOL" "${PANDOC_OPTION[*]}" -o /dev/null "$MARKDOWN_INPUT"
- status="$?"
+ "$EXPAND_TOOL" -t 8 -- "$MARKDOWN_INPUT" | "$PANDOC_TOOL" "${PANDOC_OPTION[*]}" -o /dev/null "$MARKDOWN_INPUT"
+ status="${PIPESTATUS[1]}"
fi
if [[ $status -ne 0 ]]; then
echo "$0: ERROR: pandoc: $PANDOC_TOOL exited non-zero: $status" 1>&2
diff --git a/bugs.html b/bugs.html
index 87228bfac..09e3d163c 100644
--- a/bugs.html
+++ b/bugs.html
@@ -960,7 +960,7 @@ test the entry one can do:
sentence.
But doing this shows instead:
echo "Quartz glyph jocks vend, fix, BMW." | compress | ./btoa | ./jaw
- a얖?)V...?????777??hC??h??-? )SSSSXXX????r?L=???*?-???ppp,,,?R
+ a얖?)V...?????777??hC??h??-? )SSSSXXX????r?L=???*?-???ppp,,,?R
?j
111-)))? '..F@E
???b111?