Skip to content

Commit

Permalink
Merge pull request #241 from tdwg/metadata_changes
Browse files Browse the repository at this point in the history
Metadata changes (v0.4)
  • Loading branch information
peterdesmet authored Oct 10, 2022
2 parents 08d9c26 + 53cec89 commit 36984a4
Show file tree
Hide file tree
Showing 11 changed files with 426 additions and 331 deletions.
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GEM
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.7.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
coffee-script (2.4.1)
coffee-script-source
Expand All @@ -15,7 +15,7 @@ GEM
colorator (1.1.0)
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.8)
concurrent-ruby (1.1.9)
dnsruby (1.61.5)
simpleidn (~> 0.1)
em-websocket (0.5.2)
Expand All @@ -30,7 +30,7 @@ GEM
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
ffi (1.14.2)
ffi (1.15.4)
forwardable-extended (2.6.0)
gemoji (3.0.1)
github-pages (211)
Expand Down Expand Up @@ -200,7 +200,7 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.4.1)
listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
Expand All @@ -219,10 +219,10 @@ GEM
forwardable-extended (~> 2.6)
public_suffix (3.1.1)
racc (1.5.2)
rb-fsevent (0.10.4)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rexml (3.2.5)
rouge (3.26.0)
ruby-enum (0.9.0)
i18n
Expand Down
3 changes: 2 additions & 1 deletion _config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ github_username: tdwg/camtrap-dp

# THEME SETTINGS
theme: minima
remote_theme: peterdesmet/petridish
remote_theme: peterdesmet/petridish@2.0
colors:
links: "#ca6500" # TDWG orange
banner: "#617694" # TDWG blue
footer: "#617694" # TDWG blue
font_serif: false

# BUILD SETTINGS
markdown: kramdown
Expand Down
162 changes: 79 additions & 83 deletions _layouts/profile.html
Original file line number Diff line number Diff line change
@@ -1,96 +1,92 @@
---
layout: base
layout: default
---

<div class="row">
<div class="col">
{{ content }}

{{ content }}
{% assign profile_file = "camtrap-dp-profile" %}
{% assign properties1 = site.data[profile_file].allOf[1].properties %}
{% assign required1 = site.data[profile_file].allOf[1].required %}

{% assign profile_file = "camtrap-dp-profile" %}
{% assign properties1 = site.data[profile_file].allOf[1].properties %}
{% assign required1 = site.data[profile_file].allOf[1].required %}
<p class="small">Source: <a href="https://github.com/{{ site.github_username }}/blob/main/{{ profile_file }}.json"><code>{{ profile_file }}.json</code></a></p>

<p class="small">Source: <a href="https://github.com/{{ site.github_username }}/blob/main/{{ profile_file }}.json"><code>{{ profile_file }}.json</code></a></p>
{% for p1_raw in properties1 %}
{% assign p1_name = p1_raw[0] %}
{% assign p1 = p1_raw[1] %}
{% assign p1_id = p1_name | downcase | url_encode %}

<h2 id="{{ p1_id }}">
{{ p1_name }}
{% if required1 contains p1_name %}*{% endif %}
</h2>

{% for p1_raw in properties1 %}
{% assign p1_name = p1_raw[0] %}
{% assign p1 = p1_raw[1] %}
{% assign p1_id = p1_name | downcase | url_encode %}

<h2 id="{{ p1_id }}">
{{ p1_name }}
{% if required1 contains p1_name %}*{% endif %}
</h2>
{{ p1.description | markdownify }}

{{ p1.description | markdownify }}
{% if p1['skos:exactMatch'] %}
<p class="small text-muted">Same as <a href="{{ p1['skos:exactMatch'] }}">{{ p1['skos:exactMatch'] }}</a></p>
{% elsif p1['skos:narrowMatch'] %}
<p class="small text-muted">Narrower than <a href="{{ p1['skos:narrowMatch'] }}">{{ p1['skos:narrowMatch'] }}</a></p>
{% elsif p1['skos:broadMatch'] %}
<p class="small text-muted">Broader than <a href="{{ p1['skos:broadMatch'] }}">{{ p1['skos:broadMatch'] }}</a></p>
{% endif %}

{% if p1['skos:exactMatch'] %}
<p class="small text-muted">Same as <a href="{{ p1['skos:exactMatch'] }}">{{ p1['skos:exactMatch'] }}</a></p>
{% elsif p1['skos:narrowMatch'] %}
<p class="small text-muted">Narrower than <a href="{{ p1['skos:narrowMatch'] }}">{{ p1['skos:narrowMatch'] }}</a></p>
{% elsif p1['skos:broadMatch'] %}
<p class="small text-muted">Broader than <a href="{{ p1['skos:broadMatch'] }}">{{ p1['skos:broadMatch'] }}</a></p>
{% endif %}
{% if p1.properties %}
{% assign properties2 = p1.properties %}
{% assign required2 = p1.required %}
{% elsif p1.items.properties %}
{% assign properties2 = p1.items.properties %}
{% assign required2 = p1.items.required %}
{% else %}
{% assign properties2 = false %}
{% endif %}

