mirror of
https://github.com/wallabag/wallabag.git
synced 2024-10-31 22:28:54 +00:00
EntriesExport/epub: add metadata to each entry's cover
Add metadata to the cover of each entry: - Publishers - Estimated reading time - Date of creation ("Added on") - Address (URL) Related to #2821 Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
parent
f810834623
commit
4944703edc
1 changed files with 16 additions and 1 deletions
|
@ -188,7 +188,22 @@ class EntriesExport
|
|||
}
|
||||
$filename = sha1($entry->getTitle());
|
||||
|
||||
$titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $bookEnd;
|
||||
$publishedBy = $entry->getPublishedBy();
|
||||
if (!empty($publishedBy)) {
|
||||
$authors = implode(',', $publishedBy);
|
||||
} else {
|
||||
$authors = $this->translator->trans('export.unknown');
|
||||
}
|
||||
|
||||
$titlepage = $content_start .
|
||||
'<h1>' . $entry->getTitle() . '</h1>' .
|
||||
'<dl>' .
|
||||
'<dt>' . $this->translator->trans('entry.view.published_by') . '</dt><dd>' . $authors . '</dd>' .
|
||||
'<dt>' . $this->translator->trans('entry.metadata.reading_time') . '</dt><dd>' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '</dd>' .
|
||||
'<dt>' . $this->translator->trans('entry.metadata.added_on') . '</dt><dd>' . $entry->getCreatedAt()->format('Y-m-d') . '</dd>' .
|
||||
'<dt>' . $this->translator->trans('entry.metadata.address') . '</dt><dd><a href="' . $entry->getUrl() . '">' . $entry->getUrl() . '</a></dd>' .
|
||||
'</dl>' .
|
||||
$bookEnd;
|
||||
$book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD);
|
||||
$chapter = $content_start . $entry->getContent() . $bookEnd;
|
||||
|
||||
|
|
Loading…
Reference in a new issue