Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub workflow to preview documentation changes/builds with example changes #2057

Merged
merged 2 commits into from
Jun 12, 2024
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/test_pages_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Preview documentation build

on:
pull_request:
types:
- opened
- reopened
- synchronize

concurrency: preview-${{ github.ref }}

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.3.2

- name: Install dependencies
run: poetry install -E docs

- name: Build documentation
run: |
mkdir -p site
touch site/.nojekyll
make gendoc
poetry run mkdocs build -d site
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: site/
preview-branch: gh-pages
20 changes: 10 additions & 10 deletions src/doc-templates/subset.md.jinja2
Original file line number Diff line number Diff line change
@@ -20,13 +20,13 @@ URI: {{ gen.link(element) }}
{% set enums_in_subset = [] %}

{# Collect classes, slots, and enumerations in subset #}
{% for c in gen.all_class_objects() %}
{% for c in gen.all_class_objects()|sort(attribute=sort_by) %}
{%- if element.name in c.in_subset %}
{% set _ = classes_in_subset.append(c) %}
{%- endif %}
{% endfor %}

{% for s in gen.all_slot_objects() %}
{% for s in gen.all_slot_objects()|sort(attribute=sort_by) %}
{%- if element.name in s.in_subset %}
{% set _ = slots_in_subset.append(s) %}
{%- endif %}
@@ -43,31 +43,31 @@ URI: {{ gen.link(element) }}

| Class | Description |
| --- | --- |
{% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
{% for c in classes_in_subset -%}
{%- if element.name in c.in_subset -%}
| {{gen.link(c)}} | {{c.description|enshorten}} |
{% endif -%}
{% endfor %}

{% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
{% for c in classes_in_subset -%}
{%- if element.name in c.in_subset -%}
### {{ gen.name(c) }}

{{c.description}}
{% set induced_slots = gen.class_induced_slots(c.name)|sort(attribute=sort_by) %}

{%- set filtered_slots = [] -%}

{%- for s in induced_slots|sort(attribute=sort_by) -%}
{%- if element.name in s.in_subset or element.name in schemaview.get_slot(s.name).in_subset -%}
{% set _ = filtered_slots.append(s) %}
{%- endif -%}
{%- endfor %}

{%- if filtered_slots|length > 0 -%}
| Name | Cardinality and Range | Description |
### Slots from {{ gen.link(c) }} also in _{{ element.name }}_

| Name | Cardinality and Range | Description |
| --- | --- | --- |
{% for s in filtered_slots -%}
| {{gen.link(s)}} | {{ gen.cardinality(s) }} <br/> {{gen.link(s.range)}} | {{s.description|enshorten}} {% if s.identifier %}**identifier**{% endif %} |
| {{gen.link(s)}} | {{ gen.cardinality(s) }} <br/> {{gen.link(s.range)}} | {{s.description|enshorten}} {% if s.identifier %}**identifier**{% endif %} |
{% endfor %}
{%- endif %}

@@ -103,4 +103,4 @@ URI: {{ gen.link(element) }}
{%- endif %}
{% endfor %}

{%- endif %}
{%- endif %}
Loading