diff options
author | Kevin Decherf <kevin@kdecherf.com> | 2019-01-06 23:27:13 +0100 |
---|---|---|
committer | Kevin Decherf <kevin@kdecherf.com> | 2019-01-07 21:44:14 +0100 |
commit | 4944703edc7cdd2c8cd645b785603b4405d2a288 (patch) | |
tree | b5f2ea98f802716d83af0d3662f5d59f48918579 /src | |
parent | f8108346236e18768c08d6c0d4dc5fb4dfe13b78 (diff) | |
download | wallabag-4944703edc7cdd2c8cd645b785603b4405d2a288.tar.gz wallabag-4944703edc7cdd2c8cd645b785603b4405d2a288.tar.zst wallabag-4944703edc7cdd2c8cd645b785603b4405d2a288.zip |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index db5340fc..9cde27c6 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -188,7 +188,22 @@ class EntriesExport | |||
188 | } | 188 | } |
189 | $filename = sha1($entry->getTitle()); | 189 | $filename = sha1($entry->getTitle()); |
190 | 190 | ||
191 | $titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $bookEnd; | 191 | $publishedBy = $entry->getPublishedBy(); |
192 | if (!empty($publishedBy)) { | ||
193 | $authors = implode(',', $publishedBy); | ||
194 | } else { | ||
195 | $authors = $this->translator->trans('export.unknown'); | ||
196 | } | ||
197 | |||
198 | $titlepage = $content_start . | ||
199 | '<h1>' . $entry->getTitle() . '</h1>' . | ||
200 | '<dl>' . | ||
201 | '<dt>' . $this->translator->trans('entry.view.published_by') . '</dt><dd>' . $authors . '</dd>' . | ||
202 | '<dt>' . $this->translator->trans('entry.metadata.reading_time') . '</dt><dd>' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '</dd>' . | ||
203 | '<dt>' . $this->translator->trans('entry.metadata.added_on') . '</dt><dd>' . $entry->getCreatedAt()->format('Y-m-d') . '</dd>' . | ||
204 | '<dt>' . $this->translator->trans('entry.metadata.address') . '</dt><dd><a href="' . $entry->getUrl() . '">' . $entry->getUrl() . '</a></dd>' . | ||
205 | '</dl>' . | ||
206 | $bookEnd; | ||
192 | $book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD); | 207 | $book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD); |
193 | $chapter = $content_start . $entry->getContent() . $bookEnd; | 208 | $chapter = $content_start . $entry->getContent() . $bookEnd; |
194 | 209 | ||