Skip to content

Commit

Permalink
Merge pull request #2057 from microbiomedata/issue-1588
Browse files Browse the repository at this point in the history
GitHub workflow to preview documentation changes/builds with example changes
  • Loading branch information
turbomam committed Jun 12, 2024
2 parents 46750c0 + 124c6be commit 5ad6eef
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
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/checkout@v3.1.0
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
Expand Up @@ -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 %}
Expand All @@ -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 %}

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

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

0 comments on commit 5ad6eef

Please sign in to comment.