def _process_section(self, section: Section,
                         collapse_recursive: bool) -> NavigationItem:
        meta = self.meta.sections[section]

        if meta.collapse_single_pages is not None:
            collapse_recursive = meta.collapse_single_pages

        self._set_title(section, meta)

        section.children = self._process_children(section.children,
                                                  collapse_recursive, meta)

        return self._collapse(section, meta.collapse, collapse_recursive)
Beispiel #2
0
    def _rearrange_section(self, section: Section) -> Section:
        section.children = self._rearrange_list_of_navigation_items(
            section.children, )

        index_page = find_index_page_in_section(section)
        if index_page is None:
            section.position = PAGE_DEFAULT_POSITION

        else:
            section.position = index_page.position

            if index_page.title:
                section.title = index_page.title

        return section
Beispiel #3
0
    def _process_section(self, section: Section, options: Options) -> Optional[NavigationItem]:
        meta = self.meta.sections[section]
        collapse_recursive = options.collapse_single_pages

        if meta.hide is True:
            return None

        if meta.collapse_single_pages is not None:
            collapse_recursive = meta.collapse_single_pages

        self._set_title(section, meta)

        section.children = self._process_children(section.children, options, meta)

        if not section.children:
            return None

        return self._collapse(section, meta.collapse, collapse_recursive)