Converting man pages to HTML files with man2html

When I want to convert man pages to HTML files, I usually employ the groff utility. E.g., I can locate the modifyrepo man page with the find command and then cut and paste the location of the man page file after the cat command or use command substitution to take the output from the find command as input to the cat command. I then pipe the output into the groff command.

$ find /usr/share/man -name modifyrepo\*
/usr/share/man/man1/modifyrepo.1
$ cat $(find /usr/share/man -name modifyrepo\*) | groff -mandoc -Thtml >modifyrepo.html
$

If the man page is in gzip format, i.e., a .gz file, I'll use gunzip to extract the contents and then pipe the output from the gunzip command to the groff command. E.g., if I use the find command to locate the man page for the gcc command, I see it is a .gz file.

$ find /usr/share/man -name gcc\*
/usr/share/man/man1/gcc.1.gz
$

I can then cut and paste the man page file location at the end of a gunzip command or use command substitution to take the output from that command as input to the gunzip command.

$ gunzip --to-stdout `find /usr/share/man -name gcc\*` | groff -mandoc -Thtml >gcc.html
stdin:1036: warning [p 9, 8.7i]: cannot adjust line
$

However, when I piped the output of the ethtool .gz file from gunzip into groff, I saw the following output:

Udemy Generic Category (English)120x600
$ gunzip --to-stdout $(find /usr/share/man -name ethtool\*) | groff -mandoc -Tht
ml > ethtool.html
stdin:563: suppression limit registers span more than one page;
image description 1 will be wrong
stdin:671: suppression limit registers span more than one page;
image description 5 will be wrong
Calling `psselect -q -p5 /tmp/groff-ps-a6wx9T /tmp/groff-ps-SRUoFv
' returned status 32512
Calling `pnmcut 200 102 551 906 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmt
opng -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236071.png
' returned status 32512
Calling `pnmcut 200 312 551 69 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmto
png -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236072.png
' returned status 32512
Calling `pnmcut 200 516 551 116 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmt
opng -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236073.png
' returned status 32512
Calling `pnmcut 200 742 551 69 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmto
png -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236074.png
' returned status 32512
Calling `psselect -q -p6 /tmp/groff-ps-a6wx9T /tmp/groff-ps-SRUoFv
' returned status 32512
Calling `echo showpage | gs -q -dBATCH -dSAFER -dDEVICEHEIGHTPOINTS=792 -dDEVICE
WIDTHPOINTS=750 -dFIXEDMEDIA=true -sDEVICE=pnmraw -r100 -dTextAlphaBits=4 -dGrap
hicsAlphaBits=4  -sOutputFile=/tmp/groff-page-JXwsUH /tmp/groff-ps-SRUoFv -
' returned status 256
Calling `pnmcut 200 102 551 903 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmt
opng -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236075.png
' returned status 32512
Calling `pnmcut 200 166 551 35 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmto
png -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236076.png
' returned status 32512
Calling `psselect -q -p7 /tmp/groff-ps-a6wx9T /tmp/groff-ps-SRUoFv
' returned status 32512
Calling `echo showpage | gs -q -dBATCH -dSAFER -dDEVICEHEIGHTPOINTS=792 -dDEVICE
WIDTHPOINTS=743 -dFIXEDMEDIA=true -sDEVICE=pnmraw -r100 -dTextAlphaBits=4 -dGrap
hicsAlphaBits=4  -sOutputFile=/tmp/groff-page-JXwsUH /tmp/groff-ps-SRUoFv -
' returned status 256
Calling `pnmcut 203 199 541 19 < /tmp/groff-page-JXwsUH | pnmcrop -quiet | pnmto
png -background rgb:f/f/f -transparent rgb:f/f/f > grohtml-236077.png
' returned status 32512
stdin:247: warning [p 1, 10.3i]: can't break line
stdin:654: warning [p 1, 58.7i, div `an-div', 0.0i]: cannot adjust line
pre-grohtml: cannot unlink `/tmp/groff-page-JXwsUH': No such file or directory
pre-grohtml: cannot unlink `/tmp/groff-ps-SRUoFv': No such file or directory
$

A lot of grohtml Portable Network Graphics (PNG) files, e.g., grohtml-236071.png, grohtml-236072.png, etc. were placed in the directory where I ran the command. And when I looked at the ethtool.html output file, the HTML wasn't as clean as I would have liked making the webpage hard to read. So I looked for an alternative means of producing an HTML file from the man page. One tool that can be used is man2html. For the production of an HTML file from the man page for the ethtool command, I can issue the command below:

$ man2html /usr/share/man/man8/ethtool.8.gz >ethtool.html
$

As you can see, I only need specify the location of the man page file as an argument to the command and then specify where I want the output HTML file placed. An the resulting ethtool HTML file is much easier to read in this case.

Related articles:

  1. Converting a man page to HTML, PDF, text
    Created: February 8, 2016 Last modified: March 18, 2016
    MoonPoint Support
  2. groff can't find DESC file
    Created: April 11, 2016
    Last modified: April 12, 2016
    MoonPoint Support

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px