Difference between revisions of "HowTos/Convert Man Pages"

From Scalix Wiki
Jump to: navigation, search
m (Changed the line starting with "detail=..." to get correct command summary)
(added title and link to top of page.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
[[Scalix Wiki]] -> [[How-Tos]] -> '''Convert Scalix Man Pages to pdf and html'''
 +
 +
 
This script will get the man pages into html and a pdf document.
 
This script will get the man pages into html and a pdf document.
  
Line 32: Line 35:
 
</pre>
 
</pre>
  
htmldoc can be downloaded from here for REDHAT el4:  
+
htmldoc can be downloaded from here for redhat: http://rpm.pbone.net/
http://rpm.pbone.net/index.php3/stat/4/idpl/1912569/com/htmldoc-nogui-1.8.24-1.RHEL4WS.i386.rpm.html
+
 
for some reason the 'sources' from htmldoc.org are not sources at all.
+
"A collection of converted man pages to html. Also a PDF version. From server version: 11.0.3.31"
 +
http://dl.dropbox.com/u/7856668/scalix/scalix_man_pages.zip

Latest revision as of 14:00, 30 June 2010

Scalix Wiki -> How-Tos -> Convert Scalix Man Pages to pdf and html


This script will get the man pages into html and a pdf document.

#!/bin/sh 

# scalix man page convertion. 
sourcedir="/opt/scalix/share/man/" 
exportpath="/path_to/Scalix_man_pages/" 
exportdir="html" 
rm -f $exportpath$exportdir/index.html 
touch $exportpath$exportdir/index.html 
echo "<html><title>Scalix Man pages</title><body><table>" >> $exportpath$exportdir/index.html 

cd $sourcedir 
for MANFOLDERS in `ls -1` 
do 
   cd $sourcedir$MANFOLDERS 
   for MANPAGES in `ls -1` 
   do 
      filename=`echo "${MANPAGES}" | sed "s/.gz*$//" | sed "s/\..$//"` 
      detail=`gunzip -dc $MANPAGES |grep -A1 NAME|cut -d$'\n' -f2`
      filename2=`echo "${MANPAGES}" | sed "s/.gz*$//"` 
      hyperlink="<tr><td valign=top><a href='$filename2.html'>$filename</a></td><td>$detail <br></td></tr>" 
      echo $hyperlink >> $exportpath$exportdir/index.html 
      gzip -dc $sourcedir/$MANFOLDERS/$MANPAGES | man2html -r | sed -e "s/man./$exportdir/g" |  sed -e "s@index.html@$exportdir/index.html@g" | sed -n -e :a -e '1,6!{P;N;D;};N;ba' > $exportpath$exportdir/$filename2.html 2>&1
      echo "</body></html>">>$exportpath$exportdir/$filename2.html 
      echo $MANPAGES " - " $filename " - converted" 
   done 
done 
echo "</table></body></html>" >> $exportpath$exportdir/index.html 
htmldoc --continuous -f $exportpath$exportdir/Scalix_Man_Pages.pdf $exportpath$exportdir/*.html 

htmldoc can be downloaded from here for redhat: http://rpm.pbone.net/

"A collection of converted man pages to html. Also a PDF version. From server version: 11.0.3.31" http://dl.dropbox.com/u/7856668/scalix/scalix_man_pages.zip