develooper Front page | perl.perl5.porters | Postings from March 2012

[perl #112140] Pod::HTML should use a proper Unicode-aware definition of "word character"

Thread Next
From:
Nicholas Clark
Date:
March 30, 2012 08:54
Subject:
[perl #112140] Pod::HTML should use a proper Unicode-aware definition of "word character"
Message ID:
rt-3.6.HEAD-4610-1333122881-159.112140-75-0@perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #112140]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=112140 >


Pod::Html has this:

    use locale; # make \w work right in non-ASCII lands


It was added in 1998 by this commit:

commit 3ec0728814aeaba716081748626d6940892a1796
Author: Fyodor Krasnov <fyodor@aha.ru>
Date:   Tue Nov 24 22:00:36 1998 +0300

    Pod::Html and Pod::Text were not locale-savvy:
    for example in =head1 all non-ASCII-\w-runs were
    turned into underscores in NAME tags.  This could
    result in several NAME tags becoming identical.
    Reported by:
    Subject: pod2html vs Russian Characters
    To: Tom.Christiansen@snn.aha.ru, tchrist@perl.com
    Message-Id: <199811241600.TAA05149@stat.aha.ru>
    
    p4raw-id: //depot/cfgperl@2435


The code referenced is this:

#
# similar to htmlify, but turns non-alphanumerics into underscores
#
sub anchorify {
    my ($anchor) = @_;
    $anchor = htmlify($anchor);
    $anchor =~ s/\W/_/g;
    return $anchor;
}


At first glance it would seem better to replace that \W with a POSIX character
class or Unicode property that reliably expresses the intent.

However, with the refactor to use Pod::Simple::XHTML &anchorify is no longer
used by any code within Pod::Html, and the only external user on CPAN* seems
to be installhtml. Hence it's not clear if a better plan is to deprecate the
function. (And similarly htmlify, as it's unused)

Nicholas Clark

* There are several copies and derivatives of Pod::HTML on CPAN - I couldn't
  spot anything using Pod::HTML::anchorify


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About