From 8cc6372b14e75a8af38d59c52e3f654494afd753 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 4 May 2021 22:24:13 +0300 Subject: [PATCH] Meta: Strip man prefix from generated man page directories --- .github/workflows/manpages.yml | 12 ++++++++++-- Meta/Websites/man.serenityos.org/index.html | 16 ++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/manpages.yml b/.github/workflows/manpages.yml index 10c0413b79..38277f5219 100644 --- a/.github/workflows/manpages.yml +++ b/.github/workflows/manpages.yml @@ -21,11 +21,19 @@ jobs: - name: Prepare output directories run: | for d in $MAN_DIR*/; do - mkdir -p output/$(basename "$d") + dir_name=$(basename "$d") + mkdir -p output/${dir_name/man} done - name: Convert markdown to html run: | - find $MAN_DIR -iname '*.md' -type f -exec sh -c 'relative=$(realpath --relative-to=$MAN_DIR $0) && pandoc -f gfm -t html5 -s -o output/${relative%.md}.html ${0}' {} \; + cat << EOF > link-fixup.lua + function Link(el) + el.target = string.gsub(el.target, "%.md", ".html") -- fixup .md to .html links + el.target = string.gsub(el.target, "man", "", 1) -- fixup man1/???.html to 1/???.html links + 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}' {} \; - name: Generate man page listings run: | for d in output/*/; do diff --git a/Meta/Websites/man.serenityos.org/index.html b/Meta/Websites/man.serenityos.org/index.html index 041e08177d..3151ea939c 100644 --- a/Meta/Websites/man.serenityos.org/index.html +++ b/Meta/Websites/man.serenityos.org/index.html @@ -6,13 +6,13 @@ SerenityOS

SerenityOS man pages

-

Man 1

-

Man 2

-

Man 3

-

Man 4

-

Man 5

-

Man 6

-

Man 7

-

Man 8

+

Man 1

+

Man 2

+

Man 3

+

Man 4

+

Man 5

+

Man 6

+

Man 7

+

Man 8