diff --git a/.github/workflows/test_pages_build.yaml b/.github/workflows/test_pages_build.yaml
new file mode 100644
index 0000000000..b6e51b867b
--- /dev/null
+++ b/.github/workflows/test_pages_build.yaml
@@ -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
diff --git a/src/doc-templates/subset.md.jinja2 b/src/doc-templates/subset.md.jinja2
index 5e352d60a9..47a043a045 100644
--- a/src/doc-templates/subset.md.jinja2
+++ b/src/doc-templates/subset.md.jinja2
@@ -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,20 +43,18 @@ 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) %}
@@ -64,10 +62,12 @@ URI: {{ gen.link(element) }}
{%- 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) }}
{{gen.link(s.range)}} | {{s.description|enshorten}} {% if s.identifier %}**identifier**{% endif %} |
+| {{gen.link(s)}} | {{ gen.cardinality(s) }}
{{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 %}
\ No newline at end of file