Parse::Man - parse nroff-formatted manpages
Parse::Man
This abstract subclass of Parser::MGC recognises nroff grammar from a file or string value. It invokes methods when various nroff directives are encountered. It is intended that this class be used as a base class, with methods provided to handle the various directives and formatting options. Typically a subclass will store intermediate results in a data structure, building it as directed by these method invocations.
The following method is used to handle formatted text. Each call is passed a plain string value from the input content.
$parser->chunk( $text, %opts )
The %opts hash contains the following options:
%opts
The name of the current font (R, B, etc..)
R
B
The current text size, relative to a paragraph base of 0.
Other font requests that are found in \fX or \f(AB requests are handled by similarly-named methods.
\fX
\f(AB
The following methods are used to form paragraphs out of formatted text chunks. Their return values are ignored.
$parser->para_TH( $name, $section )
Handles the .TH paragraph which gives the page title and section number.
.TH
$parser->para_SH( $title )
Handles the .SH paragraph, which gives a section header.
.SH
$parser->para_SS( $title )
Handles the .SS paragraph, which gives a sub-section header.
.SS
$parser->para_TP( $opts )
Handles a .TP paragraph, which gives a term definition.
.TP
$parser->para_IP( $opts )
Handles a .IP paragraph, which is indented like the definition part of a .TP paragraph.
.IP
$parser->para_P( $opts )
Handles the .P, .PP or .LP paragraphs, which are all synonyms for a plain paragraph content.
.P
.PP
.LP
$parser->para_EX( $opts )
Handles the .EX paragraph, which is example text; intended to be rendered in a fixed-width font without filling.
.EX
Paul Evans <leonerd@leonerd.org.uk>
To install Parse::Man, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::Man
CPAN shell
perl -MCPAN -e shell install Parse::Man
For more information on module installation, please visit the detailed CPAN module installation guide.