mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Formatting
This commit is contained in:
parent
76a30ecab2
commit
a6033d1db6
@ -235,7 +235,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# We set the contents of the view to its title if pagination should
|
# We set the contents of the view to its title if pagination should
|
||||||
# not keep the content of the original view on paginaged views
|
# not keep the content of the original view on paginaged views
|
||||||
if not self.config.pagination_keep_content:
|
if not self.config.pagination_keep_content:
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if view in self._resolve_views(self.blog):
|
if view in self._resolve_views(self.blog):
|
||||||
assert isinstance(page, View)
|
assert isinstance(page, View)
|
||||||
if page.pages.index(page):
|
if page.pages.index(page):
|
||||||
@ -324,7 +324,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
|
|
||||||
# Skip if page is not a view managed by this instance - this plugin has
|
# Skip if page is not a view managed by this instance - this plugin has
|
||||||
# support for multiple instances, which is why this check is necessary
|
# support for multiple instances, which is why this check is necessary
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if view not in self._resolve_views(self.blog):
|
if view not in self._resolve_views(self.blog):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -514,13 +514,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
assert isinstance(next, View)
|
assert isinstance(next, View)
|
||||||
yield next
|
yield next
|
||||||
|
|
||||||
# Resolve canonical page of a page, which might be a view
|
|
||||||
def _resolve_canonical(self, page: Page):
|
|
||||||
if isinstance(page, View):
|
|
||||||
return page.pages[0]
|
|
||||||
else:
|
|
||||||
return page
|
|
||||||
|
|
||||||
# Resolve siblings of a navigation item
|
# Resolve siblings of a navigation item
|
||||||
def _resolve_siblings(self, item: StructureItem, nav: Navigation):
|
def _resolve_siblings(self, item: StructureItem, nav: Navigation):
|
||||||
if isinstance(item.parent, Section):
|
if isinstance(item.parent, Section):
|
||||||
@ -528,6 +521,13 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
else:
|
else:
|
||||||
return nav.items
|
return nav.items
|
||||||
|
|
||||||
|
# Resolve original page or view (e.g. for paginated views)
|
||||||
|
def _resolve_original(self, page: Page):
|
||||||
|
if isinstance(page, View):
|
||||||
|
return page.pages[0]
|
||||||
|
else:
|
||||||
|
return page
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# Generate views for archive - analyze posts and generate the necessary
|
# Generate views for archive - analyze posts and generate the necessary
|
||||||
@ -641,7 +641,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# If the page is a view, we know that we generated it and need to
|
# If the page is a view, we know that we generated it and need to
|
||||||
# link its siblings back to the view
|
# link its siblings back to the view
|
||||||
if isinstance(page, View):
|
if isinstance(page, View):
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if tail: tail.next_page = view
|
if tail: tail.next_page = view
|
||||||
if head: head.previous_page = view
|
if head: head.previous_page = view
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# We set the contents of the view to its title if pagination should
|
# We set the contents of the view to its title if pagination should
|
||||||
# not keep the content of the original view on paginaged views
|
# not keep the content of the original view on paginaged views
|
||||||
if not self.config.pagination_keep_content:
|
if not self.config.pagination_keep_content:
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if view in self._resolve_views(self.blog):
|
if view in self._resolve_views(self.blog):
|
||||||
assert isinstance(page, View)
|
assert isinstance(page, View)
|
||||||
if page.pages.index(page):
|
if page.pages.index(page):
|
||||||
@ -324,7 +324,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
|
|
||||||
# Skip if page is not a view managed by this instance - this plugin has
|
# Skip if page is not a view managed by this instance - this plugin has
|
||||||
# support for multiple instances, which is why this check is necessary
|
# support for multiple instances, which is why this check is necessary
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if view not in self._resolve_views(self.blog):
|
if view not in self._resolve_views(self.blog):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -514,13 +514,6 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
assert isinstance(next, View)
|
assert isinstance(next, View)
|
||||||
yield next
|
yield next
|
||||||
|
|
||||||
# Resolve canonical page of a page, which might be a view
|
|
||||||
def _resolve_canonical(self, page: Page):
|
|
||||||
if isinstance(page, View):
|
|
||||||
return page.pages[0]
|
|
||||||
else:
|
|
||||||
return page
|
|
||||||
|
|
||||||
# Resolve siblings of a navigation item
|
# Resolve siblings of a navigation item
|
||||||
def _resolve_siblings(self, item: StructureItem, nav: Navigation):
|
def _resolve_siblings(self, item: StructureItem, nav: Navigation):
|
||||||
if isinstance(item.parent, Section):
|
if isinstance(item.parent, Section):
|
||||||
@ -528,6 +521,13 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
else:
|
else:
|
||||||
return nav.items
|
return nav.items
|
||||||
|
|
||||||
|
# Resolve original page or view (e.g. for paginated views)
|
||||||
|
def _resolve_original(self, page: Page):
|
||||||
|
if isinstance(page, View):
|
||||||
|
return page.pages[0]
|
||||||
|
else:
|
||||||
|
return page
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# Generate views for archive - analyze posts and generate the necessary
|
# Generate views for archive - analyze posts and generate the necessary
|
||||||
@ -641,7 +641,7 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# If the page is a view, we know that we generated it and need to
|
# If the page is a view, we know that we generated it and need to
|
||||||
# link its siblings back to the view
|
# link its siblings back to the view
|
||||||
if isinstance(page, View):
|
if isinstance(page, View):
|
||||||
view = self._resolve_canonical(page)
|
view = self._resolve_original(page)
|
||||||
if tail: tail.next_page = view
|
if tail: tail.next_page = view
|
||||||
if head: head.previous_page = view
|
if head: head.previous_page = view
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user