Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/docs_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Write version to conf.py
run: |
echo -e "version = release = \"latest\"\n" | cat - docs/conf.py > /tmp/conf.py && mv /tmp/conf.py docs/conf.py
- name: Run kroki with docker
run: |
docker compose up -d
- name: Build the documentation
uses: sphinx-notes/pages@v2
# Note: This action has a newer version (v3 atm), but it doesn't has the feature to specify the target path.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ jobs:
run: |
echo -e "version = release = \"${{ github.ref_name }}\"\n" | cat - docs/conf.py > /tmp/conf.py
mv /tmp/conf.py docs/conf.py
- name: Run kroki with docker
run: |
docker compose up -d
- name: Build the documentation
uses: sphinx-notes/pages@v2
# Note: This action has a newer version (v3 atm), but it doesn't has the feature to specify the target path.
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run kroki with docker
run: |
docker compose up -d
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3"
services:
core:
image: yuzutech/kroki
ports:
- "8000:8000"
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,5 +311,5 @@
uml.write_class_umls(_network, _namespaces_to_parse, Path(output_dir) / "uml")
print("Created uml files.")

uml.compile_files_kroki(Path(output_dir) / "uml", Path(output_dir).parent / "_static" / "images")
uml.compile_files_kroki(Path(output_dir) / "uml", Path(output_dir).parent / "_static" / "images", locally_hosted=True)
print(f"Compiled uml files into svg using kroki.")
7 changes: 5 additions & 2 deletions docs/uml.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,15 @@ def _recursive_add_class(
# ------------------------------------------------------------------------------------------------------------------


def compile_files_kroki(input_dir: Path, output_dir: Path) -> None:
def compile_files_kroki(input_dir: Path, output_dir: Path, locally_hosted: bool = False) -> None:
"""
Compiles all plantuml files inside `input_dir` (recursive) to svg's in `output_dir` with the same subpath as in
`input_dir`. Files are compiled using web service of [kroki](https://kroki.io)
"""
url = "https://kroki.io"
if locally_hosted:
url = "http://localhost:8000"
else:
url = "https://kroki.io"
for root, _, files in os.walk(input_dir):
for file in files:
with open(os.path.join(root, file), "r", encoding="utf-8") as uml_file:
Expand Down