This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Bump the perl version in various places for 5.31.0
[perl5.git] / Porting / make-rmg-checklist
index d7a9bc4..8b11ed0 100644 (file)
@@ -6,13 +6,13 @@ use Getopt::Long qw< :config no_ignore_case >;
 sub pod {
     my $filename = shift;
 
-    open my $fh, '<', 'Porting/release_managers_guide.pod'
-        or die "Cannot open file: $!\n";
+    open my $fh, '<', $filename
+        or die "Cannot open file ($filename): $!\n";
 
     my @lines = <$fh>;
 
     close $fh
-        or die "Cannot close file: $!\n";
+        or die "Cannot close file ($filename): $!\n";
 
     return \@lines;
 }
@@ -33,7 +33,6 @@ the following arguments:
                 of release you want to have
 
   --html        Output HTML instead of POD
-                (Not supported at the moment)
 _END_HELP
 
     exit;
@@ -72,8 +71,13 @@ sub iterate_items {
     ITEM:
     foreach my $item ( @{$items} ) {
         foreach my $meta ( @{ $item->{'metadata'} || [] } ) {
-            $meta =~ /skip .+ $type/xms
-                and next ITEM;
+            if ( $meta =~ /skip .+ $type/xms ) {
+                next ITEM;
+            }
+            elsif ( $meta =~ /skip/xms ) {
+                $item->{content} =~
+                    s/^ [^\n]* \b MUST\ SKIP\ this\ step \b [^\n]* \n\n//xms;
+            }
         }
 
         $cb->($item);
@@ -116,19 +120,27 @@ sub create_checklist {
     print "=back\n\n" x ( $over_level / 4 );
 }
 
-my ($version);
+my ($version, $html);
 GetOptions(
     'version|v=s' => \$version,
-    'html'        => sub { _help('HTML is not supported at the moment'); },
+    'html'        => \$html,
     'help|h'      => sub { _help(); },
 );
 
 defined $version
     or _help('You must provide a version number');
 
+my $pod_output = '';
+if ($html) {
+    require Pod::Simple::HTML;
+    open my $fh, '>', \$pod_output
+        or die "Can't create fh to string: $!\n";
+    select $fh;
+}
+
 my $type = _type_from_version($version);
 
-chomp( my @pod_lines = @{ pod() } );
+chomp( my @pod_lines = @{ pod('Porting/release_managers_guide.pod') } );
 
 my ( @items, $current_element, @leading_attrs );
 my $skip_headers     = qr/^=encoding/xms;
@@ -194,3 +206,9 @@ iterate_items( \@items, $type, sub {
     print "=head$item->{'head'} $item->{'name'}";
     print "$item->{'content'}\n";
 } );
+
+if ($html) {
+    my $simple = Pod::Simple::HTML->new;
+    $simple->output_fh(*STDOUT);
+    $simple->parse_string_document($pod_output);
+}