From edb63a313b1f3d770a4ba84112ddba7c61730f35 Mon Sep 17 00:00:00 2001 From: garthompson Date: Thu, 7 Sep 2023 18:20:45 +0100 Subject: [PATCH] Only exclude mkdocs config YAML files. (#117) * Only exclude mkdocs config YAML files. There was a blanket exclusion of all YAML files introduced to fix issue #9. There are certain use-cases where non-mkdocs YAML files should be included in the documentation - e.g. OpenAPI spec files. This change only excludes YAML files that are marked as mkdocs config file for the repo being imported. This passes the existing test "Make sure imported repo's mkdocs.yml isn't in build output". Fix for issue #107 * Dummy commit to force PR check re-runs * Revert dummy commit * Update version and changelog --------- Co-authored-by: Joseph Doiron <57968347+jdoiro3@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ mkdocs_multirepo_plugin/plugin.py | 5 ++++- mkdocs_multirepo_plugin/structure.py | 4 ++++ pyproject.toml | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eb2e5a..ec33aa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.6.3 + +### Prs in Release + +- [Only exclude mkdocs config YAML files.](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/117) + ## 0.6.2 ### Prs in Release diff --git a/mkdocs_multirepo_plugin/plugin.py b/mkdocs_multirepo_plugin/plugin.py index 626f484..d3b0696 100644 --- a/mkdocs_multirepo_plugin/plugin.py +++ b/mkdocs_multirepo_plugin/plugin.py @@ -321,8 +321,11 @@ def on_files(self, files: Files, config: Config) -> Files: repo_files: List[File] for repo in self.repos.values(): repo_files = get_files(config, repo) + repo_config_path = repo.config_path for f in repo_files: - if not is_yaml_file(f): + if f.src_path == repo_config_path: + log.info(f"Multirepo plugin is not copying config file: {f.src_path}") + else: # the file needs to know about the repo it belongs to f.repo = repo files.append(f) diff --git a/mkdocs_multirepo_plugin/structure.py b/mkdocs_multirepo_plugin/structure.py index 2d0d064..8a81603 100644 --- a/mkdocs_multirepo_plugin/structure.py +++ b/mkdocs_multirepo_plugin/structure.py @@ -300,6 +300,10 @@ def __eq__(self, other): def name_length(self): return len(Path(self.name).parts) + @property + def config_path(self): + return os.path.join(self.name, self.config) + def keep_docs_dir(self, global_keep_docs_dir: bool = False): if self._keep_docs_dir is None: return global_keep_docs_dir diff --git a/pyproject.toml b/pyproject.toml index f8df0b6..0af96d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mkdocs-multirepo-plugin" -version = "0.6.2" +version = "0.6.3" description = "Build documentation in multiple repos into one site." authors = ["jdoiro3 "] license = "MIT"