in reply to pod2html includes markup (like B< >) in TITLE

Which version of Perl is this? I seem to recall a fix for this in 5.8.0 or 5.8.1. I just tried with 5.8.2 and it converted the directive appropriately.

  • Comment on Re: pod2html includes markup (like B< >) in TITLE

Replies are listed 'Best First'.
Re: Re: pod2html includes markup (like B< >) in TITLE
by PodMaster (Abbot) on Jan 07, 2004 at 08:22 UTC
    Really? From what I see it only html-escapes the characters, which is a step in the right direction, but not a solution. The following patch ought to do it (even though depod ain't perfect)
    --- G:\perls\5.8.2\lib\pod\html.pm 2003-11-06 02:10:38.796875000 +-0800 +++ C:\perl\lib\pod\html.pm 2004-01-07 00:18:19.984375000 -0800 @@ -400,8 +400,10 @@ for (my $i = 0; $i < @poddata; $i++) { if ($poddata[$i] =~ /^=head1\s*NAME\b/m) { for my $para ( @poddata[$i, $i+1] ) { - last TITLE_SEARCH - if ($Title) = $para =~ /(\S+\s+-+.*\S)/s; + if( ($Title) = $para =~ /(\S+\s+-+.*\S)/s +){ + $Title = depod($Title);# PodMaster + last TITLE_SEARCH; + } } } @@ -411,7 +413,11 @@ if (!$Title and $Podfile =~ /\.pod\z/) { # probably a split pod so take first =head[12] as title for (my $i = 0; $i < @poddata; $i++) { - last if ($Title) = $poddata[$i] =~ /^=head[12]\s*(.*)/; + if( ($Title) = $poddata[$i] =~ /^=head[12]\s*(.*)/ ){ + $Title = depod($Title);# PodMaster + last; + } + } warn "adopted '$Title' as title for $Podfile\n" if $Verbose and $Title;
    Here's a patch against perl-current
    --- html.pm 2003-12-12 16:29:00.000000000 -0800 +++ newHtml.pm 2004-01-07 00:31:04.453125000 -0800 @@ -415,8 +415,9 @@ for (my $i = 0; $i < @poddata; $i++) { if ($poddata[$i] =~ /^=head1\s*NAME\b/m) { for my $para ( @poddata[$i, $i+1] ) { - last TITLE_SEARCH - if ($Title) = $para =~ /(\S+\s+-+.*\S)/s; + if( ($Title) = $para =~ /(\S+\s+-+.*\S)/s ){ + $Title = depod($Title);# PodMaster + last TITLE_SEARCH; } } @@ -426,7 +427,10 @@ if (!$Title and $Podfile =~ /\.pod\z/) { # probably a split pod so take first =head[12] as title for (my $i = 0; $i < @poddata; $i++) { - last if ($Title) = $poddata[$i] =~ /^=head[12]\s*(.*)/; + if( ($Title) = $poddata[$i] =~ /^=head[12]\s*(.*)/ ){ + $Title = depod($Title);# PodMaster + last; + } } warn "adopted '$Title' as title for $Podfile\n" if $Verbose and $Title;

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Re: pod2html includes markup (like B< >) in TITLE
by ff (Hermit) on Jan 06, 2004 at 19:44 UTC
    Whaddaya know, I'm doing this in 5.6 (I use ActiveState's Perl Development Kit to wrap my app up in a nice little (?) .exe file, and I forget whether I have to pay big bucks to upgrade it for 5.8.) That should be the ticket though.

    Thanks,
    Brig

    UPDATE

    I took a quick look at the PAR slideshow. Thanks for the pointer.

    In the meantime, while upgrading Pod::Html should fix this particular problem, the deeper problem is my avoiding the problem of getting --title=title to work. On first reading the pod2html man page, my attempts at following the instructions failed, but considering the documentation from Pod::Html and its additional option of --backlink I realized that I wanted an automated (vs. command-line) solution to my problem of generating both .htm and .txt files anyway. And that another crack at --title was worthwhile.

    Thus, I can put the following script in a folder that contains a program's *_Readme.pod file and put the package file someplace accessible like E:/aa/perl/lib. Double-clicking the script from Windows Explorer rebuilds the .htm and .txt files from whatever I've done with my .pod file. And now I get all those little 'Back to Top' links. :-)

    # Creates Readme.htm and Readme.txt files from Readme.pod use strict; push @INC, 'E:/aa/perl/lib'; require 'podtools.pl'; my $pod_filename = 'BW_Readme.pod'; # filename of pod input my $htm_filename = 'BW_Readme.htm'; # filename of htm output my $title = 'BW123321™ Readme'; # title for the htm window; # ™ is actually the (TM) symbol my $txt_filename = 'BW_Readme.txt'; # filename of txt output podtools::pod2_htm_txt( $pod_filename, $htm_filename, $title, $txt_filename, );

    and the podtools.pl package file in my E:/aa/perl/lib folder:

    package podtools; use strict; use Pod::Html; use Pod::Text; sub pod2_htm_txt { # Creates htm and txt files from a given pod file and htm title my ( $pod_filename, $htm_filename, $title, $txt_filename, ) = @_; # Build the '.htm' file pod2html( "--infile=$pod_filename", "--outfile=$htm_filename", "--title=$title", '--backlink=Back to Top', # implants backlink after =head1 ); # Build the '.txt' file my $parser = Pod::Text->new ( loose => 1, # prints blank lines after =head1 width => 78, quotes => 'none', ); # Read POD from first file and write to second. $parser->parse_from_file ( $pod_filename, $txt_filename ); } 1;
      You don't have to pay for free things ===> PAR. Also, you don't have to upgrade perl to upgrade Pod::Html.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.