{% if p1.properties %}
{% assign properties2 = p1.properties %}
{% assign required2 = p1.required %}
{% elsif p1.items.properties %}
{% assign properties2 = p1.items.properties %}
{% assign required2 = p1.items.required %}
{% else %}
{% assign properties2 = false %}
{% endif %}
{% if properties2 %}
<table>
<thead>
<tr>
<th>Name</th>
<th>Definition</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<colgroup>
<col width="20%">
<col width="70%">
<col width="10%">
</colgroup>
{% for p2_raw in properties2 %}
{% assign p2_name = p2_raw[0] %}
{% assign p2 = p2_raw[1] %}
{% assign p2_id = p2_name | downcase | url_encode %}

{% if properties2 %}
<table>
<thead>
<tr>
<th>Name</th>
<th>Definition</th>
<th>Type</th>
<td id="{{ p1_id }}.{{ p2_id }}">
<a href="#{{ p1_id }}.{{ p2_id }}"><code>{{ p2_name }}</code></a>
{% if required2 contains p2_name %}*{% endif %}
</td>
<td>
{{ p2.description | markdownify }}
{% if p2.const or p2.enum or p2.items.enum %}
<strong>Constraints</strong>
<ul>
{% if p2.const %}<li>const: <code>{{ p2.const }}</code></li>{% endif %}
{% if p2.enum %}<li>enum: <code>{{ p2.enum | join: ", " }}</code></li>{% endif %}
{% if p2.items.enum %}<li>enum: <code>{{ p2.items.enum | join: ", " }}</code></li>{% endif %}
</ul>
{% endif %}
{% if p2['skos:exactMatch'] %}
<span class="small text-muted">Same as <a href="{{ p2['skos:exactMatch'] }}">{{ p2['skos:exactMatch'] }}</a></span>
{% elsif p2['skos:narrowMatch'] %}
<span class="small text-muted">Narrower than <a href="{{ p2['skos:narrowMatch'] }}">{{ p2['skos:narrowMatch'] }}</a></span>
{% elsif p2['skos:broadMatch'] %}
<span class="small text-muted">Broader than <a href="{{ p2['skos:broadMatch'] }}">{{ p2['skos:broadMatch'] }}</a></span>
{% endif %}
</td>
<td>{{ p2.type }}</td>
</tr>
</thead>
<tbody>
<colgroup>
<col width="20%">
<col width="70%">
<col width="10%">
</colgroup>
{% for p2_raw in properties2 %}
{% assign p2_name = p2_raw[0] %}
{% assign p2 = p2_raw[1] %}
{% assign p2_id = p2_name | downcase | url_encode %}

<tr>
<td id="{{ p1_id }}.{{ p2_id }}">
<a href="#{{ p1_id }}.{{ p2_id }}"><code>{{ p2_name }}</code></a>
{% if required2 contains p2_name %}*{% endif %}
</td>
<td>
{{ p2.description | markdownify }}
{% if p2.enum %}
<ul>
{% for item in p2.enum %}
<li><code>{{ item }}</code></li>
{% endfor %}
</ul>
{% endif %}
{% if p2['skos:exactMatch'] %}
<span class="small text-muted">Same as <a href="{{ p2['skos:exactMatch'] }}">{{ p2['skos:exactMatch'] }}</a></span>
{% elsif p2['skos:narrowMatch'] %}
<span class="small text-muted">Narrower than <a href="{{ p2['skos:narrowMatch'] }}">{{ p2['skos:narrowMatch'] }}</a></span>
{% elsif p2['skos:broadMatch'] %}
<span class="small text-muted">Broader than <a href="{{ p2['skos:broadMatch'] }}">{{ p2['skos:broadMatch'] }}</a></span>
{% endif %}
</td>
<td>{{ p2.type }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
12 changes: 2 additions & 10 deletions _layouts/tables.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,11 @@ <h2 id="{{ table_schema_id }}">{{ table_schema.title }}</h2>
</td>
<td>
{{ field.description | markdownify }}
{% if field.constraints.enum %}
<ul>
{% for item in field.constraints.enum %}
<li><code>{{ item }}</code></li>
{% endfor %}
</ul>
{% endif %}
{% if field.constraints %}
<strong>Constraints</strong>
<ul>
{% for constraint in field.constraints %}
{% if constraint[0] != 'required' and constraint[0] != 'enum' %}
<li>{{ constraint[0] }}: <code>{{ constraint[1] }}</code></li>
{% endif %}
<li>{{ constraint[0] }}: <code>{{ constraint[1] | join: ", " }}</code></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
Loading

0 comments on commit 36984a4

Please sign in to comment.