diff options
Diffstat (limited to 'man/lib')
| -rw-r--r-- | man/lib/mksectionindex.py | 36 | ||||
| -rw-r--r-- | man/lib/tohtml.sh | 6 |
2 files changed, 40 insertions, 2 deletions
diff --git a/man/lib/mksectionindex.py b/man/lib/mksectionindex.py new file mode 100644 index 00000000..480011fe --- /dev/null +++ b/man/lib/mksectionindex.py @@ -0,0 +1,36 @@ +import os +import sys + +if __name__ == "__main__": + prefix = sys.argv[1] + section = sys.argv[2] + index_file = """<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"/> +<meta name="viewport" content="width=device-width, initial-scale=1.0"/> +<style> + table.head, table.foot { width: 100%; } + td.head-rtitle, td.foot-os { text-align: right; } + td.head-vol { text-align: center; } + .Nd, .Bf, .Op { display: inline; } + .Pa, .Ad { font-style: italic; } + .Ms { font-weight: bold; } + .Bl-diag > dt { font-weight: bold; } + code.Nm, .Fl, .Cm, .Ic, code.In, .Fd, .Fn, .Cd { font-weight: bold; + font-family: inherit; } +</style>""" + + index_file += f"<title>Section {section} index</title>" + index_file += f""" +</head> +<body> + <h1>Section {section} index</h1> +<pre> +""" + + for f in os.listdir(): + index_file += f"<a href=\"{prefix}{section}/{f}\">{f}</a>\n" + + index_file += "</pre></body></html>" + print(index_file) diff --git a/man/lib/tohtml.sh b/man/lib/tohtml.sh index b3081a58..6b10e535 100644 --- a/man/lib/tohtml.sh +++ b/man/lib/tohtml.sh @@ -24,11 +24,13 @@ for d in $(ls); do 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 + cat ${f} | mandoc -Thtml | python3 ${cwd}/lib/mklinks.py -p /man/ -o ${cwd}/output/$d/$f.html echo "Processed ${d}/${f}" fi done + rm ${cwd}/output/$d/INDEX.html + python3 ${cwd}/lib/mksectionindex.py /man/ ${d} > ${cwd}/output/$d/index.html popd fi done +cp ${cwd}/index.html output |
