ID: 9b23f71a137ef202ed7d246e0d0e3e5c324b63f8
73 lines
—
2K —
View raw
| {% extends "templates/base.tpl" %}
{% block title %}Library{% endblock %}
{% set data = query("""
PREFIX library: <dokk:library:>
PREFIX license: <dokk:license:>
CONSTRUCT {
?item library:title ?title;
library:author ?author ;
library:license ?license .
?license license:id ?license_id ;
license:name ?license_name .
}
WHERE {
?item library:title ?title ;
library:author ?author ;
library:license ?license .
OPTIONAL {
?license license:id ?license_id_optional ;
license:name ?license_name_optional .
}
BIND(COALESCE(?license_id_optional, SUBSTR(STR(?license), 14)) AS ?license_id)
BIND(COALESCE(?license_name_optional, SUBSTR(STR(?license), 14)) AS ?license_name)
}
ORDER BY UCASE(?title)
""",
{
'@context': {
'library': 'dokk:library:',
'license': 'dokk:license:',
'library:author': { '@container': '@set' },
'library:license': { '@container': '@set' }
},
'library:title': {}
})
%}
{% block body %}
<div class="library">
<b>The library is also available via OPDS. Add this link to your OPDS client: https://dokk.org/library/opds.xml</b>
<br /><br /><br />
{% for item in data["@graph"]|sort(attribute="library:title") %}
<p>
<div>
<a href="/library/{{ item['@id'][8:] }}">{{ item['library:title'] }}</a>
</div>
<div>
Authors:
{% for author in item["library:author"]|sort() %}
{{ author }}
{% endfor%}
</div>
<div>
License:
{% for license in item["library:license"]|sort(attribute="license:id") %}
{{ license['license:id'] }}
{% endfor%}
</div>
</p>
<br/><br/>
{% endfor %}
</div>
{% endblock %}
|