ID: 6fe7f1348840870c3cf37da48c352ee81bff4d31
78 lines
—
2K —
View raw
| {% extends "templates/base.tpl" %}
{% 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 .
FILTER (?item = <dokk:library:""" + item_id + """>)
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)
}
""",
{
"@context": {
"library": "dokk:library:",
"license": "dokk:license:",
"library:author": { "@container": "@set" },
"library:license": { "@container": "@set" }
},
"library:title": {}
}
)["@graph"][0]
%}
{% block title %}{{ data['library:title'] }}{% endblock %}
{% block body %}
<div class="library_item">
<div class="header">
<a href="/library">DOKK Library</a>
</div>
<div>
<object type="application/pdf" data="https://blob.dokk.org/pdf/{{ item_id }}.pdf">
<pre>{{ plaintext }}</pre>
</object>
</div>
<div class="details">
<h1>{{ data["library:title"] }}</h1>
<p>
<b>Authors</b>
{% for author in data["library:author"]|sort() %}
{{ author }}
{% endfor%}
</p>
<p>
<b>License</b>
{% for license in data["library:license"]|sort(attribute="license:id") %}
<a href="{{ url('license', id=license['license:id']) }}">{{ license['license:id'] }}</a>
{% endfor%}
</p>
</div>
</div>
{% endblock %}
|