Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create HTML versions of UNIX apps' man pages UNIX
I view the man pages for GMT (Generic Mapping Tools) a lot, both on my local machine and the web. I find the online HTML version easier to read, but sometimes my PowerBook is not connected to the web and I need to consult the man page. Here is a quick script that will make the man pages available as local HTML files for access from the Dock. While I provide an example for GMT, it could be used to make a folder for any man page.

Requires: rman (or similar program) and in this case GMT. Both are available via fink.
  1. Make a folder (herein entitled "GMT_man").

  2. In that folder (cd /path/to/GMT_man) in the Terminal.app, type:
     % /bin/ls /sw/share/man/manl/ > list1
     % /bin/ls /sw/share/man/manl/ | sed 's/\.\l//g' > list2
     % paste list1 list2 > list2
     % awk '{print "rman -f html /sw/share/man/manl/"$1,">", $2}' \
       list2 > htmlit.csh
     % chmod u+rwx htmlit.csh 
  3. Lastly, execute the shell script:
     % ./htmlit.csh 
I then removed all of the lists and script and dragged the folder "GMT_man" to the Dock. Now when I want to view a man page of a GMT command, I just single-click the folder and pick from all of the commands. That then opens the HTML file in my default browser for viewing.
    •    
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[3,917 views]  

Create HTML versions of UNIX apps' man pages | 2 comments | Create New Account
Click here to return to the 'Create HTML versions of UNIX apps' man pages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create HTML versions of UNIX apps' man pages
Authored by: wgscott on Jun 23, '03 11:26:13AM

I've been using this if anyone is interested:

man2html

http://www.oac.uci.edu/indiv/ehood/man2html.html



[ Reply to This | # ]
If you're a TeX fiend...
Authored by: timkingman on Jun 23, '03 12:57:02PM
If you have groff (should be standard) and a TeX viewer, you should be able to use this bash function:
function mantex
{
  if [ ! -d /tmp/mantex ]
  then
    mkdir /tmp/mantex
  fi
  if [ -e /tmp/mantex/$1.dvi ]
  then
    open /tmp/mantex/$1.dvi
  else
    groff -m man -Tdvi `man -w $1` > /tmp/mantex/$1.dvi && open /tmp/mantex/$1.dvi
  fi
}

This function will save a copy of the generated TeX DVI file in /tmp/mantex, you may want to change that if you have very limited HD space. Also, there are some flaws with the version of groff that comes with OS X. Some of the generated output will be improperly-formatted. Recompiling the same version of groff may fix it, I'm not sure about newer versions.

If you don't use bash or like doing things the hard way, just run the line starting with groff, replacing $1 with the command you want to look up.

A TeX-crazy friend suggested this, and I used it for a few days before I grew tired of it. I've gone back to plain-old boring man pages.

[ Reply to This | # ]