diff options
author | Linus Groh <mail@linusgroh.de> | 2021-05-07 18:07:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-07 22:28:33 +0200 |
commit | 867072c7d837eb1431c444f881257bda5111193d (patch) | |
tree | 3017f4121a94bbad1b1d4f02c7e0dd84c7eda5f0 /.github | |
parent | d2b61487870073ad4aba150bf8e46f87ae807c85 (diff) | |
download | serenity-867072c7d837eb1431c444f881257bda5111193d.zip |
Meta: Improve man.serenityos.org titles and link names
Index page:
- Change links from "Man 1" to "Section 1"
Section index pages:
- Change title from "1" to "Section 1 - SerenityOS man pages"
- Change links from "foo" to "foo(1)"
Man pages:
- Change title from "foo" to "foo(1) - SerenityOS man pages"
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/manpages.yml | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/.github/workflows/manpages.yml b/.github/workflows/manpages.yml index 38277f5219..18aa04bf59 100644 --- a/.github/workflows/manpages.yml +++ b/.github/workflows/manpages.yml @@ -22,7 +22,8 @@ jobs: run: | for d in $MAN_DIR*/; do dir_name=$(basename "$d") - mkdir -p output/${dir_name/man} + section="${dir_name/man}" + mkdir -p "output/${section}" done - name: Convert markdown to html run: | @@ -33,18 +34,26 @@ jobs: return el end EOF - find $MAN_DIR -iname '*.md' -type f -exec sh -c 'relative_path=$(realpath --relative-to=$MAN_DIR $0) && stripped_path=${relative_path#man} && pandoc -f gfm -t html5 -s --lua-filter=link-fixup.lua -o output/${stripped_path%.md}.html ${0}' {} \; + find $MAN_DIR -iname '*.md' -type f -exec sh -c '\ + relative_path="$(realpath --relative-to=$MAN_DIR $0)" \ + && stripped_path="${relative_path#man}" \ + && section="${stripped_path%%/*}" \ + && filename="${stripped_path#*/}" \ + && name="${filename%.md}" \ + && pandoc -f gfm -t html5 -s --lua-filter=link-fixup.lua --metadata title="${name}(${section}) - SerenityOS man pages" -o "output/${section}/${name}.html" "${0}" \ + ' {} \; - name: Generate man page listings run: | for d in output/*/; do - dir_name=$(basename "$d") - echo "<!DOCTYPE html><html><head><title>$dir_name</title></head><body>" > "$d/index.html" + section=$(basename "$d") + echo "<!DOCTYPE html><html><head><title>Section ${section} - SerenityOS man pages</title></head><body>" > "${d}/index.html" for f in $d/*; do - file_name=$(basename "$f") - if [[ "$file_name" == "index.html" ]]; then + filename=$(basename "$f") + name="${filename%.html}" + if [[ "$filename" == "index.html" ]]; then continue fi - echo "<a href=\"$file_name\"><p>${file_name%.html}</p></a>" >> "$d/index.html" + echo "<a href=\"${filename}\"><p>${name}(${section})</p></a>" >> "${d}/index.html" done echo "</body></html>" >> "$d/index.html" done |