Skip to content

Commit

Permalink
Merge pull request #109 from microbiomedata/class-jinja-update
Browse files Browse the repository at this point in the history
Use of `any_of` construct on slot ranges was not reflecting on class doc pages
  • Loading branch information
turbomam committed Mar 29, 2024
2 parents 5026c97 + 7efa566 commit 80438af
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/doc-templates/class.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
{%- endif -%}
{%- endif -%}

{% macro compute_range(slot) -%}
{%- if slot.any_of or slot.exactly_one_of -%}
{%- for subslot_range in schemaview.slot_range_as_union(slot) -%}
{{ gen.link(subslot_range) }}
{%- if not loop.last -%}
&nbsp;or&nbsp;<br />
{%- endif -%}
{%- endfor -%}
{%- else -%}
{{ gen.link(slot.range) }}
{%- endif -%}
{% endmacro %}

# Class: {{ title }}

{%- if header -%}
Expand Down Expand Up @@ -52,12 +65,12 @@ URI: {{ gen.uri_link(element) }}
| --- | --- | --- | --- |
{% if gen.get_direct_slots(element)|length > 0 %}
{%- for slot in gen.get_direct_slots(element) -%}
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} | direct |
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ compute_range(slot) }} | {{ slot.description|enshorten }} | direct |
{% endfor -%}
{% endif -%}
{% if gen.get_indirect_slots(element)|length > 0 %}
{%- for slot in gen.get_indirect_slots(element) -%}
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} | {{ gen.links(gen.get_slot_inherited_from(element.name, slot.name))|join(', ') }} |
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ compute_range(slot) }} | {{ slot.description|enshorten }} | {{ gen.links(gen.get_slot_inherited_from(element.name, slot.name))|join(', ') }} |
{% endfor -%}
{% endif %}

Expand Down

0 comments on commit 80438af

Please sign in to comment.