mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed error when using git-revision-date-localized-plugin with blog
This commit is contained in:
@@ -770,13 +770,23 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# either inside the temporary directory or the docs directory
|
# either inside the temporary directory or the docs directory
|
||||||
def _path_to_file(self, path: str, config: MkDocsConfig, *, temp = True):
|
def _path_to_file(self, path: str, config: MkDocsConfig, *, temp = True):
|
||||||
assert path.endswith(".md")
|
assert path.endswith(".md")
|
||||||
return File(
|
file = File(
|
||||||
path,
|
path,
|
||||||
config.docs_dir if not temp else self.temp_dir,
|
config.docs_dir if not temp else self.temp_dir,
|
||||||
config.site_dir,
|
config.site_dir,
|
||||||
config.use_directory_urls
|
config.use_directory_urls
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Hack: mark file as generated, so other plugins don't think it's part
|
||||||
|
# of the file system. This is more or less a new quasi-standard that
|
||||||
|
# still needs to be adopted by MkDocs, and was introduced by the
|
||||||
|
# git-revision-date-localized-plugin - see https://bit.ly/3ZUmdBx
|
||||||
|
if temp:
|
||||||
|
file.generated_by = "material/blog"
|
||||||
|
|
||||||
|
# Return file
|
||||||
|
return file
|
||||||
|
|
||||||
# Write the content to the file located at the given path
|
# Write the content to the file located at the given path
|
||||||
def _save_to_file(self, path: str, content: str):
|
def _save_to_file(self, path: str, content: str):
|
||||||
os.makedirs(os.path.dirname(path), exist_ok = True)
|
os.makedirs(os.path.dirname(path), exist_ok = True)
|
||||||
|
|||||||
@@ -770,13 +770,23 @@ class BlogPlugin(BasePlugin[BlogConfig]):
|
|||||||
# either inside the temporary directory or the docs directory
|
# either inside the temporary directory or the docs directory
|
||||||
def _path_to_file(self, path: str, config: MkDocsConfig, *, temp = True):
|
def _path_to_file(self, path: str, config: MkDocsConfig, *, temp = True):
|
||||||
assert path.endswith(".md")
|
assert path.endswith(".md")
|
||||||
return File(
|
file = File(
|
||||||
path,
|
path,
|
||||||
config.docs_dir if not temp else self.temp_dir,
|
config.docs_dir if not temp else self.temp_dir,
|
||||||
config.site_dir,
|
config.site_dir,
|
||||||
config.use_directory_urls
|
config.use_directory_urls
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Hack: mark file as generated, so other plugins don't think it's part
|
||||||
|
# of the file system. This is more or less a new quasi-standard that
|
||||||
|
# still needs to be adopted by MkDocs, and was introduced by the
|
||||||
|
# git-revision-date-localized-plugin - see https://bit.ly/3ZUmdBx
|
||||||
|
if temp:
|
||||||
|
file.generated_by = "material/blog"
|
||||||
|
|
||||||
|
# Return file
|
||||||
|
return file
|
||||||
|
|
||||||
# Write the content to the file located at the given path
|
# Write the content to the file located at the given path
|
||||||
def _save_to_file(self, path: str, content: str):
|
def _save_to_file(self, path: str, content: str):
|
||||||
os.makedirs(os.path.dirname(path), exist_ok = True)
|
os.makedirs(os.path.dirname(path), exist_ok = True)
|
||||||
|
|||||||
Reference in New Issue
Block a user