diff --git a/bin/generate_documentation.pl b/bin/generate_documentation.pl index 4537a78..aa9b906 100644 --- a/bin/generate_documentation.pl +++ b/bin/generate_documentation.pl @@ -5,7 +5,10 @@ use v5.30.0; use strict; use warnings; +use Data::Dumper; + use Path::Tiny qw/path/; +use Mojo::Template; my $current_dir = path(__FILE__)->parent->parent->child('lib'); @@ -15,8 +18,50 @@ $current_dir->visit( if ( -f $path ) { return if $path !~ /\.pm$/; system mkdir => '-pv', 'doc/' . $path->parent; - system pod2html => $path, '-o', 'doc/' . $path . '.html', '--htmldir', $current_dir->child('./doc')->realpath, '--podpath', 'lib', '--recurse'; + system pod2html => $path, + '-o', 'doc/' . $path . '.html', '--htmldir', + $current_dir->child('./doc')->realpath, '--podpath', 'lib', + '--recurse'; } }, { recurse => 1 } ); +my $documentation_path = path(__FILE__)->parent->parent->child('doc'); + +my %modules; +$documentation_path->visit( + sub { + my ( $path, $state ) = @_; + if ( !-f $path ) { + return; + } + if ( $path !~ /\.pm\.html$/ ) { + return; + } + $modules{ $path =~ s{^.*/lib/}{}r =~ s/\.pm\.html$//r =~ s{/}{::}gr } = + ''.$path=~s/doc\///r; + }, + { recurse => 1 }, +); + +my $mojo_template = Mojo::Template->new; +my $html = $mojo_template->render(<<'EOF', \%modules); +% my ($modules) = @_; + + + + +

Welcome to the Peace documentation

+ + + + +EOF + +$documentation_path->child('index.html')->spew_utf8($html); diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..5811812 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,37 @@ + + + + +

Welcome to the Peace documentation

+ + + +