mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
Meta: Generate manpages for website in parallel
pandoc is a single-threaded and pretty slow application, so we can run it in the background and "synchronize" before generating section indices. Timing results: Before: Time (abs ≡): 59.833 s [User: 49.541 s, System: 6.943 s] After: Time (abs ≡): 20.440 s [User: 133.928 s, System: 12.290 s] (both generated with hyperfine -p "rm -r output || true" -r 1 Meta/build-manpages-website.sh )
This commit is contained in:
parent
a196fafd0f
commit
a205efd900
1 changed files with 11 additions and 4 deletions
|
@ -44,9 +44,13 @@ for md_file in $(find "${MAN_DIR}" -iname '*.md' | ${SORT}); do
|
||||||
--lua-filter=Meta/convert-markdown-links.lua \
|
--lua-filter=Meta/convert-markdown-links.lua \
|
||||||
--metadata title="${name}(${section_number}) - SerenityOS man pages" \
|
--metadata title="${name}(${section_number}) - SerenityOS man pages" \
|
||||||
-o "${output_file}" \
|
-o "${output_file}" \
|
||||||
"${md_file}"
|
"${md_file}" &
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Wait for all pandoc executions to finish so that man page indices are always correct.
|
||||||
|
# shellcheck disable=SC2046 # Word splitting is intentional here
|
||||||
|
wait $(jobs -p)
|
||||||
|
|
||||||
# Generate man page listings through pandoc
|
# Generate man page listings through pandoc
|
||||||
for section_directory in output/*/; do
|
for section_directory in output/*/; do
|
||||||
section=$(basename "${section_directory}")
|
section=$(basename "${section_directory}")
|
||||||
|
@ -78,7 +82,7 @@ for section_directory in output/*/; do
|
||||||
fi
|
fi
|
||||||
echo "- [${name}](${filename})"
|
echo "- [${name}](${filename})"
|
||||||
done
|
done
|
||||||
)
|
) &
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate main landing page listings through pandoc
|
# Generate main landing page listings through pandoc
|
||||||
|
@ -87,12 +91,12 @@ pandoc -f gfm -t html5 -s \
|
||||||
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
--metadata title="SerenityOS man pages" \
|
--metadata title="SerenityOS man pages" \
|
||||||
-o output/index.html \
|
-o output/index.html \
|
||||||
Meta/Websites/man.serenityos.org/index.md
|
Meta/Websites/man.serenityos.org/index.md &
|
||||||
pandoc -f gfm -t html5 -s \
|
pandoc -f gfm -t html5 -s \
|
||||||
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
-B Meta/Websites/man.serenityos.org/banner-preamble.inc \
|
||||||
--metadata title="Can't run applications" \
|
--metadata title="Can't run applications" \
|
||||||
-o output/cant-run-application.html \
|
-o output/cant-run-application.html \
|
||||||
Meta/Websites/man.serenityos.org/cant-run-application.md
|
Meta/Websites/man.serenityos.org/cant-run-application.md &
|
||||||
|
|
||||||
# Copy pre-made files
|
# Copy pre-made files
|
||||||
echo 'Copying images'
|
echo 'Copying images'
|
||||||
|
@ -108,3 +112,6 @@ while read -r p; do
|
||||||
done < icons.txt
|
done < icons.txt
|
||||||
|
|
||||||
rm icons.txt
|
rm icons.txt
|
||||||
|
|
||||||
|
# shellcheck disable=SC2046 # Word splitting is intentional here
|
||||||
|
wait $(jobs -p)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue