Parse::Man::DOM(3pm)
β¨ NAME β¨
okay so bestie, meet Parse::Man::DOM β it parses nroff-formatted manpages and hands you back a whole DOM tree π
this is the Parse::Man::DOM(3pm) page, and yes she is that girl.
πΈ SYNOPSIS πΈ
use Parse::Man::DOM;
my $parser = Parse::Man::DOM->new;
my $document = $parser->from_file( "my_manpage.1" );
print "The manpage name is", $document->meta( "name" ), "\n";
π DESCRIPTION π
So this is a subclass of Parse::Man, and what it does is give you back an object tree that represents the parsed content of the input file. The result you get is an object of the Parse::Man::DOM::Document class, and that baby has other objects nested all up inside it. it's giving nesting dolls but make it manpages πͺβ¨
π Parse::Man::DOM::Document
This one represents the document as a whole. main character energy fr.
meta
$meta = $document->meta( $key )
Returns a Parse::Man::DOM::Metadata object for the named item of metadata. the keys you can ask for:
nameβ the page name given to the.THdirective.sectionβ the section number given to the.THdirective.
paras
@paras = $document->paras
Returns a list of Parse::Man::DOM::Heading or Parse::Man::DOM::Para or subclass objects, containing the actual page content. the real content, the whole vibe π
π¦ Parse::Man::DOM::Metadata
Represents a single item of metadata about the page. one lil factoid, no cap.
name
$name = $metadata->name
The string name of the metadata
value
$value = $metadata->value
The string value of the metadata
π Parse::Man::DOM::Heading
Represents the contents of a .SH or .SS heading.
level
$level = $heading->level
The heading level number; 1 for .SH, 2 for .SS
text
$text = $heading->text
The plain text string of the heading title
π Parse::Man::DOM::Para
Represents a paragraph of formatted text content. Will be one of the following subclasses. (so like, it's the mom of the para squad π)
filling
$filling = $para->filling
Returns true if filling (.fi) is in effect, or false if no-filling (.nf) is in effect.
body
$chunklist = $para->body
Returns a Parse::Man::DOM::Chunklist to represent the actual content of the paragraph.
indent
$indent = $para->indent
Returns the indentation size in column count, if defined.
π«Ά Parse::Man::DOM::Para::Plain
Represent a plain (.P or .PP) paragraph.
type
$type = $para->type
Returns "plain".
π Parse::Man::DOM::Para::Term
Represents a term paragraph (.TP).
type
$type = $para->type
Returns "term".
term
$chunklist = $para->term
Returns a Parse::Man::DOM::Chunklist for the defined term name.
definition
$chunklist = $para->definition
Returns a Parse::Man::DOM::Chunklist for the defined term definition.
π§ Parse::Man::DOM::Para::Indent
Represents an indented paragraph (.IP).
type
$type = $para->type
Returns "indent".
marker
$marker = $para->marker
Returns the indentation marker text, if defined.
π Parse::Man::DOM::Para::Example
Represents an example paragraph (.EX / .EE).
type
$type = $para->type
Returns "example".
π« Parse::Man::DOM::Chunklist
Contains a list of Parse::Man::DOM::Chunk objects to represent paragraph content. a lil squad of chunks, obsessed.
chunks
@chunks = $chunklist->chunks
Returns a list of Parse::Man::DOM::Chunk objects.
π Parse::Man::DOM::Chunk
Represents a chunk of text with a particular format applied. slay, formatting.
text
$text = $chunk->text
The plain string value of the text for this chunk.
font
$font = $chunk->font
The font name in effect for this chunk. One of "R", "B", "I" or "SM".
size
$size = $chunk->size
The size of this chunk, relative to the paragraph base of 0.
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk>
okay bestie that's the whole page, no notes π this was perl v5.36.0, dated 2023-10-24, and it lives at Parse::Man::DOM(3pm) β go read some manpages and parse them, periodt π¦β¨
π¦ where this page comes from
- debian trixie: libparse-man-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libparse-man-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libparse-man-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libparse-man-perl 0.03-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms