Skip to content

Commit

Permalink
formatting to the classtemplate of AP
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofVDB1 committed Mar 21, 2024
1 parent 5eaf89e commit 4293639
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,16 @@ export class HtmlRespecGenerationService implements IService {
throw new Error(`Unable to find the range for subject ${subjectId.value}.`);
}

let rangeAssignedUri = this.store.getAssignedUri(range);
const rangeAssignedUri = this.store.getAssignedUri(range);

if (!rangeAssignedUri) {
this.logger.error(`Unable to find the assigned URI of range (${range.value}) of attribute ${subjectId.value}.`);
}
const type = this.fetchLabel(range);

if (!type) {
this.logger.error(`Unable to find the label of range (${range.value}) of attribute ${subjectId.value}.`);
}

return {
id: assignedUri?.value,
Expand All @@ -142,6 +147,7 @@ export class HtmlRespecGenerationService implements IService {
usageNote: usageNote?.value,
domain: domainAssignedUri?.value,
range: rangeAssignedUri?.value,
type: type?.value,
codelist: codelist?.value
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
<h2>
{{entity.label}}
{{ entity.label }}
</h2>

{% if entity.definition %}
<p>
<b>Definition</b>
</p>
<p>
{{entity.definition}}
{{ entity.definition }}
</p>
{% endif %}

{% if entity.usageNote %}
<p>
<b>Usage</b>
</p>
<p>
{{entity.usageNote}}
{{ entity.usageNote }}
</p>
{% endif %}

<p>
<b>Properties</b>
</p>
{% if entity.properties.length %}
<p>
For this entity, the following properties are defined:
For this entity, the following properties are defined:
{% for property in entity.properties %}
{% if loop.index == entity.properties.length %}
<span>{{property.label}}.</span>
<span>
<a href="#{{ entity|getAnchorTag }}.{{ property|getAnchorTag }}">{{ property.label }}</a>.
</span>
{% else %}
<span>{{property.label}},</span>
<span>
<a href="#{{ entity|getAnchorTag }}.{{ property|getAnchorTag }}">{{ property.label }}</a>&comma;
</span>
{% endif %}
{% endfor %}
</p>
Expand All @@ -39,38 +40,39 @@
No properties defined for this entity
</p>
{% endif %}


{% if entity.properties.length > 0 %}
<table>
<tr>
<th>Property</th>
<th>Type</th>
<th>Cardinality</th>
<th>Definition</th>
<th>Usage</th>
<th>Codelist</th>
</tr>

{% for property in entity.properties %}
<tr>
<td>{{property.label}}</td>
<td>{{property.range}}</td>
{% if (property.minCount == property.maxCount) %}
<td>{{ property.minCount }}</td>
{% else %}
<td>{{property.minCount}}..{{property.maxCount}}</td>
{% endif %}
<td>{{property.definition}}</td>
<td>{{property.usageNote}}</td>
{% if (property.codelist) %}
<td>
<a href="{{property.codelist}}">LINK</a>
</td>
{% else %}
<td></td>
{% endif %}
</tr>
{% endfor %}
</table>
{% endif %}
<table>
<tr>
<th>Property</th>
<th>Type</th>
<th>Cardinality</th>
<th>Definition</th>
<th>Usage</th>
<th>Codelist</th>
</tr>
{% for property in entity.properties %}
<tr>
<td id="{{ entity|getAnchorTag }}.{{ property|getAnchorTag }}">
<a href="{{ property.id }}">{{ property.label }}</a>
</td>
<td>
<a href="{{ property.range }}">{{ property.type }}</a>
</td>
{% if (property.minCount == property.maxCount) %}
<td>{{ property.minCount }}</td>
{% else %}
<td>{{ property.minCount }}..{{ property.maxCount }}</td>
{% endif %}
<td>{{ property.definition }}</td>
<td>{{ property.usageNote }}</td>
{% if (property.codelist) %}
<td>
<a href="{{ property.codelist }}">LINK</a>
</td>
{% else %}
<td></td>
{% endif %}
</tr>
{% endfor %}
</table>
{% endif %}

0 comments on commit 4293639

Please sign in to comment.