# the mdoc man pages stored in each project.
#
+USAGE="\n\
+Simple script to repopulate the 'doc' tree from\n\
+the mdoc man pages stored in each project.\n\
+\n\
+ -h, --help Display this help message\n\
+ --mediawiki Use mediawiki markup for wiki pages.\n"
+
+# Loop that parses options passed to script
+while [ "$#" -gt "0" ]; do
+ case "$1" in
+ --mediawiki)
+ if [ -x "$(which html2wiki)" >/dev/null 2>&1 ]; then
+ USE_MEDIAWIKI=1
+ else
+ echo "html2wiki program not found or is not executable."
+ exit 1
+ fi
+ shift
+ ;;
+ -h|--help|*)
+ echo -e "${USAGE}"
+ exit 1
+ ;;
+ esac
+done
+
# Collect list of man pages, relative to my subdirs
test -d man || mkdir man
cd man
for f in $MANPAGES; do
outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki"
echo >> Makefile
- echo $outname: ../mdoc2wiki.awk $f >> Makefile
- echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile
+ if [ -z "$USE_MEDIAWIKI" ]; then
+ echo $outname: ../mdoc2wiki.awk $f >> Makefile
+ echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile
+ else
+ inname="../html/$(basename $f).html"
+ echo $outname: $inname $f >> Makefile
+ echo " html2wiki --dialect MediaWiki --encoding utf-8 $inname > $outname" >> Makefile
+ fi
all="$all $outname"
done
echo $all >>Makefile
(cd pdf && make)
# Format all of the manpages to HTML
(cd html && make)
-# Format all of the manpages to Google Wiki syntax
+# Format all of the manpages to wiki syntax
(cd wiki && make)