-
-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Hi,
at first, thanks for great plugin. I'd like just to notify to one small bug regarding the coexistence of multirepo and awesome-pages plugin.
I have a doc project aggregating documentation from multiple projects, say, project1 and project2.
All projects' documentation structure is determined by directory structure and all projects use mkdocs-awesome-pages-plugin (i.e. structure of particular node of documentation tree is configured locally by .pages file, rather than globally by listing whole tree into mkdocs.yml).
The mkdocs.yml of docs project is as follows:
...
plugins:
multirepo:
cleanup: false
keep_docs_dir: false
repos:
- section: project1
import_url: 'https://gitlab.intranet/project1?branch=main'
- section: project2
import_url: 'https://gitlab.intranet/project2?branch=main'
The content of doc/docs/.pages file is as follows:
nav:
- Overview of all: index.md
- Project1 documentation: project1
- Project2 documentation: project2
The structure of project1 (and similarly project2) is as follows:
project1
|- docs
| |- index.md
| |- .pages
| |- subtree11
| | |- index.md
| | |- .pages
...
The content of project1/docs/.pages file is as follows:
nav:
- Overview: index.md
- 'Bobs chapter': subtree11
- 'Alices chapter': subtree12
The problem
When I build documentation of doc project, then
- the main menu in left sidebar renders correctly (i.e. Overview of all, Project1 documentation, Project2 documentation)
- the root menu of concrete projects renders wrong (i.e. Index, Subtree11, Subtree12 instead of correct Overview, Bobs chapter, Alices chapter)
- the submenus of concrete projects render correctly again (i.e. honor their
.pagesfiles)
Diagnostics
Looking into temp_dir (which I intentionally don't cleanup for debugging purposes), I realized the .pages file seems not to be git cloned into root directory of each project. On the contrary, inner directories contain this file. Further investigation shows that the project was cloned correctly and also the sparse checkout was successful. The root cause is in mv_docs_up.sh shell script. When the docs directory is "flattened", its content is moved up using command mv "$1"/* . which ignores files beginning with dot. Subsequent rm -rf deletes them hence the files are effectively lost.
Workaround
It is possible to (both verified):
- either reconfigure mkdocs-awesome-pages-plugin to use file without dot instead of
.pages(works but it is unconventional) - or tweak plugin - fix
mv_docs_up.shfile usingsed -i "s|mv \"\$1\"/\* .|(shopt -s dotglob; mv \"\$1\"/* .)|g" /usr/local/lib/python3.11/site-packages/mkdocs_multirepo_plugin/scripts/mv_docs_up.shbefore invoking build (shopt is relatively reliable method)
Proposal
Since I believe omitting .dotted files was not intention, I suggest to include setting globbing around mv command into mv_docs_up.sh file.