-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
530 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ __pycache__ | |
venv | ||
dist | ||
.vscode/PythonImportHelper-v2-Completion.json | ||
site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-24.04 | ||
tools: | ||
python: "3.12" | ||
jobs: | ||
post_create_environment: | ||
- pip install poetry | ||
post_install: | ||
# VIRTUAL_ENV needs to be set manually for now. | ||
# See https://github.com/readthedocs/readthedocs.org/pull/11152/ | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --extras docs | ||
|
||
mkdocs: | ||
configuration: mkdocs.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
site_name: MySkoda | ||
theme: | ||
name: readthedocs | ||
highlightjs: true | ||
|
||
watch: | ||
- README.md | ||
|
||
plugins: | ||
- autorefs | ||
- search | ||
- gen-files: | ||
scripts: | ||
- scripts/gen_ref_nav.py | ||
- literate-nav: | ||
nav_file: SUMMARY.md | ||
- mkdocstrings: | ||
default_handler: python | ||
handlers: | ||
python: | ||
paths: [myskoda] | ||
|
||
nav: | ||
- Home: | ||
- Overview: README.md | ||
- API reference: | ||
- myskoda: reference/ | ||
- Reverse Engineering: | ||
- MQTT: mqtt.md | ||
- Rest API: rest.md |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Generate the code reference pages and navigation.""" | ||
|
||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
nav = mkdocs_gen_files.Nav() | ||
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>' | ||
|
||
root = Path(__file__).parent.parent | ||
src = root / "myskoda" | ||
|
||
for path in sorted(src.rglob("*.py")): | ||
module_path = path.relative_to(src).with_suffix("") | ||
doc_path = path.relative_to(src).with_suffix(".md") | ||
full_doc_path = Path("reference", doc_path) | ||
|
||
parts = tuple(module_path.parts) | ||
|
||
if parts[-1] == "__init__": | ||
parts = parts[:-1] | ||
doc_path = doc_path.with_name("index.md") | ||
full_doc_path = full_doc_path.with_name("index.md") | ||
print(parts, doc_path, full_doc_path) | ||
elif parts[-1].startswith("_"): | ||
continue | ||
|
||
if len(parts) == 0: | ||
continue | ||
|
||
nav_parts = [f"{mod_symbol} {part}" for part in parts] | ||
print(nav_parts, doc_path.as_posix()) | ||
nav[tuple(nav_parts)] = doc_path.as_posix() | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
ident = ".".join(parts) | ||
fd.write(f"---\ntitle: {ident}\n---\n\n::: {ident}") | ||
|
||
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()) |