shithub: rgbds

Download patch

ref: 37e45de9c105f32033e7562055581ec586ef1681
parent: 5e63527190136f6ef2bad10baaa25ac5a4162287
author: ISSOtm <eldredhabert0@gmail.com>
date: Tue Sep 15 14:27:55 EDT 2020

Improve rendering of pages

Make links to other man pages work
Add a table of contents to rgbasm(5)
Make the OS at the bottom of all pages 'Linux'
Apply post-processor that used to be used

--- a/.github/actions/get-pages.sh
+++ b/.github/actions/get-pages.sh
@@ -54,6 +54,13 @@
 WWWPATH="/docs"
 mkdir -p "$1/$2"
 
+# `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 thus need to copy all pages to a temporary directory, and process them there.
+
+# Copy all pages to current dir
+cp "${PAGES[@]}" .
+
 for page in "${!PAGES[@]}"; do
 stem="${page%.html}"
 manpage="${stem%.?}(${stem#*.})"
@@ -66,7 +73,11 @@
 description: RGBDS $2 — $descr
 ---
 EOF
-	mandoc -Thtml -Ofragment "${PAGES[$page]}" >> "$1/$2/$page"
+	options=fragment,man='%N.%S.html;https://linux.die.net/man/%S/%N'
+	if [ $stem = rgbasm.5 ]; then
+		options+=,toc
+	fi
+	mandoc -Thtml -I os=Linux -O$options "${PAGES[$page]##*/}" | src/doc_postproc.awk >> "$1/$2/$page"
 	if [ $update_redirects -ne 0 ]; then
 		cat - >"$1/$page" <<EOF
 ---
@@ -85,3 +96,6 @@
 description: RGBDS $2 - Online manual
 ---
 EOF
+
+# Clean up
+rm "${PAGES[@]##*/}"