Skip to content

Commit 689fb87

Browse files
committed
res/build.sh: use lowdown instead of pandoc for mandoc output.
Given that pandoc is a haskell program, depending on it is bad due to bootstrap and general platform compatibility concerns. Lowdown output looks just as good if not better. The ideal build will have the git repository available to it; builds without the git repo will use SOURCE_DATE_EPOCH from the environment.
1 parent 65fe7f5 commit 689fb87

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Void packages:
1313

1414
- `mdBook`
1515
- `findutils`
16-
- `pandoc`
16+
- `lowdown` (version 0.8.1 or greater)
1717
- `texlive`
1818
- `perl`
1919
- `perl-JSON`

res/build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,33 @@
66
set -e
77
PATH="$PWD/res:$PATH"
88

9+
if [ -z "$SOURCE_DATE_EPOCH" ]; then
10+
export SOURCE_DATE_EPOCH=$(git log --pretty='%ct' -1)
11+
if [ -z "$SOURCE_DATE_EPOCH" -a "$BUILD_MANPAGES" = 1 ]; then
12+
echo "git or SOURCE_DATE_EPOCH are needed to build man pages!"
13+
exit 1
14+
fi
15+
fi
16+
917
# Build HTML mdbook
1018
echo "Building mdBook"
1119
mdbook build
1220

13-
1421
if [ "$BUILD_MANPAGES" = "1" ]; then
1522
# Build mandoc version
1623
echo "Building man pages"
17-
mkdir -p mandoc
1824
cd src
1925

2026
find . -type d -exec mkdir -p "../mandoc/{}" \;
27+
2128
find . -type f -name "*.md" -exec sh -c \
22-
'file="{}"; filew="${file%.md}"; pandoc -V "title=${filew##*/}" -V section=7 -V "header=Void Docs" -s -o "../mandoc/${filew}.7" "$file"' \;
29+
'file="{}"; filew="${file%.md}"; \
30+
man_date="$(git log --pretty=%cs -1 "$file" 2>/dev/null || date -d "@$SOURCE_DATE_EPOCH" +%F)";
31+
lowdown -Tman \
32+
${man_date:+-m "date: $man_date"} \
33+
-m "title: ${filew##*/}" \
34+
-m "section: 7" -m "source: Void Docs" -m "volume: Void Docs" \
35+
-s -o "../mandoc/${filew}.7" "$file"' \;
2336

2437
cd -
2538
fi

0 commit comments

Comments
 (0)