mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed info plugin to gather all files recursively
This commit is contained in:
parent
15f15068d9
commit
712bc1c137
@ -30,7 +30,6 @@ from importlib.metadata import distributions, version
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from markdown.extensions.toc import slugify
|
from markdown.extensions.toc import slugify
|
||||||
from mkdocs.plugins import BasePlugin, event_priority
|
from mkdocs.plugins import BasePlugin, event_priority
|
||||||
from mkdocs.structure.files import get_files
|
|
||||||
from mkdocs.utils import get_theme_dir
|
from mkdocs.utils import get_theme_dir
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
|
|
||||||
@ -115,15 +114,12 @@ class InfoPlugin(BasePlugin[InfoConfig]):
|
|||||||
# Create self-contained example from project
|
# Create self-contained example from project
|
||||||
files: list[str] = []
|
files: list[str] = []
|
||||||
with ZipFile(archive, "a", ZIP_DEFLATED, False) as f:
|
with ZipFile(archive, "a", ZIP_DEFLATED, False) as f:
|
||||||
for path in ["mkdocs.yml", "requirements.txt"]:
|
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
|
||||||
if os.path.isfile(path):
|
for name in filenames:
|
||||||
|
path = os.path.join(abs_root, name)
|
||||||
|
path = os.path.relpath(path, os.path.curdir)
|
||||||
f.write(path, os.path.join(example, path))
|
f.write(path, os.path.join(example, path))
|
||||||
|
|
||||||
# Append all files visible to MkDocs
|
|
||||||
for file in get_files(config):
|
|
||||||
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
|
||||||
f.write(path, os.path.join(example, path))
|
|
||||||
|
|
||||||
# Add information on installed packages
|
# Add information on installed packages
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(example, "requirements.lock.txt"),
|
os.path.join(example, "requirements.lock.txt"),
|
||||||
|
@ -30,7 +30,6 @@ from importlib.metadata import distributions, version
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from markdown.extensions.toc import slugify
|
from markdown.extensions.toc import slugify
|
||||||
from mkdocs.plugins import BasePlugin, event_priority
|
from mkdocs.plugins import BasePlugin, event_priority
|
||||||
from mkdocs.structure.files import get_files
|
|
||||||
from mkdocs.utils import get_theme_dir
|
from mkdocs.utils import get_theme_dir
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
|
|
||||||
@ -115,15 +114,12 @@ class InfoPlugin(BasePlugin[InfoConfig]):
|
|||||||
# Create self-contained example from project
|
# Create self-contained example from project
|
||||||
files: list[str] = []
|
files: list[str] = []
|
||||||
with ZipFile(archive, "a", ZIP_DEFLATED, False) as f:
|
with ZipFile(archive, "a", ZIP_DEFLATED, False) as f:
|
||||||
for path in ["mkdocs.yml", "requirements.txt"]:
|
for abs_root, dirnames, filenames in os.walk(os.getcwd()):
|
||||||
if os.path.isfile(path):
|
for name in filenames:
|
||||||
|
path = os.path.join(abs_root, name)
|
||||||
|
path = os.path.relpath(path, os.path.curdir)
|
||||||
f.write(path, os.path.join(example, path))
|
f.write(path, os.path.join(example, path))
|
||||||
|
|
||||||
# Append all files visible to MkDocs
|
|
||||||
for file in get_files(config):
|
|
||||||
path = os.path.relpath(file.abs_src_path, os.path.curdir)
|
|
||||||
f.write(path, os.path.join(example, path))
|
|
||||||
|
|
||||||
# Add information on installed packages
|
# Add information on installed packages
|
||||||
f.writestr(
|
f.writestr(
|
||||||
os.path.join(example, "requirements.lock.txt"),
|
os.path.join(example, "requirements.lock.txt"),
|
||||||
|
Loading…
Reference in New Issue
Block a user