From 0003a874db72043d376954b1696e8b4439022cca Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 4 Nov 2024 15:43:55 +0000 Subject: [PATCH] fix: Don't crash on rebuild in watch mode. (#31) Removes a block of code from mkdocs_simple_plugin of dubious purpose that crashes any time it triggers. All tests pass without. Resolves #30. Reviewed-on: https://code.studioinfinity.org/glen/mkdocs-semiliterate/pulls/31 Co-authored-by: Glen Whitney Co-committed-by: Glen Whitney --- mkdocs_semiliterate/plugin.py | 13 ++++++------- setup.cfg | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mkdocs_semiliterate/plugin.py b/mkdocs_semiliterate/plugin.py index f57c8e5..0049f77 100644 --- a/mkdocs_semiliterate/plugin.py +++ b/mkdocs_semiliterate/plugin.py @@ -375,7 +375,9 @@ terminate: '^\s*\)' # Override rather than extend so that we use Semisimple instead of simple # Note code must track mkdocs_simple_plugin, with the added section for - # the custom_dir at the bottom. + # the custom_dir at the bottom. Also removed a section about removing + # files from the docs dir if not merging; it was unclear how it was + # supposed to work, and it would crash whenever it triggered anyway. def on_files(self, files: Files, /, *, config: MkDocsConfig): """Update files based on plugin settings.""" @@ -388,12 +390,9 @@ terminate: '^\s*\)' self.dirty, self.last_build_time, do_copy) self.last_build_time = time.time() - if not self.config["merge_docs_dir"]: - # If not merging, remove files that are from the docs dir - abs_docs_dir = os.path.abspath(config['docs_dir']) - for _, file in files.src_uris.items(): - if file.abs_src_path.startswith(abs_docs_dir): - files.remove(file) + # Code section from mkdocs_simple_plugin has been CUT FROM HERE + # If not merging, remove files that are from the docs dir + # End of CUT FROM HERE for path in self.paths: file = File( diff --git a/setup.cfg b/setup.cfg index 767e47f..fae171a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs-semiliterate -version = 0.8.2 +version = 0.8.3 description = Extension of mkdocs-simple-plugin adding easy content inclusion long_description = file: README.md long_description_content_type = text/markdown