2021-01-04 10:04:07 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
__cdist_pwd="$(pwd -P)"
|
|
|
|
__cdist_mydir="${0%/*}";
|
|
|
|
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
|
|
|
|
__cdist_myname=${0##*/};
|
|
|
|
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
|
|
|
|
|
|
|
|
filename="${__cdist_myname%.sh}"
|
|
|
|
dest="$__cdist_abs_mydir/$filename"
|
|
|
|
|
2021-01-11 10:34:54 +00:00
|
|
|
if ! command -v pandoc > /dev/null; then
|
|
|
|
echo "Pandoc is required to generate HTML index from README." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-04 10:04:07 +00:00
|
|
|
cd "$__cdist_abs_mydir"
|
|
|
|
|
|
|
|
exec > "$dest"
|
|
|
|
|
2021-01-11 10:34:54 +00:00
|
|
|
pandoc -f markdown -t rst ../../README.md
|
2021-01-04 10:04:07 +00:00
|
|
|
|
2021-01-11 10:34:54 +00:00
|
|
|
cat << EOF
|
2021-01-04 10:04:07 +00:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:hidden:
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# If there is no such file then ls prints error to stderr,
|
|
|
|
# so redirect stderr to /dev/null.
|
|
|
|
for type in $(ls man7/cdist-type__*.rst 2>/dev/null | LC_ALL=C sort); do
|
|
|
|
no_dir="${type#man7/}";
|
|
|
|
no_type="${no_dir#cdist-type}";
|
|
|
|
name="${no_type%.rst}";
|
|
|
|
manref="${no_dir%.rst}"
|
|
|
|
man="${manref}(7)"
|
|
|
|
|
|
|
|
echo " $name" "<man7/${manref}>"
|
|
|
|
done
|