Use generated tables instead of hand-crafted tables.

This commit is contained in:
Jordan Bancino 2023-02-15 03:30:52 +00:00
parent e3b8eaf941
commit de0ece10e2
3 changed files with 40 additions and 179 deletions

View file

@ -118,188 +118,12 @@ configure it, as well as contribute to the project. The <code>man</code>
pages are also available online for convenience:
</p>
<p>User Documentation:</p>
<table>
<tr>
<th>Man Page</th>
<th>Description</th>
</tr>
<tr>
<td><a href="man/man7/telodendria.7.html">telodendria(7)</a></td>
<td>
<b>Start here.</b> This page contains the project introduction, and provides
information about it, such as its status, how to contact the developers, and what
the source code license is.
</td>
</tr>
<tr>
<td><a href="man/man8/telodendria.8.html">telodendria(8)</a></td>
<td>
Command line usage for <b>Telodendria</b> administrators.
</td>
</tr>
<tr>
<td><a href="man/man5/telodendria.conf.5.html">telodendria.conf(5)</a></td>
<td>
Configuration file options.
</td>
</tr>
<tr>
<td><a href="man/man7/telodendria-contributing.7.html">telodendria-contributing(7)</a></td>
<td>
Contributing guide.
</td>
</tr>
<tr>
<td><a href="man/man7/telodendria-changelog.7.html">telodendria-changelog(7)</a></td>
<td>
The change log for the Telodendria project.
</td>
</tr>
</table>
${USER_DOCS}
<p>
<details>
<summary>Developer Documentation:</summary>
</p>
<table>
<tr>
<th>Man Page</th>
<th>Description</th>
</tr>
<tr>
<td><a href="man/man7/porting.7.html">porting(7)</a></td>
<td>
Want to package Telodendria for your operating system?
Look no further than this page.
</td>
</tr>
<tr>
<td><a href="man/man8/td.8.html">td(8)</a></td>
<td>
Build script and patch generation instructions.
</td>
</tr>
<tr>
<td><a href="man/man8/send-patch.8.html">send-patch(8)</a></td>
<td>
A simple script to send patch files to the Telodendria project.
</td>
</tr>
<tr>
<td><a href="man/man3/Array.3.html">Array(3)</a></td>
<td>
Dynamically-sized array API.
</td>
</tr>
<tr>
<td><a href="man/man3/Base64.3.html">Base64(3)</a></td>
<td>
Base64 implementation with Matrix's "unpadded base64" support.
</td>
</tr>
<tr>
<td><a href="man/man3/HashMap.3.html">HashMap(3)</a></td>
<td>
A simple hash map implementation.
</td>
</tr>
<tr>
<td><a href="man/man3/Queue.3.html">Queue(3)</a></td>
<td>
Basic fixed-size circular queue implementation.
</td>
</tr>
<tr>
<td><a href="man/man3/Log.3.html">Log(3)</a></td>
<td>
Logging framework used to log messages in Telodendria.
</td>
</tr>
<tr>
<td><a href="man/man3/Util.3.html">Util(3)</a></td>
<td>
Misc utility functions that don't need their own header.
</td>
</tr>
<tr>
<td><a href="man/man3/Db.3.html">Db(3)</a></td>
<td>
A minimal flat-file database with object locking and an efficient
cache.
</td>
</tr>
<tr>
<td><a href="man/man3/Memory.3.html">Memory(3)</a></td>
<td>
Smart memory management API.
</td>
</tr>
<tr>
<td><a href="man/man3/Json.3.html">Json(3)</a></td>
<td>
A feature-complete API for reading and writing JSON.
</td>
</tr>
<tr>
<td><a href="man/man3/CanonicalJson.3.html">CanonicalJson(3)</a></td>
<td>
An extension to the Json API that implements Matrix's canonical JSON.
</td>
</tr>
<tr>
<td><a href="man/man3/TelodendriaConfig.3.html">TelodendriaConfig(3)</a></td>
<td>
Parse the configuration file into a structure.
</td>
</tr>
<tr>
<td><a href="man/man3/Matrix.3.html">Matrix(3)</a></td>
<td>
Functions for writing Matrix API endpoints.
</td>
</tr>
<tr>
<td><a href="man/man3/Routes.3.html">Routes(3)</a></td>
<td>
Matrix API endpoint abstractions.
</td>
</tr>
<tr>
<td><a href="man/man3/Http.3.html">Http(3)</a></td>
<td>
Encode and decode various parts of the HTTP protocol.
</td>
</tr>
<tr>
<td><a href="man/man3/HttpServer.3.html">HttpServer(3)</a></td>
<td>
Extremely simple HTTP server.
</td>
</tr>
<tr>
<td><a href="man/man3/Sha2.3.html">Sha2(3)</a></td>
<td>
A simple implementation of the SHA2 hashing functions.
</td>
</tr>
<tr>
<td><a href="man/man3/Cron.3.html">Cron(3)</a></td>
<td>
A basic periodic job scheduler.
</td>
</tr>
<tr>
<td><a href="man/man3/User.3.html">User(3)</a></td>
<td>
Convenience functions for working with local users.
</td>
</tr>
<tr>
<td><a href="man/man3/Str.3.html">Str(3)</a></td>
<td>
Functions for manipulating and creating strings.
</td>
</tr>
</table>
${DEV_DOCS}
</details>
<hr>
<p>

34
tools/bin/man-table Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env sh
printf "<table>"
printf "<tr>"
printf "<th>Man Page</th>"
printf "<th>Description</th>"
printf "</tr>"
find man -type f -name '*.[1-9]' | while IFS= read -r file; do
base=$(basename "$file")
name=$(echo "$base" | cut -d '.' -f 1)
section=$(echo "$base" | cut -d '.' -f 2)
description=$(grep '^\.Nd' "$file" | cut -d ' ' -f 2-)
prefix=$(echo "$name" | cut -d '-' -f 1)
if [ "$prefix" = "telodendria" ]; then
if [ "$1" = "dev" ]; then
continue
fi
else
if [ "$1" = "user" ]; then
continue
fi
fi
printf "<tr>"
printf "<td><a href=\"man/man$section/$name.$section.html\">$name($section)</a></td>"
printf "<td>$description</td>"
printf "</tr>"
done
printf "</table>"

View file

@ -71,7 +71,7 @@ setsubst() {
(
set | while IFS='=' read -r var val; do
val=$(echo "$val" | cut -d "'" -f 2)
val=$(echo "$val" | cut -d "'" -f 2- | rev | cut -d "'" -f 2- | rev)
echo "s|\\\${$var}|$val|g"
done
@ -164,7 +164,10 @@ recipe_site() {
exit 1
fi
# Set some variables that may be replaced in the files.
DATE=$(date)
USER_DOCS=$(man-table user)
DEV_DOCS=$(man-table dev)
cd site/
find . -type f | while IFS= read -r file; do