diff options
author | Wayne Davison <wayne@opencoder.net> | 2020-06-08 19:21:42 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2020-06-08 21:03:42 -0700 |
commit | 53fae556521d035544ed8f0e968451ce6c60e664 (patch) | |
tree | f5ee1bed4e65dbcf6798174583bd4779a9215f3f /maybe-make-man | |
parent | bd66a92e7c21c70fa95b71a395438d853a9ab0b5 (diff) | |
download | rsync-53fae556521d035544ed8f0e968451ce6c60e664.tar.gz |
Change man page src format from yodl to markdown.
This removes the yodl dependency, which is sometimes hard to track down.
Instead, this uses a python3 script that leverages the cmarkgfm library
to turn the source file into html. Then, the script parses the html in
order to turn the tag stream into a nroff stream using a simple state
machine. While it's doing that it also implements one added format rule
that turns an ordinal list that starts at 0 into a description list
(since markdown doesn't have an easy description list idiom).
Diffstat (limited to 'maybe-make-man')
-rwxr-xr-x | maybe-make-man | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/maybe-make-man b/maybe-make-man new file mode 100755 index 00000000..334c3934 --- /dev/null +++ b/maybe-make-man @@ -0,0 +1,37 @@ +#!/bin/sh + +if [ x"$2" = x ]; then + echo "Usage: $0 SRC_DIR NAME.NUM.md" 1>&2 + exit 1 +fi + +srcdir="$1" +inname="$2" + +if [ ! -d "$srcdir" ]; then + echo "The specified SRC_DIR is not a directory: $srcdir" 1>&2 + exit 1 +fi + +if [ ! x"$RSYNC_ALWAYS_BUILD" ]; then + # We test our smallest manpage just to see if the python setup works. + if ! "$srcdir/md2man" --test "$srcdir/rsync-ssl.1.md" >/dev/null 2>&1; then + outname=`echo "$inname" | sed 's/\.md$//'` + if [ -f "$outname" ]; then + exit 0 + elif [ -f "$srcdir/$outname" ]; then + echo "Copying $srcdir/$outname" + cp -p "$srcdir/$outname" . + exit 0 + else + echo "ERROR: $outname cannot be created." + if [ -f "$HOME/build_farm/build_test.fns" ]; then + exit 0 # No exit errorno to avoid a build failure in the samba build farm + else + exit 1 + fi + fi + fi +fi + +"$srcdir/md2man" "$srcdir/$inname" |