From: Kevin Decherf Date: Mon, 7 Jan 2019 10:59:38 +0000 (+0100) Subject: Merge pull request #3827 from wallabag/epub-quote X-Git-Tag: 2.3.6~5 X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=commitdiff_plain;h=5de17117a1a8c974458be2c128dc8f9d6912fb8c;hp=d2aec7096dacfd72de13eddf146b3e2caa02c17a Merge pull request #3827 from wallabag/epub-quote EntriesExport/epub: replace epub identifier with unique urn --- diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index cbf1037b..6082f6b9 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -150,8 +150,6 @@ class EntriesExport */ $book->setTitle($this->title); - // Could also be the ISBN number, prefered for published books, or a UUID. - $book->setIdentifier($this->title, EPub::IDENTIFIER_URI); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. $book->setLanguage($this->language); $book->setDescription('Some articles saved on my wallabag'); @@ -174,6 +172,8 @@ class EntriesExport $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png'); } + $entryIds = []; + /* * Adding actual entries */ @@ -192,8 +192,14 @@ class EntriesExport $book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD); $chapter = $content_start . $entry->getContent() . $bookEnd; $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD); + + $entryIds[] = $entry->getId(); } + // Could also be the ISBN number, prefered for published books, or a UUID. + $hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds))); + $book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI); + $book->buildTOC(); return Response::create(