Hi,
I thought that was weird, and was digging a bit in the Pod::HTML module, and I think there is a small bug in process_text1, that can be corrected with this small patch:
--- Html.pm 2005-07-01 14:48:23.000000000 +0100
+++ Html.pm.new 2005-07-01 14:48:52.000000000 +0100
@@ -1549,7 +1549,7 @@
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";
This is based in the version I have installed:
$VERSION = 1.0503;
| [reply] [d/l] [select] |
| [reply] |
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. | [reply] [d/l] [select] |
In the particular example above, 'bar' doesn't resolve, which might explain why no link is generated. Have you tried it for valid references too?
| [reply] |
I misspoke; there are obviously links created, but not correct ones. pod2html knows to turn C<bar> into a link to #item_bar, but I want to get it to make a link to #item_bar using L<> as well. Obviously I could just put item_bar as the section to link to, but I'd be worried that a future change to pod2html would break that. I shouldn't have to know the implementation detail that it prepends =item sections with item_.
| [reply] [d/l] [select] |