2014-04-16 14:07:55 -04:00
|
|
|
#!/bin/bash
|
2014-04-16 16:15:57 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# get into this script's directory
|
|
|
|
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
|
|
|
|
|
|
|
|
[ "$1" = '-q' ] || {
|
|
|
|
set -x
|
|
|
|
pwd
|
|
|
|
}
|
|
|
|
|
2014-04-22 08:43:08 -04:00
|
|
|
for FILE in *.md; do
|
|
|
|
base="$(basename "$FILE")"
|
|
|
|
name="${base%.md}"
|
|
|
|
num="${name##*.}"
|
2014-06-14 03:44:55 -04:00
|
|
|
if [ -z "$num" -o "$name" = "$num" ]; then
|
2014-04-22 08:43:08 -04:00
|
|
|
# skip files that aren't of the format xxxx.N.md (like README.md)
|
|
|
|
continue
|
|
|
|
fi
|
2014-06-25 12:04:59 -04:00
|
|
|
mkdir -p "./man${num}"
|
|
|
|
pandoc -s -t man "$FILE" -o "./man${num}/${name}"
|
2014-04-16 16:15:57 -04:00
|
|
|
done
|