Skip to content

Commit 9da5118

Browse files
Merge pull request #39 from iolanta-tech/38-start-docs-site
38 start docs site
2 parents acecdd0 + 96877bc commit 9da5118

File tree

12 files changed

+314
-1
lines changed

12 files changed

+314
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# https://blog.elmah.io/deploying-a-mkdocs-documentation-site-with-github-actions/
2+
on:
3+
push:
4+
branches: [master]
5+
6+
jobs:
7+
build:
8+
name: Deploy to GitHub pages
9+
runs-on: ubuntu-latest
10+
environment: CI
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v4
14+
with:
15+
python-version: 3.11
16+
- run: pip install -q poetry
17+
- run: poetry config virtualenvs.create false --local
18+
- run: poetry install
19+
- uses: actions/checkout@v3
20+
with:
21+
repository: iolanta-tech/mkdocs-material-insiders
22+
path: mkdocs-material-insiders
23+
token: ${{ secrets.INSIDERS_TOKEN }}
24+
25+
- run: j install-mkdocs-insiders
26+
- run: j deploy-to-github-pages

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ cython_debug/
163163
.flakeheaven_cache
164164
tests/artifacts/
165165
-tests/artifacts/.gitkeep
166+
mkdocs-material-insiders/

docs/decisions/diff-test-results.md renamed to docs/blog/diff-test-results.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Diff test results
3+
tags: [decision]
34
---
45

56
## Context

docs/blog/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
exclude_from_blog: true
3+
title: Blog
4+
hide:
5+
- navigation
6+
- toc
7+
---
8+
9+
# :material-message-text: Blog
10+
11+
{{ blog_content }}

docs/decisions/parallelize-test-branches.md renamed to docs/blog/parallelize-test-branches.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
tags: [decision]
23
is-blocked-by: diff-test-results.md
34
title: Parallelize tests per branch in GitHub actions
45
---

docs/decisions/yaml-library.md renamed to docs/blog/yaml-library.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
tags: [decision]
23
context:
34
rdfs:comment: To parse YAML-LD, we need to choose a YAML library from ones available.
45
table:columns:

docs/decisions/index.md

Whitespace-only changes.

docs/index.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: python-yaml-ld
3+
hide:
4+
- navigation
5+
- toc
6+
---
7+
8+
# YAML-LD implementation for Python
9+
10+
![](logos/python-yaml-ld.png)
11+
12+
A Python implementation for handling YAML-LD documents.
13+
14+
## What is YAML-LD?
15+
16+
YAML-LD is a YAML-based serialization for Linked Data, drawing inspiration from [JSON-LD](https://json-ld.org/). It aims to bring the ease of YAML along with the structured linked data principles of JSON-LD. The [YAML-LD specification](https://json-ld.github.io/yaml-ld/spec/) provides detailed information on the structure and usage of YAML-LD.
17+
18+
## Installation
19+
20+
```shell
21+
pip install python-yaml-ld
22+
```
23+
24+
## Functions
25+
26+
### `yaml_ld.expand`
27+
28+
Expands a given YAML-LD document into a standardized, expanded form following the [JSON-LD Expansion algorithm](https://www.w3.org/TR/json-ld11-api/#expansion).
29+
30+
- **Parameters**:
31+
- `document` (str | bytes | Document): The YAML-LD document to expand.
32+
- `base` (str | None): The base IRI to use.
33+
- `context` (Document | None): A context to expand with.
34+
- `extract_all_scripts` (bool): True to extract all JSON-LD script elements from HTML, False to extract just the first.
35+
- `mode` (ProcessingMode): The JSON-LD processing mode (defaults to JSON-LD 1.1).
36+
- `document_loader` (DocumentLoader | None): The document loader to use.
37+
38+
### `yaml_ld.to_rdf`
39+
40+
Converts the YAML-LD document to RDF (quads) form, enabling interoperability with other RDF tools and systems.
41+
42+
- **Parameters**:
43+
- `document` (str | bytes | Document): The YAML-LD document to convert.
44+
- `base` (str | None): The base IRI to use.
45+
- `document_loader` (DocumentLoader | None): The document loader to use.

jeeves.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,30 @@ def ci():
157157

158158
if newly_failed:
159159
raise typer.Exit(1)
160+
161+
162+
def serve():
163+
"""
164+
Serve the iolanta.tech site.
165+
166+
The site will be available at http://localhost:9841
167+
"""
168+
sh.mkdocs.serve(
169+
'-a', 'localhost:6453',
170+
_fg=True,
171+
)
172+
173+
174+
def install_mkdocs_insiders():
175+
"""Install Insiders version of `mkdocs-material` theme."""
176+
name = 'mkdocs-material-insiders'
177+
178+
if not (Path.cwd() / name).is_dir():
179+
sh.gh.repo.clone(f'iolanta-tech/{name}')
180+
181+
sh.pip.install('-e', name)
182+
183+
184+
def deploy_to_github_pages():
185+
"""Build the docs & deploy → gh-pages branch."""
186+
sh.mkdocs('gh-deploy', '--force', '--clean', '--verbose')

mkdocs.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
site_name: python-yaml-ld
2+
site_url: https://python-yaml-ld.iolanta.tech
3+
repo_url: https://github.com/iolanta-tech/python-yaml-ld
4+
edit_uri: edit/master/docs/
5+
repo_name: iolanta-tech/python-yaml-ld
6+
copyright: Copyright © 2024 iolanta.tech
7+
8+
markdown_extensions:
9+
- admonition
10+
- codehilite
11+
- attr_list
12+
- def_list
13+
- md_in_html
14+
- pymdownx.superfences
15+
- pymdownx.details
16+
- footnotes
17+
- pymdownx.tabbed:
18+
alternate_style: true
19+
- pymdownx.emoji:
20+
emoji_index: !!python/name:material.extensions.emoji.twemoji
21+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
22+
23+
24+
plugins:
25+
- search
26+
- awesome-pages
27+
- blogging:
28+
dirs:
29+
- blog
30+
features:
31+
tags: {}
32+
time_format: '%d %b %Y' # The format used to display the time
33+
- mkdocstrings:
34+
handlers:
35+
python:
36+
import:
37+
- https://docs.python-requests.org/en/master/objects.inv
38+
- macros:
39+
on_error_fail: true
40+
41+
theme:
42+
name: material
43+
palette:
44+
primary: orange
45+
# custom_dir: overrides
46+
features:
47+
- navigation.sections
48+
- navigation.indexes
49+
- navigation.tabs
50+
- navigation.tabs.sticky
51+
- content.code.annotate
52+
- content.action.edit

poetry.lock

Lines changed: 146 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ types-pyyaml = "^6.0.12.11"
2222
rdflib-pyld-compat = "^0.1.0"
2323
lambdas = "^0.2.0"
2424
dominate = "^2.9.1"
25+
mkdocs-awesome-pages-plugin = "^2.9.2"
26+
mkdocs-blogging-plugin = "^2.2.11"
27+
mkdocstrings-python = "^1.9.0"
2528

2629
[build-system]
2730
requires = ["poetry-core"]

0 commit comments

Comments
 (0)