Improved HTML vs. XHTML output validity.
authorlace <>
Fri, 31 Mar 2006 02:12:00 +0000 (02:12 +0000)
committerlace <>
Fri, 31 Mar 2006 02:12:00 +0000 (02:12 +0000)
project/Pod2Html.pm

index 2c785f4..a715162 100755 (executable)
@@ -41,8 +41,11 @@ my $W=My::Web->init(
                # From: <rt-3.0.11-37250-122352.19.7520280058314@perl.org>
                # Do not: "content_type"=>"text/html",
                # or whatever as pod2html(1) already produces XHTML.
-               "header_only"=>"xml",
+               # Do not: "header_only"=>"xml",
+               # as pod2html(1) already provides the <?xml ?> header.
                "header_only"=>1,
+               # Match the pod2html(1) <meta/> tag.
+               "charset"=>"utf-8",
                "http_safe"=>0, # lynx(1) downloads.
                );
 My::Web->heading();
@@ -53,6 +56,9 @@ open F,"lynx -source ".$W->{"project_viewcvs"}."*checkout*/".$W->{"args"}{"cvs"}
                # FIXME: "/tmp" - dangerous, not unique, currently creates: pod2htmd.tmp pod2htmi.tmp
                ." |pod2html --cachedir=/tmp -"
                ." |";
+my $first=<F>;
+$first=undef() if $first && $W->{"content_type"} eq "text/html" && $first=~/^\Q<?xml\E\b.*\Q?>\E\s*$/s;
+print $first if $first;
 print $_ while <F>;
 close F;