Skip to content

Commit 885b454

Browse files
authored
Merge pull request #660 from GenomicsStandardsConsortium/issue-636-part1
Tailor MIXS docs pages based on feedback - part 1
2 parents 54a7ae8 + b96404b commit 885b454

File tree

3 files changed

+41
-72
lines changed

3 files changed

+41
-72
lines changed

src/doc-templates/class.md.jinja2

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
{% if element.is_a == "Checklist" -%}
2-
# Checklist: {{ gen.name(element) }}
3-
{% elif element.is_a == "Extension" -%}
4-
# Extension: {{ gen.name(element) }}
5-
{% elif element.mixins and element.is_a -%}
6-
# Combination: {{ gen.name(element) }}
7-
{% else -%}
8-
# Class: {{ gen.name(element) }}
9-
{% endif %}
1+
{%- if element.is_a == "Checklist" -%}
2+
{%- set type = "Checklist" -%}
3+
{%- elif element.is_a == "Extension" -%}
4+
{%- set type = "Extension" -%}
5+
{%- elif element.mixins and element.is_a -%}
6+
{%- set type = "Combination" -%}
7+
{%- else -%}
8+
{%- set type = "Class" -%}
9+
{%- endif -%}
10+
11+
{%- if element.title -%}
12+
{%- set title = element.title ~ ' (' ~ gen.name(element) ~ ')' -%}
13+
{%- else -%}
14+
{%- set title = gen.name(element) -%}
15+
{%- endif -%}
16+
17+
# {{ type }}: {{ title }}
18+
1019

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

27-
{% if schemaview.class_parents(element.name) or schemaview.class_children(element.name, mixins=False) %}
28-
29-
## Inheritance
30-
{{ gen.inheritance_tree(element, mixins=True) }}
31-
{% else %}
32-
<!-- no inheritance hierarchy -->
36+
{% if element.mixins and element.is_a -%}
37+
## Composition
38+
{{ gen.link(element.is_a) }} [Checklist] + {{ gen.link(element.mixins[0]) }} [Extension]
3339
{% endif %}
3440

3541
## Terms
3642

37-
| Name | Cardinality and Range | Description | Inheritance |
43+
| MIXS ID | Name | Cardinality and Range | Description |
3844
| --- | --- | --- | --- |
3945
{% if gen.get_direct_slots(element)|length > 0 %}
4046
{%- for slot in gen.get_direct_slots(element) -%}
41-
| {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} | direct |
47+
| {{ gen.uri_link(slot) }} | {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} |
4248
{% endfor -%}
4349
{% endif -%}
4450
{% if gen.get_indirect_slots(element)|length > 0 %}
4551
{%- for slot in gen.get_indirect_slots(element) -%}
46-
| {{ 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(', ') }} |
52+
| {{ gen.uri_link(slot) }} | {{ gen.link(slot) }} | {{ gen.cardinality(slot) }} <br/> {{ gen.link(slot.range) }} | {{ slot.description|enshorten }} |
4753
{% endfor -%}
4854
{% endif %}
4955

src/doc-templates/common_metadata.md.jinja2

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,6 @@
1717
{% endfor %}
1818
{% endif -%}
1919

20-
{% if element.comments -%}
21-
## Comments
22-
23-
{% for x in element.comments -%}
24-
* {{x}}
25-
{% endfor %}
26-
{% endif -%}
27-
28-
{% if element.todos -%}
29-
## TODOs
30-
31-
{% for x in element.todos -%}
32-
* {{x}}
33-
{% endfor %}
34-
{% endif -%}
35-
3620
{% if element.see_also -%}
3721
## See Also
3822

@@ -41,38 +25,18 @@
4125
{% endfor %}
4226
{% endif -%}
4327

44-
## Identifier and Mapping Information
4528

46-
{% if element.id_prefixes %}
47-
### Valid ID Prefixes
48-
49-
Instances of this class *should* have identifiers with one of the following prefixes:
50-
{% for p in element.id_prefixes %}
51-
* {{p}}
52-
{% endfor %}
53-
54-
{% endif %}
29+
{% set annotations_data = [] %}
5530

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

57-
{% if element.annotations %}
37+
{% if annotations_data %}
5838
### Annotations
59-
60-
| property | value |
61-
| --- | --- |
62-
{% for a in element.annotations -%}
63-
{%- if a|string|first != '_' -%}
64-
| {{ a }} | {{ element.annotations[a].value }} |
65-
{%- endif -%}
39+
{% for item in annotations_data -%}
40+
* {{ item['a'] }}: {{ item['value'] }}
6641
{% endfor %}
6742
{% endif %}
68-
69-
{% if element.from_schema or element.imported_from %}
70-
### Schema Source
71-
72-
{% if element.from_schema %}
73-
* from schema: {{ element.from_schema }}
74-
{% endif %}
75-
{% if element.imported_from %}
76-
* imported from: {{ element.imported_from }}
77-
{% endif %}
78-
{% endif %}

src/doc-templates/slot.md.jinja2

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# Term: {{ gen.name(element) }}
1+
{%- if element.title %}
2+
{%- set title = element.title ~ ' (' ~ element.name ~ ')' -%}
3+
{%- else %}
4+
{%- set title = gen.name(element) -%}
5+
{%- endif -%}
6+
7+
# Term: {{ title }}
28

39
{%- if header -%}
410
{{header}}
@@ -26,14 +32,7 @@ URI: {{ gen.uri_link(element) }}
2632
## Properties
2733

2834
* Range: {{gen.link(element.range)}}
29-
{% if element.multivalued %}
30-
* Multivalued: {{ element.multivalued }}
31-
{% endif -%}
32-
{% if element.required %}
33-
* Required: {{ element.required }}
34-
{% elif element.recommended %}
35-
* Recommended: {{ element.recommended }}
36-
{% endif -%}
35+
* Cardinality: {{ gen.cardinality(element) }}
3736
{% if element.minimum_value is not none %}
3837
* Minimum Value: {{ element.minimum_value|int }}
3938
{% endif -%}

0 commit comments

Comments
 (0)