# recursively generate the TOC entries for the element and its children (which
# are only shown up to maxlevel. All ancestors of the current element are also
# shown with their immediate children, irrespective of their level.
-sub generate_ly_toc_entries($$$)
+sub generate_ly_toc_entries($$$$)
{
my $element = shift;
my $element_path = shift;
my $maxlevel = shift;
+ my $always_show_unnumbered_children = shift;
# Skip undefined sections, plus all sections generated by index splitting
return() if (not defined($element) or exists($element->{'index_page'}));
my @result = ();
my $entry = "$ind<li$this_css_class>" . &$anchor ($element->{'tocid'}, "$element->{'file'}#$element->{'id'}",$element->{'text'});
my $children = $element->{'section_childs'};
+ # Don't add unnumbered entries, unless they are at top-level or a parent of the current!
+ if (not ($element->{'number'} or $always_show_unnumbered_children)) {
+ return @result;
+ }
if ( $print_children and defined($children) and (ref($children) eq "ARRAY") ) {
push (@result, $entry);
my @child_result = ();
foreach (@$children) {
- push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel));
+ push (@child_result, generate_ly_toc_entries($_, $element_path, $maxlevel, $is_parent_of_current));
}
# if no child nodes were generated, e.g. for the index, where expanded pages
# are ignored, don't generate a list at all...
my @toc_entries = ("<div class=\"contents\">", "<ul$NO_BULLET_LIST_ATTRIBUTE>");
my $children = $current_element->{'section_childs'};
foreach ( @$children ) {
- push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth));
+ push (@toc_entries, generate_ly_toc_entries($_, \%parentelements, $page_toc_depth, False));
}
push (@toc_entries, "</ul>");
push (@toc_entries, "</div>");