Skip to content

Commit

Permalink
add option 'no-index-html'; internal stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaefer committed Oct 29, 2020
1 parent b7db174 commit acee687
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 207 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lib/Perl/Gib/resources/assets/fonts/vollkorn.css
lib/Perl/Gib/resources/assets/js/gib.js
lib/Perl/Gib/resources/assets/js/highlight.min.js
lib/Perl/Gib/resources/templates/gib.html.ep
lib/Perl/Gib/resources/templates/gib.index.html.ep
lib/Perl/Gib/Template.pm
Makefile.PL
MANIFEST
Expand Down
48 changes: 21 additions & 27 deletions bin/perlgib
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";

use Cwd qw(cwd realpath);
use File::Spec::Functions qw(catdir rel2abs);
use Getopt::Long qw(:config require_order);
use Path::Tiny;
use Pod::Usage;
use Term::ANSIColor;
use Time::HiRes qw(gettimeofday);
Expand Down Expand Up @@ -45,33 +44,24 @@ sub print_version {
}

sub new_perlgib {
my $args = shift;

$args ||= {};
$args->{'library_path'} = $opts{'library_path'}
if ( $opts{'library_path'} );
$args->{'library_name'} = $opts{'library_name'}
if ( $opts{'library_name'} );
while ( my ( $key, $value ) = each %opts ) {
delete $opts{$key} if ( !defined $value );
}

return Perl::Gib->new($args);
return Perl::Gib->new(%opts);
}

sub do_doc {
my ( $out, $format, $private );

GetOptions(
"output-path=s" => \$out,
"output-format=s" => \$format,
"document-private-items" => \$private,
"output-path=s" => \$opts{'output_path'},
"output-format=s" => \$opts{'output_format'},
"document-private-items" => \$opts{'document_private_items'},
"no-html-index" => \$opts{'no_html_index'},
) or return print_usage();

$format ||= 'html';

my $args = {};
$args->{'output_path'} = $out if ($out);
$args->{'document_private_items'} = 1 if ($private);
my $perlgib = new_perlgib($args);
my $perlgib = new_perlgib();

my $format = $opts{'output_format'} || 'html';
my %formats = (
'html' => 1,
'markdown' => 1,
Expand Down Expand Up @@ -99,10 +89,10 @@ sub do_action {
my $lib = $opts{'library_name'};
if ( !$lib ) {
$lib =
$opts{'library_path'}
? $opts{'library_path'}
: catdir( cwd(), 'lib' );
$lib = rel2abs( realpath($lib) );
$opts{'library_path'}
? path( $opts{'library_path'} )
: path('lib');
$lib = $lib->absolute->realpath->stringify;
}

printf "%s (%s)\n", colored( $info, 'green' ), $lib;
Expand Down Expand Up @@ -215,6 +205,10 @@ Documentation output format, default html.
Document private items.
=item --no-html-index
Prevent creating html index.
=back
=head2 test
Expand All @@ -225,7 +219,7 @@ Execute documentation tests.
perlgib is Perl's alternative documentation and test manager.
perlgib generates HTML documentation and runs tests from Perl code comment
lines.
perlgib generates HTML and Markdown documentation and runs tests from Perl
code comment lines.
=cut
Loading

0 comments on commit acee687

Please sign in to comment.