mirror of https://github.com/kiwix/libkiwix.git
Separate templates for full & partial OPDS entries
This commit is contained in:
parent
ebb713cb85
commit
0841472004
|
@ -99,10 +99,12 @@ kainjow::mustache::object getSingleBookData(const Book& book)
|
|||
std::string getSingleBookEntryXML(const Book& book, const std::string& rootLocation, const std::string& endpointRoot, bool partial)
|
||||
{
|
||||
auto data = getSingleBookData(book);
|
||||
data["dump_partial_entries"] = MustacheData(partial);
|
||||
data["endpoint_root"] = endpointRoot;
|
||||
data["root"] = rootLocation;
|
||||
return render_template(RESOURCE::templates::catalog_v2_entry_xml, data);
|
||||
const auto xmlTemplate = partial
|
||||
? RESOURCE::templates::catalog_v2_partial_entry_xml
|
||||
: RESOURCE::templates::catalog_v2_entry_xml;
|
||||
return render_template(xmlTemplate, data);
|
||||
}
|
||||
|
||||
BooksData getBooksData(const Library* library, const std::vector<std::string>& bookIds, const std::string& rootLocation, const std::string& endpointRoot, bool partial)
|
||||
|
|
|
@ -27,6 +27,7 @@ templates/catalog_entries.xml
|
|||
templates/catalog_v2_root.xml
|
||||
templates/catalog_v2_entries.xml
|
||||
templates/catalog_v2_entry.xml
|
||||
templates/catalog_v2_partial_entry.xml
|
||||
templates/catalog_v2_categories.xml
|
||||
templates/catalog_v2_languages.xml
|
||||
templates/url_of_search_results_css
|
||||
|
|
|
@ -2,11 +2,7 @@
|
|||
<id>urn:uuid:{{id}}</id>
|
||||
<title>{{title}}</title>
|
||||
<updated>{{updated}}</updated>
|
||||
{{#dump_partial_entries}}
|
||||
<link rel="alternate"
|
||||
href="{{endpoint_root}}/entry/{{{id}}}"
|
||||
type="application/atom+xml;type=entry;profile=opds-catalog"/>
|
||||
{{/dump_partial_entries}}{{^dump_partial_entries}} <summary>{{description}}</summary>
|
||||
<summary>{{description}}</summary>
|
||||
<language>{{language}}</language>
|
||||
<name>{{name}}</name>
|
||||
<flavour>{{flavour}}</flavour>
|
||||
|
@ -28,5 +24,4 @@
|
|||
{{#url}}
|
||||
<link rel="http://opds-spec.org/acquisition/open-access" type="application/x-zim" href="{{{url}}}" length="{{{size}}}" />
|
||||
{{/url}}
|
||||
{{/dump_partial_entries}}
|
||||
</entry>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<entry>
|
||||
<id>urn:uuid:{{id}}</id>
|
||||
<title>{{title}}</title>
|
||||
<updated>{{updated}}</updated>
|
||||
<link rel="alternate"
|
||||
href="{{endpoint_root}}/entry/{{{id}}}"
|
||||
type="application/atom+xml;type=entry;profile=opds-catalog"/>
|
||||
</entry>
|
Loading…
Reference in New Issue