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;
}
of release you want to have
--html Output HTML instead of POD
- (Not supported at the moment)
_END_HELP
exit;
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);
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;
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);
+}