LDoc: update gendoc script to add version info

This commit is contained in:
Jordan Irwin 2021-08-16 02:29:13 -07:00
parent 06e4408b91
commit b261dda15c

View file

@ -10,7 +10,6 @@ cd "${d_ldoc}/.."
d_root="$(pwd)"
d_export="${d_export:-${d_root}/docs/reference}"
d_data="${d_export}/data"
cmd_ldoc="${d_ldoc}/ldoc/ldoc.lua"
if test ! -x "${cmd_ldoc}"; then
@ -20,8 +19,11 @@ fi
# clean old files
rm -rf "${d_export}"
vinfo="v$(grep "^version = " "${d_root}/mod.conf" | head -1 | sed -e 's/version = //')"
d_data="${d_export}/${vinfo}/data"
# generate new doc files
"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}" "${d_root}"; retval=$?
"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}/${vinfo}" "${d_root}"; retval=$?
# check exit status
if test ${retval} -ne 0; then
@ -29,6 +31,11 @@ if test ${retval} -ne 0; then
exit ${retval}
fi
# show version info
for html in $(find "${d_export}/${vinfo}" -type f -name "*.html"); do
sed -i -e "s|^<h1>[cC]leaner</h1>$|<h1>Cleaner <span style=\"font-size:12pt;\">(${vinfo})</span></h1>|" "${html}"
done
# copy textures to data directory
echo -e "\ncopying textures ..."
mkdir -p "${d_data}"