]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Set the title in a separated chapter
authorMartin Trigaux <me@mart-e.be>
Sat, 28 Oct 2017 12:49:14 +0000 (14:49 +0200)
committerMartin Trigaux <me@mart-e.be>
Sat, 28 Oct 2017 12:49:14 +0000 (14:49 +0200)
Set the export option on the same page, same as done in producePdf
Move the ToC at the end of the book so the title page is the first one

src/Wallabag/CoreBundle/Helper/EntriesExport.php

index 1b4afa3baaa076d7b0f65048f9544252dcd3d8cd..5d2fca312be6cea75feecccbf7104af1d048ff50 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,12 +188,13 @@ class EntriesExport
             // in filenames, we limit to A-z/0-9
             $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
 
-            $titlepage = "<h1>".$entry->getTitle()."</h1>";
-            $chapter = $content_start . $titlepage . $entry->getContent() . $bookEnd;
+            $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(),