Tim Jenness <[EMAIL PROTECTED]> writes:
> No tree-based parsing involved at all. Is invoking the markup() method
> in a link object all that onerous?
No, this is the main part that I don't want to do:
> } 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";
There's no reason for what I'm doing that I need to add two new formatting
codes. I will eventually need to re-call interpolate, but this is just too
complicated for what I'm doing. Here's the code in Pod::Text that calls
Pod::ParseLink:
sub seq_l {
my ($self, $link) = @_;
return (parselink ($link))[1] || '';
}
That's it. No other interior sequences. No temporary objects. All I
need is the second item of the link parse as defined in perlpodspec, the
inferred or explicitly set markup text, and I don't want to have to do
anything else to get it.
I also don't want to create objects, use accessor functions, or otherwise
do a bunch of unnecessary OO programming. It's overkill.
Eventually, I'm going to have to do deferred interpolation on the contents
of L<> tags, which is very annoying, but even that once I figure out the
best way to do it will only add one line to that interface, namely another
call to interpolate.
> Don't understand at all. Simply using Pod::Hyperlink gives you
> uniformity of parsing. No need for Pod::ParseLink at all.
Pod::ParseLink only parses the L<> text. It doesn't create objects, it
doesn't provide accessor functions, it doesn't provide places to stash
more information about the link, and it doesn't return new interior
sequences. Somewhere, Pod::Hyperlink actually parses the text; that
parser can be replaced with Pod::ParseLink as a good way of upgrading its
understanding of L<> conventions to perlpodspec. It can then continue to
do all the other things that it does for formatters that need them (and I
totally understand why it does all that; don't get me wrong, I don't want
Pod::Hyperlink to be anything other than it is), and formatters that
don't implement hyperlinks can use the simpler interface.
--
Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/>