Skip to content

Commit

Permalink
Merge pull request #660 from GenomicsStandardsConsortium/issue-636-part1
Browse files Browse the repository at this point in the history
Tailor MIXS docs pages based on feedback - part 1
  • Loading branch information
turbomam authored Oct 18, 2023
2 parents 54a7ae8 + b96404b commit 885b454
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 72 deletions.
42 changes: 24 additions & 18 deletions src/doc-templates/class.md.jinja2
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
{% if element.is_a == "Checklist" -%}
# Checklist: {{ gen.name(element) }}
{% elif element.is_a == "Extension" -%}
# Extension: {{ gen.name(element) }}
{% elif element.mixins and element.is_a -%}
# Combination: {{ gen.name(element) }}
{% else -%}
# Class: {{ gen.name(element) }}
{% endif %}
{%- if element.is_a == "Checklist" -%}
{%- set type = "Checklist" -%}
{%- elif element.is_a == "Extension" -%}
{%- set type = "Extension" -%}
{%- elif element.mixins and element.is_a -%}
{%- set type = "Combination" -%}
{%- else -%}
{%- set type = "Class" -%}
{%- endif -%}

{%- if element.title -%}
{%- set title = element.title ~ ' (' ~ gen.name(element) ~ ')' -%}
{%- else -%}
{%- set title = gen.name(element) -%}
{%- endif -%}

# {{ type }}: {{ title }}


{%- if header -%}
{{header}}
Expand All @@ -24,26 +33,23 @@ _{{ element_description_line }}_
* __NOTE__: this is an abstract class and should not be instantiated directly
{% endif %}

{% if schemaview.class_parents(element.name) or schemaview.class_children(element.name, mixins=False) %}

## Inheritance
{{ gen.inheritance_tree(element, mixins=True) }}
{% else %}
<!-- no inheritance hierarchy -->
{% if element.mixins and element.is_a -%}
## Composition
{{ gen.link(element.is_a) }} [Checklist] + {{ gen.link(element.mixins[0]) }} [Extension]
{% endif %}

## Terms

| Name | Cardinality and Range | Description | Inheritance |
| MIXS ID | Name | Cardinality and Range | Description |
| --- | --- | --- | --- |
{% 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.uri_link(slot) }} | {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} |
{% 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.uri_link(slot) }} | {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} |
{% endfor -%}
{% endif %}

Expand Down
54 changes: 9 additions & 45 deletions src/doc-templates/common_metadata.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,6 @@
{% endfor %}
{% endif -%}

{% if element.comments -%}
## Comments

{% for x in element.comments -%}
* {{x}}
{% endfor %}
{% endif -%}

{% if element.todos -%}
## TODOs

{% for x in element.todos -%}
* {{x}}
{% endfor %}
{% endif -%}

{% if element.see_also -%}
## See Also

Expand All @@ -41,38 +25,18 @@
{% endfor %}
{% endif -%}

## Identifier and Mapping Information

{% if element.id_prefixes %}
### Valid ID Prefixes

Instances of this class *should* have identifiers with one of the following prefixes:
{% for p in element.id_prefixes %}
* {{p}}
{% endfor %}

{% endif %}
{% set annotations_data = [] %}

{% for a in element.annotations -%}
{%- if a|string|first != '_' and element.annotations[a].value is not none and element.annotations[a].value != '' -%}
{%- set _ = annotations_data.append({'a': a, 'value': element.annotations[a].value}) -%}
{%- endif -%}
{% endfor -%}

{% if element.annotations %}
{% if annotations_data %}
### Annotations

| property | value |
| --- | --- |
{% for a in element.annotations -%}
{%- if a|string|first != '_' -%}
| {{ a }} | {{ element.annotations[a].value }} |
{%- endif -%}
{% for item in annotations_data -%}
* {{ item['a'] }}: {{ item['value'] }}
{% endfor %}
{% endif %}

{% if element.from_schema or element.imported_from %}
### Schema Source

{% if element.from_schema %}
* from schema: {{ element.from_schema }}
{% endif %}
{% if element.imported_from %}
* imported from: {{ element.imported_from }}
{% endif %}
{% endif %}
17 changes: 8 additions & 9 deletions src/doc-templates/slot.md.jinja2
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Term: {{ gen.name(element) }}
{%- if element.title %}
{%- set title = element.title ~ ' (' ~ element.name ~ ')' -%}
{%- else %}
{%- set title = gen.name(element) -%}
{%- endif -%}

# Term: {{ title }}

{%- if header -%}
{{header}}
Expand Down Expand Up @@ -26,14 +32,7 @@ URI: {{ gen.uri_link(element) }}
## Properties

* Range: {{gen.link(element.range)}}
{% if element.multivalued %}
* Multivalued: {{ element.multivalued }}
{% endif -%}
{% if element.required %}
* Required: {{ element.required }}
{% elif element.recommended %}
* Recommended: {{ element.recommended }}
{% endif -%}
* Cardinality: {{ gen.cardinality(element) }}
{% if element.minimum_value is not none %}
* Minimum Value: {{ element.minimum_value|int }}
{% endif -%}
Expand Down

0 comments on commit 885b454

Please sign in to comment.