From 4877836b12cde621a9c6200ec460ce025384ea35 Mon Sep 17 00:00:00 2001 From: tcit Date: Wed, 7 May 2014 12:40:09 +0200 Subject: Many improvements to epub produced : better cover, better tags --- inc/poche/Poche.class.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'inc/poche') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c476df3e..c99bfcba 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -1200,30 +1200,37 @@ class Poche $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); + $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; - $log->logLine("Add Cover Image"); - $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png"); + $log->logLine("Add Cover"); + if (count($entries)>1){ + $cover = "

" . $entries[0]['title'] . " and " . count($entries) . " other articles

"; + } else { + $cover = "

" . $entries[0]['title'] . "

"; + } + $book->setCover("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $cover); + - $cover = $content_start . "

My articles on wallabag

\n

As seen on : http://$_SERVER[HTTP_HOST]

\n" . $bookEnd; - $book->addChapter("Notices", "Cover.html", $cover); + $book->setCover($cover); + //$book->addChapter("Notices", "Cover.html", $cover); $book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE); + $subject = ""; foreach ($entries as $entry) { $tags = $this->store->retrieveTagsByEntry($entry['id']); foreach ($tags as $tag) { - $book->setSubject($tag['value']); + $subject =. $tag['value'] . ','; } $log->logLine("Set up parameters"); - - $chapter = $content_start . $entry['content'] . $bookEnd; $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); + $log->logLine("Added chapter " . $entry['title']); } - + $book->setSubject($subject); if (DEBUG_POCHE) { $epuplog = $book->getLog(); -- cgit v1.2.3