|
34 | 34 | from mkdocs.structure.files import File, Files, InclusionLevel
|
35 | 35 | from mkdocs.structure.nav import Navigation, Section
|
36 | 36 | from mkdocs.structure.pages import Page
|
37 |
| -from mkdocs.utils import get_relative_url |
| 37 | +from mkdocs.utils import copy_file, get_relative_url |
38 | 38 | from paginate import Page as Pagination
|
39 | 39 | from shutil import rmtree
|
40 | 40 | from tempfile import mkdtemp
|
@@ -225,10 +225,6 @@ def on_nav(self, nav, *, config, files):
|
225 | 225 | for at in range(1, len(view.pages)):
|
226 | 226 | self._attach_at(view.parent, view, view.pages[at])
|
227 | 227 |
|
228 |
| - # Replace source file system path |
229 |
| - view.pages[at].file.src_uri = view.file.src_uri |
230 |
| - view.pages[at].file.abs_src_path = view.file.abs_src_path |
231 |
| - |
232 | 228 | # Prepare post for rendering (run later) - allow other plugins to alter
|
233 | 229 | # the contents or metadata of a post before it is rendered and make sure
|
234 | 230 | # that the post includes a separator, which is essential for rendering
|
@@ -640,6 +636,9 @@ def _generate_pages(self, view: View, config: MkDocsConfig, files: Files):
|
640 | 636 | file = self._path_to_file(path, config)
|
641 | 637 | files.append(file)
|
642 | 638 |
|
| 639 | + # Copy file to temporary directory |
| 640 | + copy_file(view.file.abs_src_path, file.abs_src_path) |
| 641 | + |
643 | 642 | # Create view and attach to previous page
|
644 | 643 | if not isinstance(file.page, View):
|
645 | 644 | yield View(None, file, config)
|
|
0 commit comments