Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Jan 2013 03:51:09 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Fbsd8 <fbsd8@a1poweruser.com>
Cc:        FreeBSD questions <questions@freebsd.org>
Subject:   Re: manpage -> html
Message-ID:  <20130113035109.28f69d05.freebsd@edvax.de>
In-Reply-To: <50F219D2.2040906@a1poweruser.com>
References:  <50F1FECA.4090801@a1poweruser.com> <CAOgwaMt32eHSqi3tEHr5Mkc=0TkSYuU1%2BGw7BSDVJiUB_kKVUg@mail.gmail.com> <50F20536.3020009@a1poweruser.com> <20130113021454.e1128036.freebsd@edvax.de> <50F2150C.20209@a1poweruser.com> <50F219D2.2040906@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 12 Jan 2013 21:20:02 -0500, Fbsd8 wrote:
> Fbsd8 wrote:
> > Polytropon wrote:
> >> On Sat, 12 Jan 2013 19:52:06 -0500, Fbsd8 wrote:
> >>> OK let me be more specific.
> >>> Using just commands that are in the base system.
> >>> IE; come with the 9.1 system
> >>
> >> Very well:
> >>
> >> zcat `man -w ls` | groff -Thtml -dpaper=a4 -P-pa4 > ls.html
> >>
> >> zcat `man -w ls` | groff -Thtml > ls.html
> >>
> >> However, the output looks a bit strange here (tested with lynx
> >> and Opera), so maybe some additional options are required. I've
> >> just derived this from my man2pdf script and read "man groff"
> >> for the -T parameter.
> >>
> >>
> > 
> >       zcat `man -w ls` | groff -T html > ls.html
> > 
> > That kind of worked. It did create html code but it dropped all the 
> > indentations and blank lines. .Pp commands in the man page source.
> > 
> > 
>             zcat `man -w ls` | groff -mdoc -T html > ls.html
> 
> The -mdoc is the FBSD style and it worked.
> Got indentations for all sections plus the high-intensity stuff
> converted to bold. The blank lines also can out.

An all this confusion simply because I wanted to trim the
command nicely and left out some stuff from my man2pdf script.
Here it is for reference (in case you need to create PS or
PDF output from manpages):



#!/bin/sh

if [  $# = 0 ]; then
	echo "usage: man2pdf.sh <topic>"
	exit 1
fi

if [ -f $1.pdf ]; then
	echo "output file $1.pdf already exists, aborting."
	exit 1
fi

zcat `man -w $@` | groff -Tps -dpaper=a4 -P-pa4 -mandoc | ps2pdf $1.pdf 

exit 0



And as you can see: the -mandoc option is in there, the big
difference being -Tps instead of -Thtml (as listed in "man groff"
regarding the -T option).

Note that this script requires ps2pdf as external package.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130113035109.28f69d05.freebsd>