Steve Hay wrote: [...] > I've also changed it to use anchorify() rather than htmlify(). This is > because the links written into the "index" page by pod2html() are > generated by anchorify(), so the names must match in order for the links > to work. (Otherwise, for example, the perlipc.html "index" page will > have a link to "see_also.html", whereas the filename chosen by htmlize() > would be "see also.html" so the link is broken.) > > I've also inserted some other substitutions into the name returned by > htmlize() after the call to anchorify() because the name returned is to > be used as a filename, hence must not contain any invalid filename > characters. For example, the perlipc manpage contains a "=head1" > section named "Sockets: Client/Server Communication" -- we must remove > the ":" and "/" characters before this can make a valid filename (on > Windows, at least). > > Are there any other characters that would be invalid in filenames on > other OS's? Is there a generic "filename-cleaning-up" routine anywhere? > (I couldn't see one in the File::Spec module.) Playing on the safe side, I'd remove every non-alphanumeric char from the anchor name (so there's only alphanum chars, and no more than one dot). (Even a legal and innocent-looking filename, like '-rf', may cause problems.) > This solution is not perfect since the links in the "index" page do not > have the additional substitutions applied to them. Thus, in the above > example, the link would be > "perlipc/sockets:_client/server_communication.html" (only anchorified), > whereas the file would be > "perlipc/sockets__client_server_communication.html" (anchorified and So you have broken links in perlipc.html and in some of the perlipc/*.html files. > filenameified). Perhaps the additional substitutions should be applied > within anchorify() itself? However, that seems to be going beyond what > that function sounds like it is going to do? Yes, I'm inclined to apply something like the patch below along your patch. Thoughts ? Index: lib/Pod/Html.pm =================================================================== --- lib/Pod/Html.pm (revision 1050) +++ lib/Pod/Html.pm (working copy) @@ -1965,12 +1965,12 @@ } # -# similar to htmlify, but turns spaces into underscores +# similar to htmlify, but turns non-alphanumerics into underscores # sub anchorify { my ($anchor) = @_; $anchor = htmlify($anchor); - $anchor =~ s/\s/_/g; # fixup spaces left by htmlify + $anchor =~ s/\W/_/g; return $anchor; } End of Patch. -- Unresponsive is not *NIXThread Previous | Thread Next