From f46a43b9e3937ba1e5fe9634cbf874e9c647af4b Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Wed, 8 Jan 2025 15:33:03 +0100 Subject: [PATCH 1/4] Add support for section_path in nav_repos --- README.md | 2 ++ mkdocs_multirepo_plugin/plugin.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index efd0183..2392821 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,8 @@ plugins: - name: fast-api import_url: https://github.com/tiangolo/fastapi imports: [docs/en/docs/index.md] + # Puts the repo in the modules/fast-api directory + section_path: modules nav: - Backstage: diff --git a/mkdocs_multirepo_plugin/plugin.py b/mkdocs_multirepo_plugin/plugin.py index bda458f..ab9efad 100644 --- a/mkdocs_multirepo_plugin/plugin.py +++ b/mkdocs_multirepo_plugin/plugin.py @@ -52,7 +52,7 @@ class NavRepoConfig: name: str import_url: str imports: List[str] = field(default_factory=list) - + section_path: Optional[str] = None @dataclass class MultirepoConfig: @@ -247,7 +247,10 @@ def handle_nav_repos_import( docs_repo_objs: List[DocsRepo] = [] for nr in nav_repos: import_stmt = parse_repo_url(nr.import_url) - name: str = slugify(nr.name) + section_slug: str = slugify(nr.name) + path = repo.section_path + name = f"{path}/{section_slug}" if path is not None else section_slug + # mkdocs config values edit_uri and repo_url aren't set if need_to_derive_edit_uris: derived_edit_uri = self.derive_config_edit_uri( From 78116ecb59dd9ce60373558ecd6eeeb47fcd1269 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Thu, 9 Jan 2025 15:51:54 +0100 Subject: [PATCH 2/4] Add project metadata for pip installer --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8db4faa..d41ce8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[project] +name = "mkdocs-multirepo-plugin" + [tool.poetry] name = "mkdocs-multirepo-plugin" version = "0.8.3" From 24faec0763cd77be2ac08ce736ea6a4f39769611 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Thu, 9 Jan 2025 15:56:57 +0100 Subject: [PATCH 3/4] Bump version, add changelog entry --- CHANGELOG.md | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0801153..24cc42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.8.4 + +### Prs in Release + +- [Support for `section_path` in `nav_repos`](https://github.com/jdoiro3/mkdocs-multirepo-plugin/pull/169) + ## 0.8.3 ### Prs in Release diff --git a/pyproject.toml b/pyproject.toml index d41ce8c..ffc37ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "mkdocs-multirepo-plugin" [tool.poetry] name = "mkdocs-multirepo-plugin" -version = "0.8.3" +version = "0.8.4" description = "Build documentation in multiple repos into one site." authors = ["jdoiro3 "] license = "MIT" From c534291ca35f7acccaf517616c5f3b73c7fdf961 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Thu, 9 Jan 2025 15:58:57 +0100 Subject: [PATCH 4/4] Fix the variable name --- mkdocs_multirepo_plugin/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs_multirepo_plugin/plugin.py b/mkdocs_multirepo_plugin/plugin.py index ab9efad..117b94c 100644 --- a/mkdocs_multirepo_plugin/plugin.py +++ b/mkdocs_multirepo_plugin/plugin.py @@ -248,7 +248,7 @@ def handle_nav_repos_import( for nr in nav_repos: import_stmt = parse_repo_url(nr.import_url) section_slug: str = slugify(nr.name) - path = repo.section_path + path = nr.section_path name = f"{path}/{section_slug}" if path is not None else section_slug # mkdocs config values edit_uri and repo_url aren't set