From 97e1ee5918222272056d6747735e39933f79011c Mon Sep 17 00:00:00 2001 From: "Konstantin Kirik (snegovick)" Date: Mon, 8 Dec 2025 08:50:38 +0300 Subject: Add scripts and index page for html man pages --- man/index.html | 31 +++++++++++++++++++++++++++++++ man/lib/mklinks.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ man/lib/tohtml.sh | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 man/index.html create mode 100644 man/lib/mklinks.py create mode 100644 man/lib/tohtml.sh (limited to 'man') diff --git a/man/index.html b/man/index.html new file mode 100644 index 00000000..cbc595f2 --- /dev/null +++ b/man/index.html @@ -0,0 +1,31 @@ + + + + + + + INTRO(1) + + +
Section (1) (this section) for the commonly-used commands.
+Section (2) for Limbo modules, including Inferno's system calls.
+Section (3) for kernel devices (accessed by `bind').
+Section (4) for file services (accessed by `mount').
+Section (5) for the Styx file service protocol.
+Section (6) for file formats and system conventions.
+Section (7) for databases and database access modules.
+Section (8) for administrative modules and system services.
+Section (9) for the reference for Inferno's Tk variant, Limbo/Tk.
+Section (10) for the build environment and device driver implementation.
+ + diff --git a/man/lib/mklinks.py b/man/lib/mklinks.py new file mode 100644 index 00000000..b2b22a54 --- /dev/null +++ b/man/lib/mklinks.py @@ -0,0 +1,48 @@ +import sys +import re +import argparse + +path_prefix = "" + +def repl_normal(m): + if m.group('name').lower() == 'section': + return f"{m.group('name')} ({m.group('section')})" + else: + if m.group('section') not in ['lib', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10']: + pass + else: + return f"{m.group('name')} ({m.group('section')})" + return f"{m.group('name')} ({m.group('section')})" + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + prog='mklinks', + description='Makes links obviously', + epilog='God bless you') + parser.add_argument('-i', '--input') + parser.add_argument('-o', '--output') + parser.add_argument('-p', '--path-prefix') + args = parser.parse_args() + + path_prefix = "" + if args.path_prefix is not None: + path_prefix = args.path_prefix + + link_re = re.compile(r"(?P[a-zA-Z0-9\-\_]+) \((?P
[0-9a-z]+)\)") + link_i_re = re.compile(r"(?P[a-zA-Z0-9\-\_]+)\((?P
[0-9a-z]+)\)") + f = None + if args.input is None: + f = sys.stdin + else: + f = open(args.input, 'r') + + text = f.read() + f.close() + + text = link_re.sub(repl_normal, text) + text = link_i_re.sub(repl_normal, text) + if args.output is not None: + with open(args.output, 'w') as out: + out.write(text) + else: + print(text) diff --git a/man/lib/tohtml.sh b/man/lib/tohtml.sh new file mode 100644 index 00000000..b3081a58 --- /dev/null +++ b/man/lib/tohtml.sh @@ -0,0 +1,34 @@ +#!/bin/bash +if [ -e output ]; then + rm output -rf +fi + +cwd=$(pwd) +echo "CWD: ${cwd}" +mkdir output +for d in $(ls); do + if [ -d $d ]; then + if [ x"$d" = x"output" ]; then + continue + fi + if [ x"$d" = x"lib" ]; then + continue + fi + echo "mkdir output/${d}" + mkdir output/${d} + pushd $d + for f in $(ls); do + name=$(basename -- "$f") + ext="${name##*.}" + if [ x"${ext}" = x"html" ]; then + echo "Remove ${f}" + rm $f + else + cat ${f} | mandoc -Thtml | python3 ${cwd}/mklinks.py -p /man/ -o ${cwd}/output/$d/$f.html + #cat ${f} | mandoc -Thtml > ${cwd}/output/$d/$f.html + echo "Processed ${d}/${f}" + fi + done + popd + fi +done -- cgit v1.2.3