Add manpage generation and publishing to website workflow

This commit is contained in:
Sylvestre Ledru
2026-03-15 23:55:36 +01:00
parent fbaaa191a8
commit 08f02cf362
2 changed files with 197 additions and 3 deletions
+50 -3
View File
@@ -41,7 +41,7 @@ jobs:
- name: Install system deps
run: |
sudo apt install libacl1-dev libselinux1-dev
sudo apt install libacl1-dev libselinux1-dev libsystemd-dev man2html
- name: Download tldr archive
run: |
@@ -57,12 +57,57 @@ jobs:
cd coreutils
cargo run --bin uudoc --all-features
cd docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Generate Coreutils Manpages
run: |
cd coreutils
make install-manpages DESTDIR=../manpages
- name: Convert Manpages to HTML and Generate Index
run: |
mkdir -p manpages-html
# Create JSON list for dynamic loading
echo "[" > manpages-html/manpages.json
first=true
# Convert manpages to HTML
for man in manpages/usr/local/share/man/man*/*.1; do
if [ -f "$man" ]; then
name=$(basename "$man" .1)
man2html -r "$man" > "manpages-html/${name}.html"
# Add to JSON list
if [ "$first" = true ]; then
echo " \"${name}\"" >> manpages-html/manpages.json
first=false
else
echo " ,\"${name}\"" >> manpages-html/manpages.json
fi
fi
done
echo "]" >> manpages-html/manpages.json
# Create index page for Zola to process (picked up by the "Run Zola" step)
cat > uutils.github.io/content/coreutils-manpages.md << 'EOF'
+++
title = "Manual Pages"
template = "manpages.html"
[extra]
project = "coreutils"
+++
EOF
- name: Build Findutils Docs
run: |
cd findutils
cd docs
cd findutils/docs
# Remove deprecated 'multilingual' field unsupported by newer mdbook
sed -i '/^multilingual/d' book.toml
mdbook build
- name: Run Zola
@@ -76,6 +121,8 @@ jobs:
cp -r uutils.github.io/public public
cp -r coreutils/docs/book public/coreutils/docs
cp -r findutils/docs/book public/findutils/docs
mkdir -p public/coreutils/manpages
cp -r manpages-html/* public/coreutils/manpages/
- name: Upload artifact for checking the output
uses: actions/upload-artifact@v4
+147
View File
@@ -0,0 +1,147 @@
{% extends "base.html" %}
{% block title %}
{{ page.title }} - {{ config.title }}
{% endblock title %}
{% block main %}
<style>
.manpage-container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.manpage-header {
margin-bottom: 30px;
}
.manpage-header h1 {
color: #333;
margin-bottom: 10px;
}
.manpage-description {
color: #666;
line-height: 1.6;
margin-bottom: 30px;
}
.manpage-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 15px;
margin-top: 30px;
}
.manpage-link {
display: block;
padding: 12px;
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 5px;
text-decoration: none;
color: #333;
transition: all 0.3s ease;
text-align: center;
}
.manpage-link:hover {
background: #007acc;
color: white;
border-color: #007acc;
transform: translateY(-2px);
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.manpage-name {
font-weight: bold;
font-family: monospace;
font-size: 1.1em;
}
.breadcrumb {
margin-bottom: 20px;
}
.breadcrumb a {
color: #007acc;
text-decoration: none;
}
.breadcrumb a:hover {
text-decoration: underline;
}
@media (prefers-color-scheme: dark) {
.manpage-header h1 {
color: #e0e0e0;
}
.manpage-link {
background: #2a2a2a;
border-color: #444;
color: #e0e0e0;
}
.manpage-link:hover {
background: #007acc;
color: white;
border-color: #007acc;
}
}
</style>
<div class="manpage-container">
<div class="breadcrumb">
<a href="/">Home</a> /
<a href="/{{ page.extra.project | default(value="coreutils") }}">{{ page.extra.project | default(value="Coreutils") | capitalize }}</a> /
<span>Manual Pages</span>
</div>
<div class="manpage-header">
<h1>{{ page.title }}</h1>
<p class="manpage-description">
{{ page.description | default(value="Complete manual pages for all uutils commands. Click on any command below to view its full documentation.") }}
</p>
</div>
<div class="manpage-grid">
{% if page.extra.manpages %}
{% for manpage in page.extra.manpages %}
<a href="{{ manpage.name }}.html" class="manpage-link">
<span class="manpage-name">{{ manpage.name }}</span>
</a>
{% endfor %}
{% else %}
<!-- This will be populated dynamically by the build process -->
<div id="manpage-list"></div>
{% endif %}
</div>
</div>
<script>
// If manpages weren't provided in the template data,
// try to load them dynamically from the current directory
if (!document.querySelector('.manpage-grid a')) {
fetch('./manpages.json')
.then(response => response.json())
.then(manpages => {
const grid = document.querySelector('.manpage-grid');
const listDiv = document.getElementById('manpage-list');
if (listDiv) {
listDiv.remove();
}
manpages.forEach(name => {
const link = document.createElement('a');
link.href = `${name}.html`;
link.className = 'manpage-link';
link.innerHTML = `<span class="manpage-name">${name}</span>`;
grid.appendChild(link);
});
})
.catch(err => console.error('Failed to load manpages list:', err));
}
</script>
{% endblock main %}