Skip to content

Commit 94f36a8

Browse files
committed
Add man-html
1 parent c2f7601 commit 94f36a8

File tree

5 files changed

+71
-25
lines changed

5 files changed

+71
-25
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ mark_as_advanced(FIND_DEBUGINFO)
314314
find_program(SCDOC NAMES scdoc REQUIRED)
315315
mark_as_advanced(SCDOC)
316316

317+
find_program(SCD2HTML NAMES scd2html)
318+
mark_as_advanced(SCD2HTML)
319+
317320
function(chkdef func req)
318321
string(TOUPPER ${func} FUNC)
319322
set(HAVENAME HAVE_${FUNC})

docs/_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ plugins:
99
# - jekyll-readme-index
1010
- jekyll-titles-from-headings
1111
- jekyll-relative-links
12+
13+
collections:
14+
man:
15+
output: true

docs/man/CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ foreach(man ${manuals})
1919
endforeach()
2020
add_custom_target(man ALL DEPENDS ${manuals})
2121

22+
# Render all manuals in HTML
23+
configure_file(mkpage.in mkpage @ONLY)
24+
set(htmldir ${CMAKE_BINARY_DIR}/docs/_man)
25+
set(htmlfiles "")
26+
file(MAKE_DIRECTORY ${htmldir})
27+
foreach(man ${manuals})
28+
set(file ${htmldir}/${man}.html)
29+
add_custom_command(OUTPUT ${file}
30+
COMMAND ./mkpage ${CMAKE_CURRENT_SOURCE_DIR}/${man}.scd ${file}
31+
DEPENDS ${man}.scd)
32+
list(APPEND htmlfiles ${file})
33+
endforeach()
34+
add_custom_target(man-html ALL DEPENDS ${htmlfiles})
35+
2236
# Install manuals for the enabled features
2337
set(manuals ${core})
2438
if (ENABLE_PLUGINS)

docs/man/index.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,20 @@
22
layout: default
33
title: rpm.org - RPM Manual Pages
44
---
5+
6+
{% assign tools = site.man | where: 'topic', 'tool' %}
7+
{% assign plugins = site.man | where: 'topic', 'plugin' %}
8+
59
# RPM Manual Pages
610

711
## Tools
8-
* [rpm (8)](rpm.8.scd)
9-
* [rpm-misc (8)](rpm-misc.8.scd)
10-
* [rpmbuild (1)](rpmbuild.1.scd)
11-
* [rpmdeps (1)](rpmdeps.1.scd)
12-
* [rpmdb (8)](rpmdb.8.scd)
13-
* [rpmgraph (1)](rpmgraph.1.scd)
14-
* [rpmkeys (8)](rpmkeys.8.scd)
15-
* [rpmlua (1)](rpmlua.1.scd)
16-
* [rpmsign (1)](rpmsign.1.scd)
17-
* [rpmsort (1)](rpmsort.1.scd)
18-
* [rpmspec (1)](rpmspec.1.scd)
19-
* [rpm2archive (1)](rpm2archive.1.scd)
20-
* [rpm2cpio (1)](rpm2cpio.1.scd)
21-
* [gendiff (1)](gendiff.1.scd)
2212

23-
## RPM Plugins
24-
* [rpm-plugins (8)](rpm-plugins.8.scd)
25-
* [rpm-plugin-audit (8)](rpm-plugin-audit.8.scd)
26-
* [rpm-plugin-dbus-announce (8)](rpm-dbus-announce.8.scd)
27-
* [rpm-plugin-fapolicyd (8)](rpm-plugin-fapolicyd.8.scd)
28-
* [rpm-plugin-ima (8)](rpm-plugin-ima.8.scd)
29-
* [rpm-plugin-prioreset (8)](rpm-plugin-prioreset.8.scd)
30-
* [rpm-plugin-selinux (8)](rpm-plugin-selinux.8.scd)
31-
* [rpm-plugin-syslog (8)](rpm-plugin-syslog.8.scd)
32-
* [rpm-plugin-systemd-inhibit (8)](rpm-plugin-systemd-inhibit.8.scd)
33-
* [rpm-plugin-unshare (8)](rpm-plugin-unshare.8.scd)
13+
{% for page in tools -%}
14+
- [{{ page.name }}]({{ page.filename }})
15+
{% endfor %}
16+
17+
## Plugins
18+
19+
{% for page in plugins -%}
20+
- [{{ page.name }}]({{ page.filename }})
21+
{% endfor %}

docs/man/mkpage.in

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
#
3+
# Create a Jekyll-compatible HTML page from the given scdoc(5) file
4+
# Usage: ./mkpage <input.scd> <output.html>
5+
6+
SCD_FILE=$1
7+
OUT_FILE=$2
8+
SCD_BASE=$(basename $SCD_FILE)
9+
NAME=$(echo "$SCD_BASE" | sed 's/^\(.\+\)\.\(.\+\)\.html$/\1(\2)/')
10+
11+
category() {
12+
case $1 in
13+
rpm-plugin*) echo plugin ;;
14+
*) echo tool ;;
15+
esac
16+
}
17+
18+
PREAMBLE="\
19+
---
20+
layout: default
21+
title: rpm.org - $NAME
22+
filename: $SCD_BASE
23+
category: $(category $NAME)
24+
name: $NAME
25+
---
26+
27+
<style type="text/css">
28+
h2 a, h3 a {
29+
font-size: 16px;
30+
vertical-align: text-top;
31+
}
32+
</style>
33+
"
34+
35+
@SCD2HTML@ -f < $SCD_FILE | cat <(echo "$PREAMBLE") - > $OUT_FILE
36+
# Convert man page references to links
37+
sed -i 's|<b>\(rpm[^<]*\)</b>(\(.\))|<a href="\1.\2.html">\1(\2)</a>|g' $OUT_FILE

0 commit comments

Comments
 (0)