mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-24 16:40:30 +00:00
Merge pull request #3827 from wallabag/epub-quote
EntriesExport/epub: replace epub identifier with unique urn
This commit is contained in:
commit
5de17117a1
1 changed files with 8 additions and 2 deletions
|
@ -150,8 +150,6 @@ class EntriesExport
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$book->setTitle($this->title);
|
$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.
|
// 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->setLanguage($this->language);
|
||||||
$book->setDescription('Some articles saved on my wallabag');
|
$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');
|
$book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$entryIds = [];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adding actual entries
|
* Adding actual entries
|
||||||
*/
|
*/
|
||||||
|
@ -192,8 +192,14 @@ class EntriesExport
|
||||||
$book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD);
|
$book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD);
|
||||||
$chapter = $content_start . $entry->getContent() . $bookEnd;
|
$chapter = $content_start . $entry->getContent() . $bookEnd;
|
||||||
$book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
|
$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();
|
$book->buildTOC();
|
||||||
|
|
||||||
return Response::create(
|
return Response::create(
|
||||||
|
|
Loading…
Reference in a new issue