On 14 Nov 2001, Russ Allbery wrote:
> Tim Jenness <[EMAIL PROTECTED]> writes:
>
> > Russ, Why don't you use Pod::ParseUtils that is already in the core and
> > does exactly what you want (although it will need updating to match any
> > changes to L<>). I think that releasing a new link parser is sure to
> > confuse people (and we don't really want two link parsers in the core
> > distribution).
>
> Because it's *way* too complicated for what I'm doing and assumes a
> different parsing model than I'm using. The module I just wrote
> implements only and exactly the parse described in perlpodspec.
Are we looking at the same module?
>
> This is the problem with a lot of the different parse utility modules that
> I've seen. They all seem to assume that one wants to use a tree-based
> parsing model where the entire document is read in before any output is
> produced, or that one wants to use an object/accessor mechanism. I really
> don't want to do either; I just want to pass link text into a function and
> get back its four components and its type.
>
Pod::LaTeX is callback driven from Pod::Parser and uses Pod::Hyperlink for
the link parsing. In fact, my callback code to handle link parsing is:
sub interior_sequence {
...snip...
} elsif ($seq_command eq 'L') {
my $link = new Pod::Hyperlink($seq_argument);
# undef on failure
unless (defined $link) {
carp $@;
return;
}
# Handle internal links differently
my $type = $link->type;
my $page = $link->page;
if ($type eq 'section' && $page eq '') {
# Use internal latex reference
my $node = $link->node;
# Convert to a label
$node = $self->_create_label($node);
return "\\S\\ref{$node}";
} else {
# Use default markup for external references
# (although Starlink would use \xlabel)
my $markup = $link->markup;
my ($file, $line) = $pod_seq->file_line();
return $self->interpolate($link->markup, $line);
}
} elsif ($seq_command eq 'P') {
# Special markup for Pod::Hyperlink
# Replace :: with /
my $link = $seq_argument;
$link =~ s/::/\//g;
my $ref = "\\emph{$seq_argument}";
return $ref;
} elsif ($seq_command eq 'Q') {
# Special markup for Pod::Hyperlink
return "\\textsf{$seq_argument}\n";
...snip...
No tree-based parsing involved at all. Is invoking the markup() method in
a link object all that onerous?
> Pod::ParseUtils's Pod::Hyperlink class could easily be implemented
> internally by using Pod::ParseLink, and that would have a lot of
> advantages for uniformity of parsing.
Don't understand at all. Simply using Pod::Hyperlink gives you uniformity
of parsing. No need for Pod::ParseLink at all.
Sorry if I am being dense again.
--
Tim Jenness
JAC software
http://www.jach.hawaii.edu/~timj