Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 45830
Status: open
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: nanis [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Option to generate HTML using perltidy
Download (untitled) / with headers
text/plain 432b
This issue came up on StackOverflow.com http://stackoverflow.com/questions/835530/how-can-i-add-perltidys-html-generation-to-my-automated-perl-build My proposed solution was to override Module::Build::Base::htmlify_pods. The code is available at the link above and also attached with this report. However, if the idea of switchable HTML generators sounds good, it would probably be a good idea to create an option to do so. Sinan
Subject: Build.pm
Download Build.pm
text/x-perl 2.7k
package My::Module::Build; use strict; use warnings; use base 'Module::Build'; sub htmlify_pods { my $self = shift; my $type = shift; my $htmldir = shift || File::Spec->catdir($self->blib, "${type}html"); require Module::Build::Base; require Module::Build::PodParser; require Perl::Tidy; $self->add_to_cleanup('pod2htm*'); my $pods = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, exclude => [ Module::Build::Base::file_qr('\.(?:bat|com|html)$') ] ); return unless %$pods; # nothing to do unless ( -d $htmldir ) { File::Path::mkpath($htmldir, 0, oct(755)) or die "Couldn't mkdir $htmldir: $!"; } my @rootdirs = ($type eq 'bin') ? qw(bin) : $self->installdirs eq 'core' ? qw(lib) : qw(site lib); my $podpath = join ':', map $_->[1], grep -e $_->[0], map [File::Spec->catdir($self->blib, $_), $_], qw( script lib ); foreach my $pod ( keys %$pods ) { my ($name, $path) = File::Basename::fileparse($pods->{$pod}, Module::Build::Base::file_qr('\.(?:pm|plx?|pod)$')); my @dirs = File::Spec->splitdir( File::Spec->canonpath( $path ) ); pop( @dirs ) if $dirs[-1] eq File::Spec->curdir; my $fulldir = File::Spec->catfile($htmldir, @rootdirs, @dirs); my $outfile = File::Spec->catfile($fulldir, "${name}.html"); my $infile = File::Spec->abs2rel($pod); next if $self->up_to_date($infile, $outfile); unless ( -d $fulldir ){ File::Path::mkpath($fulldir, 0, oct(755)) or die "Couldn't mkdir $fulldir: $!"; } my $path2root = join( '/', ('..') x (@rootdirs+@dirs) ); my $htmlroot = join( '/', ($path2root, $self->installdirs eq 'core' ? () : qw(site) ) ); my $fh = IO::File->new($infile) or die "Can't read $infile: $!"; my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract(); my $title = join( '::', (@dirs, $name) ); $title .= " - $abstract" if $abstract; my %opts = ( argv => join(" ", qw( -html --podflush ), "--title=$title", '--podroot='.$self->blib, "--htmlroot=$htmlroot", "--podpath=$podpath", ), source => $infile, destination => $outfile, ); if ( eval{Pod::Html->VERSION(1.03)} ) { $opts{argv} .= ' --podheader'; $opts{argv} .= ' --backlink=Back to Top'; if ( $self->html_css ) { $opts{argv} .= " --css=$path2root/" . $self->html_css; } } $self->log_info("HTMLifying $infile -> $outfile\n"); $self->log_verbose("perltidy %opts\n"); Perl::Tidy::perltidy(%opts); # or warn "pod2html @opts failed: $!"; } } 1;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.