# New Ticket Created by  Earl Hood 
# Please include the string:  [perl #36526]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36526 >



This is a bug report for perl from [EMAIL PROTECTED],
generated with the help of perlbug 1.35 running under perl v5.8.6.


-----------------------------------------------------------------
[Please enter your report here]

Pod::Html generated invalid markup for lists.  For example,
a numbered listed turns out as:

<ol>
<li></li>
...text here...
<p></p>
...

Causing lists to be rendered like:

  1.
    ... text here ...

  2.
    ... text here ...

Or for unordered lists:

  *
    ... text here ...

  *
    ... text here ...

Notice the annoying line break after each bullet.

What follows is a patch for Pod::Html based upon the version provided
in Perl 5.8.6 that appears to fix the problem and generate more
proper XHTML.  Looking at the Pod::Html for 5.8.7, the patch should
be applicable to both.

SPECIAL NOTE: This patch also includes a functional enhancement to
enable xrefs to scripts that include POD in the source file.  I.e.
Pod::Html does not support linking to scripts that do not have a
known extension (pod or pm).  This patch includes code to include
files in the cache that appear to have POD content along with markup
generation fixes.

Patch:

--- Html.pm.5.8.6       Wed Jul 13 01:28:13 2005
+++ Html.pm     Wed Jul 13 01:20:05 2005
@@ -524,7 +524,7 @@
                } elsif (/^=over\s*(.*)/) {             # =over N
                    process_over();
                } elsif (/^=back/) {            # =back
-                   process_back();
+                   process_back($need_dd);
                } elsif (/^=for\s+(\S+)\s*(.*)/si) {# =for
                    process_for($1,$2);
                } else {
@@ -571,11 +571,10 @@
                ## end of experimental
 
                if( $after_item ){
-                   print HTML "$text\n";
+                   #print HTML "$text\n";
                    $After_Lpar = 1;
-               } else {
-                   print HTML "<p>$text</p>\n";
                }
+               print HTML "<p>$text</p>\n";
            }
            print HTML "</dd>\n" if $need_dd;
            $after_item = 0;
@@ -959,6 +958,19 @@
            $Pages{$_}  = "" unless defined $Pages{$_};
            $Pages{$_} .= "$dir/$_.pm:";
            push(@pods, "$dir/$_.pm");
+       } elsif (-T "$dir/$_") {                            # script(?)
+           local *F;
+           if (open(F, "$dir/$_")) {
+               my $line;
+               while (defined($line = <F>)) {
+                   if ($line =~ /^=(?:pod|head1)/) {
+                       $Pages{$_}  = "" unless defined $Pages{$_};
+                       $Pages{$_} .= "$dir/$_.pod:";
+                       last;
+                   }
+               }
+               close(F);
+           }
        }
     }
     closedir(DIR);
@@ -1107,7 +1119,8 @@
         $name = anchorify($name);
        print HTML qq{<a name="$name">}, process_text( \$otext ), '</a>';
     }
-    print HTML "</strong><br />\n";
+    #print HTML "</strong><br />\n";
+    print HTML "</strong>\n";
     undef( $EmittedItem );
 }
 
@@ -1139,7 +1152,8 @@
 
     # formatting: insert a paragraph if preceding item has >1 paragraph
     if( $After_Lpar ){
-       print HTML "<p></p>\n";
+       #print HTML "<p></p>\n";
+       print HTML $need_dd ? "</dd>\n" : "</li>\n" if $After_Lpar;
        $After_Lpar = 0;
     }
 
@@ -1172,7 +1186,7 @@
         }
         $need_dd = 1;
     }
-    print HTML "</$emitted>" if $emitted;
+    #print HTML "</$emitted>" if $emitted;
     print HTML "\n";
     return $need_dd;
 }
@@ -1191,6 +1205,7 @@
 # process_back - process a pod back tag and convert it to HTML format.
 #
 sub process_back {
+    my $need_dd = shift;
     if( $Listlevel == 0 ){
        warn "$0: $Podfile: unexpected =back directive in paragraph $Paragraph. 
 ignoring.\n";
        return;
@@ -1201,7 +1216,8 @@
     # $Listend[$Listlevel] may have never been initialized.
     $Listlevel--;
     if( defined $Listend[$Listlevel] ){
-       print HTML '<p></p>' if $After_Lpar;
+       #print HTML '<p></p>' if $After_Lpar;
+       print HTML $need_dd ? "</dd>\n" : "</li>\n" if $After_Lpar;
        print HTML $Listend[$Listlevel];
         print HTML "\n";
         pop( @Listend );


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
---
Site configuration information for perl v5.8.6:

Configured by ehood at Sat Jun 11 12:42:58 CDT 2005.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=linux, osvers=2.4.20-43.7.legacy, archname=i686-linux-thread-multi
    uname='linux mcguire.earlhood.com 2.4.20-43.7.legacy #1 sat apr 30 01:48:03 
edt 2005 i686 unknown '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS 
-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.3 2.96-113)', 
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.6:
    /usr/local/lib/perl5/5.8.6/i686-linux-thread-multi
    /usr/local/lib/perl5/5.8.6
    /usr/local/lib/perl5/site_perl/5.8.6/i686-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.8.6:
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=en_US
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/X11/bin:/sbin:/usr/sbin:/usr/bin:/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Reply via email to