mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed compatibility with Python < 3.10
This commit is contained in:
parent
9f3efb8a59
commit
0704046536
@ -18,6 +18,8 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import yaml
|
||||
@ -33,7 +35,6 @@ from mkdocs.structure.pages import Page, _RelativePathTreeprocessor
|
||||
from mkdocs.structure.toc import get_toc
|
||||
from mkdocs.utils.meta import YAML_RE
|
||||
from re import Match
|
||||
from typing import Union
|
||||
from yaml import SafeLoader
|
||||
|
||||
from .config import PostConfig
|
||||
@ -205,7 +206,7 @@ class View(Page):
|
||||
# Initialize view
|
||||
def __init__(self, title: str | None, file: File, config: MkDocsConfig):
|
||||
super().__init__(title, file, config)
|
||||
self.parent: Union[View, Section]
|
||||
self.parent: View | Section
|
||||
|
||||
# Initialize posts and views
|
||||
self.posts: list[Post] = []
|
||||
|
@ -29,7 +29,7 @@ from mkdocs.utils.templates import url_filter as _url_filter
|
||||
|
||||
# Filter for normalizing URLs with support for paginated views
|
||||
@pass_context
|
||||
def url_filter(context: Context, url: str | None):
|
||||
def url_filter(context: Context, url: str):
|
||||
page = context["page"]
|
||||
|
||||
# If the current page is a view, check if the URL links to the page
|
||||
|
@ -18,6 +18,8 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
import os
|
||||
import yaml
|
||||
@ -33,7 +35,6 @@ from mkdocs.structure.pages import Page, _RelativePathTreeprocessor
|
||||
from mkdocs.structure.toc import get_toc
|
||||
from mkdocs.utils.meta import YAML_RE
|
||||
from re import Match
|
||||
from typing import Union
|
||||
from yaml import SafeLoader
|
||||
|
||||
from .config import PostConfig
|
||||
@ -205,7 +206,7 @@ class View(Page):
|
||||
# Initialize view
|
||||
def __init__(self, title: str | None, file: File, config: MkDocsConfig):
|
||||
super().__init__(title, file, config)
|
||||
self.parent: Union[View, Section]
|
||||
self.parent: View | Section
|
||||
|
||||
# Initialize posts and views
|
||||
self.posts: list[Post] = []
|
||||
|
@ -29,7 +29,7 @@ from mkdocs.utils.templates import url_filter as _url_filter
|
||||
|
||||
# Filter for normalizing URLs with support for paginated views
|
||||
@pass_context
|
||||
def url_filter(context: Context, url: str | None):
|
||||
def url_filter(context: Context, url: str):
|
||||
page = context["page"]
|
||||
|
||||
# If the current page is a view, check if the URL links to the page
|
||||
|
Loading…
Reference in New Issue
Block a user