]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use html2wiki to generate mediawiki pages from generated html pages.
authorAndres Mejia <amejia004@gmail.com>
Wed, 1 Feb 2012 19:29:19 +0000 (14:29 -0500)
committerAndres Mejia <amejia004@gmail.com>
Wed, 1 Feb 2012 19:29:19 +0000 (14:29 -0500)
Set use of html2wiki as optional.

SVN-Revision: 4219

doc/update.sh

index df000373a93eee7e53d49b9c548f558bee8a60fe..d2100bd6c9c5d2ab08a4997332e52ec22155b2bc 100755 (executable)
@@ -5,6 +5,32 @@
 # 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
@@ -98,8 +124,14 @@ all="all:"
 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
@@ -113,5 +145,5 @@ cd ..
 (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)