mirror of https://github.com/kiwix/libkiwix.git
Added <dc:issued> field to OPDS entries
This commit is contained in:
parent
5c38300504
commit
afb556bf64
|
@ -72,6 +72,7 @@ IllustrationInfo getBookIllustrationInfo(const Book& book)
|
|||
|
||||
kainjow::mustache::object getSingleBookData(const Book& book)
|
||||
{
|
||||
const auto bookDate = book.getDate() + "T00:00:00Z";
|
||||
const MustacheData bookUrl = book.getUrl().empty()
|
||||
? MustacheData(false)
|
||||
: MustacheData(book.getUrl());
|
||||
|
@ -82,7 +83,8 @@ kainjow::mustache::object getSingleBookData(const Book& book)
|
|||
{"description", book.getDescription()},
|
||||
{"language", book.getLanguage()},
|
||||
{"content_id", urlEncode(book.getHumanReadableIdFromPath(), true)},
|
||||
{"updated", book.getDate() + "T00:00:00Z"},
|
||||
{"updated", bookDate}, // XXX: this should be the entry update datetime
|
||||
{"book_date", bookDate},
|
||||
{"category", book.getCategory()},
|
||||
{"flavour", book.getFlavour()},
|
||||
{"tags", book.getTags()},
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:opds="http://opds-spec.org/2010/catalog">
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||
xmlns:dc="http://purl.org/dc/terms/"
|
||||
xmlns:opds="http://opds-spec.org/2010/catalog">
|
||||
<id>{{feed_id}}</id>
|
||||
<title>{{^filter}}All zims{{/filter}}{{#filter}}Filtered zims ({{filter}}){{/filter}}</title>
|
||||
<updated>{{date}}</updated>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||
xmlns:dc="http://purl.org/dc/terms/"
|
||||
xmlns:opds="https://specs.opds.io/opds-1.2"
|
||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<id>{{feed_id}}</id>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<publisher>
|
||||
<name>{{publisher_name}}</name>
|
||||
</publisher>
|
||||
<dc:issued>{{book_date}}</dc:issued>
|
||||
{{#url}}
|
||||
<link rel="http://opds-spec.org/acquisition/open-access" type="application/x-zim" href="{{{url}}}" length="{{{size}}}" />
|
||||
{{/url}}
|
||||
|
|
|
@ -1081,7 +1081,8 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
}
|
||||
|
||||
#define OPDS_FEED_TAG \
|
||||
"<feed xmlns=\"http://www.w3.org/2005/Atom\"" \
|
||||
"<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" \
|
||||
" xmlns:dc=\"http://purl.org/dc/terms/\"\n" \
|
||||
" xmlns:opds=\"http://opds-spec.org/2010/catalog\">\n"
|
||||
|
||||
#define CATALOG_LINK_TAGS \
|
||||
|
@ -1110,6 +1111,7 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
" <publisher>\n" \
|
||||
" <name>Kiwix</name>\n" \
|
||||
" </publisher>\n" \
|
||||
" <dc:issued>2020-03-31T00:00:00Z</dc:issued>\n" \
|
||||
" <link rel=\"http://opds-spec.org/acquisition/open-access\" type=\"application/x-zim\" href=\"https://github.com/kiwix/libkiwix/raw/master/test/data/zimfile%26other.zim\" length=\"569344\" />\n" \
|
||||
" </entry>\n"
|
||||
|
||||
|
@ -1136,6 +1138,7 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
" <publisher>\n" \
|
||||
" <name>Kiwix</name>\n" \
|
||||
" </publisher>\n" \
|
||||
" <dc:issued>2020-03-31T00:00:00Z</dc:issued>\n" \
|
||||
" <link rel=\"http://opds-spec.org/acquisition/open-access\" type=\"application/x-zim\" href=\"https://github.com/kiwix/libkiwix/raw/master/test/data/zimfile.zim\" length=\"569344\" />\n" \
|
||||
" </entry>\n"
|
||||
|
||||
|
@ -1159,6 +1162,7 @@ std::string maskVariableOPDSFeedData(std::string s)
|
|||
" <publisher>\n" \
|
||||
" <name>Kiwix</name>\n" \
|
||||
" </publisher>\n" \
|
||||
" <dc:issued>2020-03-31T00:00:00Z</dc:issued>\n" \
|
||||
" <link rel=\"http://opds-spec.org/acquisition/open-access\" type=\"application/x-zim\" href=\"https://github.com/kiwix/libkiwix/raw/master/test/data/zimfile.zim\" length=\"125952\" />\n" \
|
||||
" </entry>\n"
|
||||
|
||||
|
@ -1574,6 +1578,7 @@ TEST_F(LibraryServerTest, catalog_v2_languages)
|
|||
#define CATALOG_V2_ENTRIES_PREAMBLE0(x) \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
||||
"<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" \
|
||||
" xmlns:dc=\"http://purl.org/dc/terms/\"\n" \
|
||||
" xmlns:opds=\"https://specs.opds.io/opds-1.2\"\n" \
|
||||
" xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">\n" \
|
||||
" <id>12345678-90ab-cdef-1234-567890abcdef</id>\n" \
|
||||
|
|
Loading…
Reference in New Issue