$/ = "";
my @poddata = <POD>;
close(POD);
+
+ # be eol agnostic
+ for (@poddata) {
+ if (/\r/) {
+ if (/\r\n/) {
+ @poddata = map { s/\r\n/\n/g;
+ /\n\n/ ?
+ map { "$_\n\n" } split /\n\n/ :
+ $_ } @poddata;
+ } else {
+ @poddata = map { s/\r/\n/g;
+ /\n\n/ ?
+ map { "$_\n\n" } split /\n\n/ :
+ $_ } @poddata;
+ }
+ last;
+ }
+ }
+
clean_data( \@poddata );
# scan the pod for =head[1-6] directives and build an index
$rest = $$text;
# insert spaces in place of tabs
- $rest =~ s#.*#
- my $line = $&;
- 1 while $line =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+ $rest =~ s#(.+)#
+ my $line = $1;
+ 1 while $line =~ s/(\t+)/' ' x ((length($1) * 8) - $-[0] % 8)/e;
$line;
#eg;
$rest =~ s/</</g;
$rest =~ s/>/>/g;
$rest =~ s/"/"/g;
- $rest =~ s/'/'/g;
+ # ' is only in XHTML, not HTML4. Be conservative
+ #$rest =~ s/'/'/g;
return $rest;
}