kawipiko/scripts/documentation.z-run
2023-03-05 17:26:36 +02:00

89 lines
1.9 KiB
Plaintext

#!/dev/null
::// documentation / ...
<< documentation / all / render
test "${#}" -eq 0
"${ZRUN}" ':: documentation / manuals / render'
"${ZRUN}" ':: sources / embedded / documentation'
!!
<< documentation / all / render / forced
test "${#}" -eq 0
"${ZRUN}" ':: documentation / manuals / render'
"${ZRUN}" ':: sources / embedded / documentation'
!!
<< documentation / readme / open
test "${#}" -eq 0
exec -- x-www 'guest:*' open http://127.33.237.174:8080/
!!
<< documentation / readme / server
test "${#}" -eq 0
exec -- env -i -- ./.outputs/python/bin/restview --no-browser --listen 127.33.237.174:8080 --allowed-hosts '*' -- ./readme.rst
!!
<< documentation / manuals / render
test "${#}" -eq 0
_date="$( exec -- date -- '+%Y-%m-%d' )"
for _manual in archiver server ; do
printf -- '[ii] rendering `%s`...\n' "${_manual}" >&2
rst2html --strict --no-generator --embed-stylesheet \
< "./documentation/manuals/${_manual}.rst" \
>| "./documentation/manuals/${_manual}.html.tmp" \
#
mv -T -- \
"./documentation/manuals/${_manual}.html.tmp" \
"./documentation/manuals/${_manual}.html" \
#
rst2man --strict --no-generator \
< "./documentation/manuals/${_manual}.rst" \
| sed -r \
-e 's#^\.TH .*#.TH "KAWIPIKO\-'"${_manual^^}"'" "1" "'"${_date}"'" "volution.ro" "kawipiko"#' \
>| "./documentation/manuals/${_manual}.1.man.tmp" \
#
mv -T -- \
"./documentation/manuals/${_manual}.1.man.tmp" \
"./documentation/manuals/${_manual}.1.man" \
#
mandoc \
-c \
-man \
-T utf8 \
-I os=POSIX \
-O indent=2 \
-O width=78 \
-W error \
< "./documentation/manuals/${_manual}.1.man" \
| col -b -x \
>| "./documentation/manuals/${_manual}.txt.tmp" \
#
mv -T -- \
"./documentation/manuals/${_manual}.txt.tmp" \
"./documentation/manuals/${_manual}.txt" \
#
done
!!