]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3392 from mart-e/add-title-page-epub
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Tue, 31 Oct 2017 13:10:41 +0000 (15:10 +0200)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2017 13:10:41 +0000 (15:10 +0200)
add the title of article on the epub export

src/Wallabag/CoreBundle/Helper/EntriesExport.php

index 830798b822831900d069b712c1a767f912a851ec..136f66f5292b012698593ec98ecf63c799f0d1cb 100644 (file)
@@ -174,8 +174,6 @@ class EntriesExport
             $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png');
         }
 
-        $book->buildTOC();
-
         /*
          * Adding actual entries
          */
@@ -190,11 +188,13 @@ class EntriesExport
             // in filenames, we limit to A-z/0-9
             $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
 
+            $titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $this->getExportInformation('PHPePub') . $bookEnd;
+            $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);
         }
 
-        $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
+        $book->buildTOC();
 
         return Response::create(
             $book->getBook(),