# Path: elephantblog/navigation_extensions/common.py
# def date_of_first_entry():
# def date_tree():
#     def children(self, page, **kwargs):
# class BlogCategoriesNavigationExtension(NavigationExtension):


from django.utils.translation import gettext as _, gettext_lazy
from .common import Category, NavigationExtension, PagePretender, all_months, date_tree



class BlogDateNavigationExtension(NavigationExtension):
    """
    Navigation extension for FeinCMS which shows a year and month Breakdown:
    2012
        April
        March
        February
        January
    2011
    2010
    """

    name = gettext_lazy("Blog date")

    def children(self, page, **kwargs):
        for year, months in date_tree():
            yield PagePretender(
                title="%s" % year,
                url=f"{page.get_absolute_url()}{year}/",
                tree_id=page.tree_id,
                lft=0,
                rght=len(months) + 1,
                level=page.level + 1,
                slug="%s" % year,
            )
            for month in months:
                yield PagePretender(

# Path: elephantblog/navigation_extensions/common.py
# def date_of_first_entry():
# def date_tree():
#     def children(self, page, **kwargs):
# class BlogCategoriesNavigationExtension(NavigationExtension):


# Path: elephantblog/navigation_extensions/treeinfo.py
from django.utils.translation import gettext as _, gettext_lazy
from .common import Category, NavigationExtension, PagePretender, all_months, date_tree




class BlogDateNavigationExtension(NavigationExtension):
    """
    Navigation extension for FeinCMS which shows a year and month Breakdown:
    2012
        April
        March
        February
        January
    2011
    2010
    """

    name = gettext_lazy("Blog date")

    def children(self, page, **kwargs):
        for year, months in date_tree():
            yield PagePretender(
                title="%s" % year,
                url=f"{page.get_absolute_url()}{year}/",
                tree_id=page.tree_id,
                lft=0,
                rght=len(months) + 1,
                level=page.level + 1,
                slug="%s" % year,
            )
            for month in months:
                yield PagePretender(

                    title="%s" % _(all_months[month - 1].strftime("%B")),