-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from EspenAlbert/docs-support
Docs support
- Loading branch information
Showing
16 changed files
with
325 additions
and
164 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: docs | ||
on: | ||
push: | ||
branches: | ||
- docs-support | ||
- main | ||
permissions: | ||
contents: write | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- uses: actions/cache@v2 | ||
with: | ||
key: ${{ github.ref }} | ||
path: .cache | ||
- run: pip install mkdocs-material | ||
- run: pip install pillow cairosvg | ||
- run: python ./pre_docs.py | ||
- run: mkdocs gh-deploy --force |
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 |
---|---|---|
|
@@ -12,3 +12,8 @@ __pycache__/ | |
# Editors | ||
.idea/ | ||
*.iml | ||
|
||
# docs | ||
site | ||
.cache | ||
docs/ |
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
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
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
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
Empty file.
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
Empty file.
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,65 @@ | ||
site_name: py-libs documentation | ||
site_url: https://espenalbert.github.io/py-libs/ | ||
theme: | ||
name: material | ||
features: | ||
- navigation.tabs | ||
- navigation.sections | ||
- toc.integrate | ||
- navigation.top | ||
- search.suggest | ||
- search.highlight | ||
- content.tabs.link | ||
- content.code.annotation | ||
- content.code.copy | ||
language: en | ||
palette: | ||
- scheme: default | ||
toggle: | ||
icon: material/toggle-switch-off-outline | ||
name: Switch to dark mode | ||
primary: teal | ||
accent: purple | ||
- scheme: slate | ||
toggle: | ||
icon: material/toggle-switch | ||
name: Switch to light mode | ||
primary: teal | ||
accent: lime | ||
|
||
plugins: | ||
- social | ||
- search | ||
|
||
repo_name: EspenAlbert/py-libs | ||
repo_url: https://github.com/EspenAlbert/py-libs | ||
edit_uri: edit/main/docs/ | ||
extra: | ||
social: | ||
- icon: fontawesome/brands/github-alt | ||
link: https://github.com/EspenAlbert | ||
|
||
nav: | ||
- Get Started: index.md | ||
- Model Lib: model_lib | ||
- Compose Chart Export: compose_chart_export | ||
- Docker Compose Parser: docker_compose_parser | ||
- zero-3rdparty: zero_3rdparty | ||
|
||
|
||
markdown_extensions: | ||
- pymdownx.highlight: | ||
anchor_linenums: true | ||
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- admonition | ||
- pymdownx.arithmatex: | ||
generic: true | ||
- footnotes | ||
- pymdownx.details | ||
- pymdownx.superfences | ||
- pymdownx.mark | ||
- attr_list | ||
- pymdownx.emoji: | ||
emoji_index: !!python/name:materialx.emoji.twemoji | ||
emoji_generator: !!python/name:materialx.emoji.to_svg |
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,34 @@ | ||
import shutil | ||
from pathlib import Path | ||
from typing import Iterable | ||
|
||
SRC = Path(__file__).parent | ||
DOCS_DIR = SRC / "docs" | ||
IGNORED_MD_DIRECTORIES = [".pytest_cache", "test", "dist"] | ||
|
||
FILENAME_RENAME = { | ||
"readme.md": "index.md" | ||
} | ||
|
||
def ignore_md_path(rel_path: str) -> bool: | ||
return any(f"{d}/" in rel_path for d in IGNORED_MD_DIRECTORIES) | ||
|
||
|
||
def add_dest_paths(src_path: Path, md_dest_path: Path) -> Iterable[Path]: | ||
if new_name := FILENAME_RENAME.get(md_dest_path.name): | ||
yield md_dest_path.parent / new_name | ||
yield md_dest_path | ||
|
||
def move_md_files(): | ||
for md_src_path in SRC.rglob("*.md"): | ||
rel_path = str(md_src_path.relative_to(SRC)) | ||
if md_src_path.is_relative_to(DOCS_DIR) or ignore_md_path(rel_path): | ||
continue | ||
md_dest_path = DOCS_DIR / rel_path | ||
for final_dest_path in add_dest_paths(md_src_path, md_dest_path): | ||
final_dest_path.parent.mkdir(parents=True, exist_ok=True) | ||
shutil.copy(md_src_path, final_dest_path) | ||
|
||
|
||
if __name__ == "__main__": | ||
move_md_files() |
Oops, something went wrong.