diff --git a/lib/WeBWorK/ContentGenerator/PODViewer.pm b/lib/WeBWorK/ContentGenerator/PODViewer.pm index e07ac0a61a..f1c2498df0 100644 --- a/lib/WeBWorK/ContentGenerator/PODViewer.pm +++ b/lib/WeBWorK/ContentGenerator/PODViewer.pm @@ -32,13 +32,32 @@ sub PODindex ($c) { my $podFiles = Pod::Simple::Search->new->inc(0)->limit_re(qr/^doc|^lib|^macros/)->survey($pgRoot); - my $sections = {}; + my $docs = []; + my $macros = {}; + my $libs = []; for (sort keys %$podFiles) { my $section = $_ =~ s/::.*$//r; - push(@{ $sections->{$section} }, $podFiles->{$_} =~ s!^$pgRoot/$section/!!r); + if ($section eq 'doc') { + push(@$docs, $podFiles->{$_} =~ s!^$pgRoot/!!r); + } elsif ($section eq 'lib') { + push(@$libs, $podFiles->{$_} =~ s!^$pgRoot/lib/!!r); + } else { + my $macro = $podFiles->{$_} =~ s!^$pgRoot/macros/(.+)/.+$!$1!r; + if ($macro =~ /^$pgRoot/) { + push(@$docs, $podFiles->{$_} =~ s!^$pgRoot/!!r); + } else { + push(@{ $macros->{$macro} }, $podFiles->{$_} =~ s!^$pgRoot/macros/$macro/!!r); + } + } } - return $c->render('ContentGenerator/PODViewer', sections => $sections, sidebar_title => $c->maketext('Categories')); + return $c->render( + 'ContentGenerator/PODViewer', + docs => $docs, + macros => $macros, + libs => $libs, + sidebar_title => $c->maketext('Categories') + ); } sub renderPOD ($c) { diff --git a/templates/ContentGenerator/PODViewer.html.ep b/templates/ContentGenerator/PODViewer.html.ep index 89804f5fa6..416486dc49 100644 --- a/templates/ContentGenerator/PODViewer.html.ep +++ b/templates/ContentGenerator/PODViewer.html.ep @@ -6,26 +6,62 @@ % lib => maketext('Libraries'), % macros => maketext('Macros') % ); +% my %macro_names = ( + % answers => maketext('Answers'), + % contexts => maketext('Contexts'), + % core => maketext('Core'), + % deprecated => maketext('Deprecated'), + % graph => maketext('Graph'), + % math => maketext('Math'), + % misc => maketext('Miscellaneous'), + % parsers => maketext('Parsers'), + % ui => maketext('User Interface') +% ); % -% for my $section (sort keys %$sections) { - % content_for toc => begin - <%= link_to $section_names{$section} => "#$section", class => 'nav-link' %> +% content_for pod_links => begin +