Make docs update script also produce PDFs

See rgbds-www#12
This commit is contained in:
ISSOtm
2021-03-20 01:53:26 +01:00
parent a929f36bc5
commit 5d2e2e2182

View File

@@ -53,8 +53,8 @@ PAGES=(
WWWPATH="/docs" WWWPATH="/docs"
mkdir -p "$1/_documentation/$2" mkdir -p "$1/_documentation/$2"
# `mandoc` uses a different format for referring to man pages present in the **current** directory # `mandoc` uses a different format for referring to man pages present in the **current** directory.
# We want that format for RGBDS man pages, and the other one for the t=rest; # We want that format for RGBDS man pages, and the other one for the rest;
# we thus need to copy all pages to a temporary directory, and process them there. # we thus need to copy all pages to a temporary directory, and process them there.
# Copy all pages to current dir # Copy all pages to current dir
@@ -77,6 +77,7 @@ EOF
options+=,toc options+=,toc
fi fi
mandoc -Thtml -I os=Linux -O$options "${PAGES[$page]##*/}" | .github/actions/doc_postproc.awk >> "$1/_documentation/$2/$page" mandoc -Thtml -I os=Linux -O$options "${PAGES[$page]##*/}" | .github/actions/doc_postproc.awk >> "$1/_documentation/$2/$page"
groff -Tpdf -mdoc -wall "${PAGES[$page]##*/}" >"$1/_documentation/$2/$stem.pdf"
if [ $is_release -ne 0 ]; then if [ $is_release -ne 0 ]; then
cat - >"$1/_documentation/$page" <<EOF cat - >"$1/_documentation/$page" <<EOF
--- ---
@@ -88,6 +89,7 @@ description: RGBDS latest stable — $descr
EOF EOF
fi fi
done done
cat - >"$1/_documentation/$2/index.html" <<EOF cat - >"$1/_documentation/$2/index.html" <<EOF
--- ---
layout: doc_index layout: doc_index
@@ -97,6 +99,7 @@ description: RGBDS $2 - Online manual
--- ---
EOF EOF
# If making a release, add a new entry right after `master` # If making a release, add a new entry right after `master`
if [ $is_release -ne 0 ]; then if [ $is_release -ne 0 ]; then
awk '{ print } awk '{ print }
@@ -105,5 +108,6 @@ if [ $is_release -ne 0 ]; then
mv "$1/_data/doc.json"{.tmp,} mv "$1/_data/doc.json"{.tmp,}
fi fi
# Clean up # Clean up
rm "${PAGES[@]##*/}" rm "${PAGES[@]##*/}"