Skip to content

Commit

Permalink
Fix docs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
nardew committed Apr 1, 2024
1 parent e903ae0 commit ff4b08f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
7 changes: 7 additions & 0 deletions docs/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
ABCD
<!-- Add announcement here, including arbitrary HTML -->
{% endblock %}

{% block outdated %}
You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}">
<strong>Click here to go to latest.</strong>
</a>
{% endblock %}
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ plugins:
signature_crossrefs: true
summary: true
- section-index
extra:
version:
provider: mike
nav:
- Home: index.md
- Getting started: getting-started.md
Expand Down
10 changes: 5 additions & 5 deletions scripts/gen_ref_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>'

root = Path(__file__).parent.parent
src = root / "src"
src = root / "talipp"

for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
doc_path = path.relative_to(src).with_suffix(".md")
module_path = path.relative_to(root).with_suffix("")
doc_path = path.relative_to(root).with_suffix(".md")
full_doc_path = Path("reference", doc_path)

parts = tuple(module_path.parts)
Expand All @@ -21,7 +21,7 @@
parts = parts[:-1]
doc_path = doc_path.with_name("index.md")
full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1].startswith("_"):
elif parts[-1] == "__main__":
continue

nav_parts = [f"{mod_symbol} {part}" for part in parts]
Expand All @@ -31,7 +31,7 @@
ident = ".".join(parts)
fd.write(f"::: {ident}")

mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
mkdocs_gen_files.set_edit_path(full_doc_path, path.relative_to(root))

with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())

0 comments on commit ff4b08f

Please sign in to comment.