|
30 | 30 | from io import BytesIO |
31 | 31 | from markdown.extensions.toc import slugify |
32 | 32 | from mkdocs.plugins import BasePlugin, event_priority |
33 | | -from mkdocs.structure.files import get_files |
34 | 33 | from mkdocs.utils import get_theme_dir |
35 | 34 | from zipfile import ZipFile, ZIP_DEFLATED |
36 | 35 |
|
@@ -115,15 +114,12 @@ def on_config(self, config): |
115 | 114 | # Create self-contained example from project |
116 | 115 | files: list[str] = [] |
117 | 116 | with ZipFile(archive, "a", ZIP_DEFLATED, False) as f: |
118 | | - for path in ["mkdocs.yml", "requirements.txt"]: |
119 | | - if os.path.isfile(path): |
| 117 | + for abs_root, dirnames, filenames in os.walk(os.getcwd()): |
| 118 | + for name in filenames: |
| 119 | + path = os.path.join(abs_root, name) |
| 120 | + path = os.path.relpath(path, os.path.curdir) |
120 | 121 | f.write(path, os.path.join(example, path)) |
121 | 122 |
|
122 | | - # Append all files visible to MkDocs |
123 | | - for file in get_files(config): |
124 | | - path = os.path.relpath(file.abs_src_path, os.path.curdir) |
125 | | - f.write(path, os.path.join(example, path)) |
126 | | - |
127 | 123 | # Add information on installed packages |
128 | 124 | f.writestr( |
129 | 125 | os.path.join(example, "requirements.lock.txt"), |
|
0 commit comments