Skip to content

Commit

Permalink
scantree.pl: indent pod template fragments
Browse files Browse the repository at this point in the history
Pod in a heredoc is still treated as Pod by a pod viewer. This confuses
any tool trying to look for all Pod files.

Indenting the Pod fragments means they won't be interpreted as Pod, and
this indentation can be stripped off when writing the files.
  • Loading branch information
haarg committed Jun 9, 2024
1 parent cd5ffff commit 7ffce41
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions Doc/scantree.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,24 @@
$outindex="$outdir/Index.pod" unless (defined $outindex);
unlink $outindex if -e $outindex; # Handle read only file
open my $podfh, ">", $outindex or die "couldn't open $outindex: $!";
print $podfh <<'EOPOD';
my $pod;

=head1 NAME
$pod = <<'EOPOD';
PDL::Index - an index of PDL documentation
=head1 NAME
=head1 DESCRIPTION
PDL::Index - an index of PDL documentation
A meta document listing the documented PDL modules and
the PDL manual documents
=head1 DESCRIPTION
=head1 PDL manuals
A meta document listing the documented PDL modules and
the PDL manual documents
=head1 PDL manuals
EOPOD
$pod =~ s/^ //gm;
print $podfh $pod;

print $podfh "=over 4\n\n";
for (@mans) {
Expand All @@ -66,13 +70,15 @@ =head1 PDL manuals
print $podfh "=item *\n\n$ref\n\n";
}

print $podfh <<'EOPOD';
$pod = <<'EOPOD';
=back
=back
=head1 PDL scripts
=head1 PDL scripts
EOPOD
$pod =~ s/^ //gm;
print $podfh $pod;

print $podfh "=over 4\n\n";
for (@scripts) {
Expand All @@ -81,13 +87,15 @@ =head1 PDL scripts
print $podfh "=item *\n\n$ref\n\n";
}

print $podfh <<'EOPOD';
$pod = <<'EOPOD';
=back
=back
=head1 PDL modules
=head1 PDL modules
EOPOD
$pod =~ s/^ //gm;
print $podfh $pod;

print $podfh "=over 4\n\n";
for (@mods) {
Expand All @@ -102,15 +110,17 @@ =head1 PDL modules
print $podfh "=item *\n\n$ref\n\n";
}

print $podfh <<"EOPOD";
$pod = <<'EOPOD';
=back
=back
=head1 HISTORY
=head1 HISTORY
Automatically generated by scantree.pl for PDL version $PDL::VERSION.
Automatically generated by scantree.pl for PDL version $PDL::VERSION.
EOPOD
$pod =~ s/^ //gm;
print $podfh $pod;

close $podfh;

Expand Down

0 comments on commit 7ffce41

Please sign in to comment.