Skip to content

Commit

Permalink
splits formats by , and improve display (#1015)
Browse files Browse the repository at this point in the history
resolves #1011
  • Loading branch information
pvgenuchten authored Sep 17, 2024
1 parent efddd6a commit 75738da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pycsw/ogc/api/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ def record2json(record, url, collection, mode='ogcapi-records'):
record_dict['properties']['description'] = record.abstract

if record.format:
record_dict['properties']['formats'] = [{'name': record.format}]
record_dict['properties']['formats'] = [{'name': f} for f in record.format.split(',') if len(f) > 1]

if record.keywords:
record_dict['properties']['keywords'] = [x for x in record.keywords.split(',')]
Expand Down
10 changes: 9 additions & 1 deletion pycsw/ogc/api/templates/item.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,22 @@ <h2>{{ data.get('properties',{}).get('title',data['id']) }}</h2>
{% for key, value in data['properties'].items() %}
<tr>
<td>{{ key | capitalize }}</td>
{% if key == 'keywords' or key == 'formats' %}
{% if key == 'keywords' %}
<td>
<ul>
{% for keyword in value %}
<li>{{ keyword }}</li>
{% endfor %}
</ul>
</td>
{% elif key == 'formats' %}
<td>
<ul>
{% for f in value %}
<li>{{ f.get('name') }}</li>
{% endfor %}
</ul>
</td>
{% elif key == 'themes' %}
<td>
{% for theme in value %}
Expand Down

0 comments on commit 75738da

Please sign in to comment.