def to_mkdocs(self) -> MkDocsNavigation: pages = _get_by_type(self.items, Page) _add_previous_and_next_links(pages) _add_parent_links(self.items) from datetime import datetime date_time = datetime.today() diff_day_list = [] page_list = [] for page in pages: self._get_meta(page) if 'time' in page.meta: page_time = page.meta['time'] year = int(page_time[0:4]) month = int(page_time[4:6]) day = int(page_time[6:8]) page_datetime = datetime(year, month, day) time_delta = date_time - page_datetime total_seconds = time_delta.total_seconds() total_days = total_seconds / 3600 / 24 else: total_days = 999999 diff_day_list.append(total_days) import numpy as np argsorted = np.argsort(diff_day_list) for index in argsorted: if pages[index].is_homepage: page_list.insert(0, pages[index]) else: page_list.append(pages[index]) if diff_day_list[index] < self.maximum_days_ahead: if len(page_list) <= self.maximum_file_homepage: pages[index].shown_in_homepage = True continue pages[index].shown_in_homepage = False # _add_previous_and_next_links(page_list) print('Finishing daytime processing') return MkDocsNavigation(self.items, page_list)
def createNavigation(items: List[NavigationItem]) -> MkDocsNavigation: pages = _get_by_type(items, Page) _add_previous_and_next_links(pages) _add_parent_links(items) return MkDocsNavigation(items, pages)
def to_mkdocs(self) -> MkDocsNavigation: pages = _get_by_type(self.items, Page) _add_previous_and_next_links(pages) _add_parent_links(self.items) return MkDocsNavigation(self.items, pages)