mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:25:07 +00:00
man.serenityos.org: Use pandoc for listings and landing page
This makes all pages look and feel the same, because they all use the default CSS generated by pandoc. Also, it inserts the banner everywhere at the top, not only into the top-level index.html. Credit to @xSlendiX for suggesting that `-B` works here.
This commit is contained in:
parent
2e613db999
commit
dad47a3dd1
5 changed files with 66 additions and 31 deletions
1
Meta/Websites/man.serenityos.org/banner-preamble.inc
Normal file
1
Meta/Websites/man.serenityos.org/banner-preamble.inc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<img src="/banner.png" style="display: block; margin-left: auto; margin-right: auto; margin-bottom: 2em;">
|
|
@ -1,17 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>SerenityOS man pages</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<img src="banner.png" alt="SerenityOS">
|
|
||||||
<h1>SerenityOS man pages</h1>
|
|
||||||
<a href="1/"><p>Section 1: User programs (applets, applications, utilities, etc.)</p></a>
|
|
||||||
<a href="2/"><p>Section 2: System calls (getuid, mount, pledge, sendfd, etc.)</p></a>
|
|
||||||
<a href="3/"><p>Section 3: Library functions (basename, isatty, POSIX functions, etc.)</p></a>
|
|
||||||
<a href="4/"><p>Section 4: Special Files (audio, mem, etc.)</p></a>
|
|
||||||
<a href="5/"><p>Section 5: File formats (getopt convention, Shell, SystemServer)</p></a>
|
|
||||||
<a href="7/"><p>Section 7: Miscellanea (mitigations, sys filesystem, SystemServer, etc.)</p></a>
|
|
||||||
<a href="8/"><p>Section 8: Sysadmin tools (dmesg, pls, sysctl, useradd, etc.)</p></a>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
7
Meta/Websites/man.serenityos.org/index.md
Normal file
7
Meta/Websites/man.serenityos.org/index.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
- [Section 1: User programs (applets, applications, utilities, etc.)](man1/index.html)
|
||||||
|
- [Section 2: System calls (getuid, mount, pledge, sendfd, etc.)](man2/index.html)
|
||||||
|
- [Section 3: Library functions (basename, isatty, POSIX functions, etc.)](man3/index.html)
|
||||||
|
- [Section 4: Special Files (audio, mem, etc.)](man4/index.html)
|
||||||
|
- [Section 5: File formats (getopt convention, Shell, SystemServer)](man5/index.html)
|
||||||
|
- [Section 7: Miscellanea (mitigations, sys filesystem, SystemServer, etc.)](man7/index.html)
|
||||||
|
- [Section 8: Sysadmin tools (dmesg, pls, sysctl, useradd, etc.)](man8/index.html)
|
|
@ -32,24 +32,60 @@ for md_file in "${MAN_DIR}"*/*.md; do
|
||||||
section_number="${section#man}"
|
section_number="${section#man}"
|
||||||
filename="${relative_path#*/}"
|
filename="${relative_path#*/}"
|
||||||
name="${filename%.md}"
|
name="${filename%.md}"
|
||||||
pandoc -f gfm -t html5 -s --lua-filter=Meta/convert-markdown-links.lua --metadata title="${name}(${section_number}) - SerenityOS man pages" -o "output/${section}/${name}.html" "${md_file}"
|
pandoc -f gfm -t html5 -s \
|
||||||
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
|
--lua-filter=Meta/convert-markdown-links.lua \
|
||||||
|
--metadata title="${name}(${section_number}) - SerenityOS man pages" \
|
||||||
|
-o "output/${section}/${name}.html" \
|
||||||
|
"${md_file}"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate man page listings
|
# Generate man page listings through pandoc
|
||||||
for d in output/*/; do
|
for d in output/*/; do
|
||||||
section=$(basename "$d")
|
section=$(basename "$d")
|
||||||
section_number="${section#man}"
|
section_number="${section#man}"
|
||||||
echo "<!DOCTYPE html><html><head><title>Section ${section_number} - SerenityOS man pages</title></head><body>" > "${d}/index.html"
|
pandoc -f gfm -t html5 -s \
|
||||||
for f in "$d"/*; do
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
filename=$(basename "$f")
|
--metadata title="Section ${section_number} - SerenityOS man pages" \
|
||||||
name="${filename%.html}"
|
-o "output/${section}/index.html" \
|
||||||
if [[ "$filename" == "index.html" ]]; then
|
<(
|
||||||
continue
|
for f in "$d"/*; do
|
||||||
fi
|
filename=$(basename "$f")
|
||||||
echo "<a href=\"${filename}\"><p>${name}(${section_number})</p></a>" >> "${d}/index.html"
|
name="${filename%.html}"
|
||||||
done
|
if [[ "$filename" == "index.html" ]]; then
|
||||||
echo "</body></html>" >> "$d/index.html"
|
continue
|
||||||
|
fi
|
||||||
|
echo "- [${name}](${filename})"
|
||||||
|
done
|
||||||
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Generate man page listings through pandoc
|
||||||
|
for d in output/*/; do
|
||||||
|
section=$(basename "$d")
|
||||||
|
section_number="${section#man}"
|
||||||
|
pandoc -f gfm -t html5 -s \
|
||||||
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
|
--metadata title="Section ${section_number} - SerenityOS man pages" \
|
||||||
|
-o "output/${section}/index.html" \
|
||||||
|
<(
|
||||||
|
for f in "$d"/*; do
|
||||||
|
filename=$(basename "$f")
|
||||||
|
name="${filename%.html}"
|
||||||
|
if [[ "$filename" == "index.html" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "- [${name}](${filename})"
|
||||||
|
done
|
||||||
|
)
|
||||||
|
done
|
||||||
|
|
||||||
|
# Generate main landing page listings through pandoc
|
||||||
|
pandoc -f gfm -t html5 -s \
|
||||||
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
|
--metadata title="SerenityOS man pages" \
|
||||||
|
-o output/index.html \
|
||||||
|
Meta/Websites/man.serenityos.org/index.md
|
||||||
|
|
||||||
# Copy pre-made files
|
# Copy pre-made files
|
||||||
cp -R Meta/Websites/man.serenityos.org/* output/
|
cp Meta/Websites/man.serenityos.org/banner.png output/
|
||||||
|
|
|
@ -37,8 +37,16 @@ static bool is_missing_file_acceptable(String const& filename)
|
||||||
"/usr/share/man/man2/open.md",
|
"/usr/share/man/man2/open.md",
|
||||||
"/usr/share/man/man2/ptrace.md",
|
"/usr/share/man/man2/ptrace.md",
|
||||||
"/usr/share/man/man5/perfcore.md",
|
"/usr/share/man/man5/perfcore.md",
|
||||||
// This one is okay:
|
// These ones are okay:
|
||||||
"/home/anon/js-tests/test-common.js",
|
"/home/anon/js-tests/test-common.js",
|
||||||
|
"/man1/index.html",
|
||||||
|
"/man2/index.html",
|
||||||
|
"/man3/index.html",
|
||||||
|
"/man4/index.html",
|
||||||
|
"/man5/index.html",
|
||||||
|
"/man6/index.html",
|
||||||
|
"/man7/index.html",
|
||||||
|
"/man8/index.html",
|
||||||
};
|
};
|
||||||
for (auto const& suffix : acceptable_missing_files) {
|
for (auto const& suffix : acceptable_missing_files) {
|
||||||
if (filename.ends_with(suffix))
|
if (filename.ends_with(suffix))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue