fix: Don't crash on rebuild in watch mode.

Removes a block of code from mkdocs_simple_plugin of dubious purpose
  that crashes any time it triggers. All tests pass without.

  Resolves #30.
This commit is contained in:
Glen Whitney 2024-11-04 07:41:14 -08:00
parent 59fb270c60
commit a7a9e89984
2 changed files with 7 additions and 8 deletions

View File

@ -375,7 +375,9 @@ terminate: '^\s*\)'
# Override rather than extend so that we use Semisimple instead of simple # Override rather than extend so that we use Semisimple instead of simple
# Note code must track mkdocs_simple_plugin, with the added section for # 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, /, *, def on_files(self, files: Files, /, *,
config: MkDocsConfig): config: MkDocsConfig):
"""Update files based on plugin settings.""" """Update files based on plugin settings."""
@ -388,12 +390,9 @@ terminate: '^\s*\)'
self.dirty, self.last_build_time, do_copy) self.dirty, self.last_build_time, do_copy)
self.last_build_time = time.time() self.last_build_time = time.time()
if not self.config["merge_docs_dir"]: # Code section from mkdocs_simple_plugin has been CUT FROM HERE
# If not merging, remove files that are from the docs dir # If not merging, remove files that are from the docs dir
abs_docs_dir = os.path.abspath(config['docs_dir']) # End of CUT FROM HERE
for _, file in files.src_uris.items():
if file.abs_src_path.startswith(abs_docs_dir):
files.remove(file)
for path in self.paths: for path in self.paths:
file = File( file = File(

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = mkdocs-semiliterate name = mkdocs-semiliterate
version = 0.8.2 version = 0.8.3
description = Extension of mkdocs-simple-plugin adding easy content inclusion description = Extension of mkdocs-simple-plugin adding easy content inclusion
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown