#!/bin/sh
# Generate manual page preview as rendered by 'make html', removed some styling
# so there can be visual artifacts, usable for CI summary
if ! [ -f "$1" ]; then
exit 0
fi
prefix=Documentation/
here=$(pwd)
if [ "$(basename \"$here\")" = 'Documentation' ]; then
prefix=
fi
fn="$1"
bn=$(basename "$fn" .rst)
html=$(find "${prefix}"_build/html -name "$bn".'html')
if ! [ -f "$html" ]; then
#echo "ERROR: cannot find html page '$html' from bn $bn fn $fn "
exit 0
fi
cat << EOF
$fn
EOF
# Up to
, before that there's left bar navigation
cat "$html" | sed -e 's/^\s\+//' | awk '
/^