ckan / ckanext-dcat

CKAN ♥ DCAT
163 stars 142 forks source link

[#75] Schema.org mapping #108

Closed metaodi closed 6 years ago

metaodi commented 6 years ago

Add schema.org mapping (see #75 for details)

This PR provides:

metaodi commented 6 years ago

I found a way to check if a helper function is defined.

In https://github.com/ckan/ckan/pull/3042 an excpetion was added to the helper dictionary, so it's no longer possible to simply use {% if h.structured_data %} in jinja, as this triggers an exception. But calling h.get() seems to do the trick:

{% if helper_dict.get('structured_data') %}
{{ h.structured_data()|safe }}
{% endif %}
metaodi commented 6 years ago

Unfortunately the approach I described above does not work in older versions of CKAN (<2.6), because earlier versions of jinja do not support the use of dict(). Therefore I added another template helper to check if a helper is available or not.

metaodi commented 6 years ago

I rebased this PR to master to fix the merge conflicts.

metaodi commented 6 years ago

@amercader ping, can you review this PR?

amercader commented 6 years ago

sorry @metaodi, I'm a bit swamped right now but it's definitely on my list. Will try to review it this week.

amercader commented 6 years ago

This looks good @metaodi . Only one minor change in the README and we can merge.

metaodi commented 6 years ago

@amercader I made the changes to the README and added the new config option for the RDF endpoints (+tests)

amercader commented 6 years ago

Thanks @metaodi, fantastic work as usual

amercader commented 6 years ago

This is worth a new release, I've released 0.0.7