Skip to content

Commit

Permalink
Properly resolve relative paths in scripts/gen_ref_nav.py
Browse files Browse the repository at this point in the history
  • Loading branch information
waylan committed Oct 27, 2023
1 parent 524e4da commit c53d5d7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ site_author: "The Python-Markdown Project"
copyright: "Copyright © 2010-2023"

use_directory_urls: true
watch: [markdown]
watch: [markdown, scripts]

theme:
name: nature
Expand Down
29 changes: 16 additions & 13 deletions scripts/gen_ref_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
"markdown": {"summary": {"attributes": True, "functions": True, "classes": True}}
}

base_path = Path(__file__).resolve().parent.parent

modules = [
Path("markdown", "__init__.py"),
Path("markdown", "preprocessors.py"),
Path("markdown", "blockparser.py"),
Path("markdown", "blockprocessors.py"),
Path("markdown", "treeprocessors.py"),
Path("markdown", "inlinepatterns.py"),
Path("markdown", "postprocessors.py"),
Path("markdown", "serializers.py"),
Path("markdown", "util.py"),
Path("markdown", "htmlparser.py"),
Path("markdown", "test_tools.py"),
*sorted(Path("markdown", "extensions").rglob("*.py")),
base_path.joinpath("markdown", "__init__.py"),
base_path.joinpath("markdown", "preprocessors.py"),
base_path.joinpath("markdown", "blockparser.py"),
base_path.joinpath("markdown", "blockprocessors.py"),
base_path.joinpath("markdown", "treeprocessors.py"),
base_path.joinpath("markdown", "inlinepatterns.py"),
base_path.joinpath("markdown", "postprocessors.py"),
base_path.joinpath("markdown", "serializers.py"),
base_path.joinpath("markdown", "util.py"),
base_path.joinpath("markdown", "htmlparser.py"),
base_path.joinpath("markdown", "test_tools.py"),
*sorted(base_path.joinpath("markdown", "extensions").rglob("*.py")),
]

for path in modules:
for src_path in modules:
path = src_path.relative_to(base_path)
module_path = path.with_suffix("")
doc_path = path.with_suffix(".md")
full_doc_path = Path("reference", doc_path)
Expand Down

0 comments on commit c53d5d7

Please sign in to comment.