From bb2d75c010139005970b584a5d6048ea2cf8be32 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 11 Jun 2024 16:29:13 +0200 Subject: [PATCH] scantree.pl: indent pod template fragments (#482) 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. --- Doc/scantree.pl | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/Doc/scantree.pl b/Doc/scantree.pl index cdccc53cf..6ceb7eeb2 100644 --- a/Doc/scantree.pl +++ b/Doc/scantree.pl @@ -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) { @@ -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) { @@ -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) { @@ -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;