That's looks correct for me.
They are there for two diferente ends:
case 1: name/ident
In this situation is expected L<page/itemname> where page can be empty (which is the case)
case 2: name/"section name"
In this case it is expected a sectionname, quoted. for some reason (because if there isn't a item with a given name Pod::Html will look for a section with the same name, the author (in his own comments) even though this should be a "section", we go for ident first. It works, as well as using a section name without quotes, that would in the previous case, and is treated as a ident, and then as a section if there is no ident with such name.
case 3: something that have a space
In this case Pod::Html assumes that we are looking for a section, as pages don't have whitespaces in names.
case 4: everything else
A link to anything that don't have spaces, nor a slash is a link to a page.
I think that is missing a case, that could be managed before case 3 with:
} elsif ($par=~m{"(.*)"}) {
($page,$section)=('',$1); #In this case, it looks to me
# that the pod author forgot the initial / but is
# trying to link to a section in corrent page
# (quoted name).
I'm also not seeing why the quotes in the second case are optional. Without garantees, my final patch would look like this:
--- Html.pm 2005-07-01 14:48:23.000000000 +0100
+++ Html.pm.new 2005-07-01 23:07:35.000000000 +0100
@@ -1549,15 +1549,20 @@
my( $page, $section, $ident );
# check for link patterns
- if( $par =~ m{^([^/]+?)/(?!")(.*?)$} ){ # name/ident
+ if( $par =~ m{^([^/]+)?/(?!")(.*?)$} ){ # name/ident
# we've got a name/ident (no quotes)
( $page, $ident ) = ( $1, $2 );
### print STDERR "--> L<$par> to page $page, ident $ident
+\n";
- } elsif( $par =~ m{^(.*?)/"?(.*?)"?$} ){ # [name]/"section"
- # even though this should be a "section", we go for ident
+ first
- ( $page, $ident ) = ( $1, $2 );
+ } elsif( $par =~ m{^(.*)?/"(.*?)"$} ){ # [name]/"section"
+ # we've got a name/"section"
+ ( $page, $section ) = ( $1, $2 );
### print STDERR "--> L<$par> to page $page, section $sec
+tion\n";
+
+ } elsif ( $par =~ m{^"(.*?)"$} ){ # "section"
+ # we've got a section without a pagename
+ ( $page, $section ) = ('',$1);
+ ### print STDERR "--> L<$par> to void page, section $sect
+ion\n";
} elsif( $par =~ /\s/ ){ # this must be a section with missin
+g quotes
( $page, $section ) = ( '', $par );
But, maybe I'm missing something that Tom Christiansen found. I don't know.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.