diff --git a/composer.lock b/composer.lock index 3c69da2..b58127c 100644 --- a/composer.lock +++ b/composer.lock @@ -448,16 +448,16 @@ }, { "name": "hi-folks/phpepub", - "version": "v1.0.1", + "version": "v1.0.3", "source": { "type": "git", "url": "https://github.com/Hi-Folks/PHPePub.git", - "reference": "4bf45bbf3288c9b2f7ffab5a9028415bc2a0f0af" + "reference": "8866fc65018f47afb4665e6bfa6250b6ec9ba5ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Hi-Folks/PHPePub/zipball/4bf45bbf3288c9b2f7ffab5a9028415bc2a0f0af", - "reference": "4bf45bbf3288c9b2f7ffab5a9028415bc2a0f0af", + "url": "https://api.github.com/repos/Hi-Folks/PHPePub/zipball/8866fc65018f47afb4665e6bfa6250b6ec9ba5ab", + "reference": "8866fc65018f47afb4665e6bfa6250b6ec9ba5ab", "shasum": "" }, "require": { @@ -520,9 +520,9 @@ "epub" ], "support": { - "source": "https://github.com/Hi-Folks/PHPePub/tree/v1.0.1" + "source": "https://github.com/Hi-Folks/PHPePub/tree/v1.0.3" }, - "time": "2023-12-20T21:22:40+00:00" + "time": "2023-12-30T22:47:56+00:00" }, { "name": "illuminate/collections", diff --git a/src/Commands/BuildEpubCommand.php b/src/Commands/BuildEpubCommand.php index 3e3a628..ddedc14 100644 --- a/src/Commands/BuildEpubCommand.php +++ b/src/Commands/BuildEpubCommand.php @@ -8,7 +8,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use PHPePub\Core\EPub; -use PHPePub\Core\Structure\OPF\MetaValue; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputOption; @@ -116,7 +115,9 @@ protected function buildEpub(Collection $chapters, array $config, string $curren //$book->setLanguage("en"); $book->addCSSFile("style.css", "css1", $this->getStyle($this->config->workingPath, "style")); - $cssData = file_get_contents("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.css"); + //$cssData = file_get_contents("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.css"); + $cssData = file_get_contents("https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.16.2/build/styles/github-gist.min.css"); + $book->addCSSFile("github.css", "css2", $cssData); // $cover = $content_start . "

" . $this->config->title() . "

\n"; @@ -137,32 +138,33 @@ protected function buildEpub(Collection $chapters, array $config, string $curren $coverDimensions = $config['cover']['dimensions'] ?? 'width: 210mm; height: 297mm; margin: 0;'; $book->setCoverImage($coverImage, file_get_contents($pathCoverImage), mime_content_type($pathCoverImage)); } - $book->buildTOC(null, "toc", "Table of Contents", true, true); - $book->addChapter("Notices", "Cover.html", $cover); - //$book->addChapter("Table of Contents", "TOC.html", null, false, EPub::EXTERNAL_REF_IGNORE); - //$book->buildTOC(); + + $book->addChapter("Cover", "Cover.html", $cover); + $book->addChapter("Table of Contents", "TOC.xhtml", null, false, EPub::EXTERNAL_REF_IGNORE); + /* $book->addFileToMETAINF("com.apple.ibooks.display-options.xml", "\n\n \n \n \n \n \n"); */ - //$book->addCustomNamespace("dc", "http://purl.org/dc/elements/1.1/"); // StaticData::$namespaces["dc"]); - // This is to show how to use meta data, normally you'd use the $book->setAuthor - $metaValue = new MetaValue("dc:creator", $this->config->author()); - $metaValue->addOpfAttr("file-as", $this->config->author()); - $metaValue->addOpfAttr("role", "aut"); - $book->addCustomMetaValue($metaValue); + $book->addCustomNamespace("dc", "http://purl.org/dc/elements/1.1/"); // StaticData::$namespaces["dc"]); foreach ($chapters as $key => $chapter) { $this->output->writeln('==> ❇️ ' . $chapter["mdfile"] . ' ...'); $book->addChapter( - Arr::get($chapter, "frontmatter.title", "Chapter " . $key + 1), - "Chapter" . $key . ".html", - $content_start . $chapter["html"] . $content_end + chapterName: Arr::get($chapter, "frontmatter.title", "Chapter " . $key + 1), + fileName: "Chapter" . $key . ".html", + chapterData: $content_start . $chapter["html"] . $content_end, + externalReferences: EPub::EXTERNAL_REF_ADD ); //file_put_contents('export/' . "Chapter" . $key . " .html", $content_start . $chapter["html"] . $content_end); } - //$book->buildTOC(); + + $book->buildTOC( + title: "Index", + addReferences: false, + addToIndex: false + ); $book->finalize(); diff --git a/stubs/content/004-writing-content.md b/stubs/content/004-writing-content.md index 0a9711d..e61dc7e 100644 --- a/stubs/content/004-writing-content.md +++ b/stubs/content/004-writing-content.md @@ -10,6 +10,7 @@ This sample content is taken from [Ibis Next: create your eBooks with Markdown]( Inside the `content` directory, you can write multiple `.md` files. Ibis uses the headings to divide the book into parts and chapters: ~~~markdown + # Part 1 `

` tags define the start of a part. A separate PDF page will be generated to print the part title and any content below. diff --git a/stubs/content/006-conclusion.md b/stubs/content/006-conclusion.md index 224a09e..1ff61f1 100644 --- a/stubs/content/006-conclusion.md +++ b/stubs/content/006-conclusion.md @@ -1,3 +1,7 @@ +--- +title: Conclusion and Your Feedback +--- + ## Conclusion and Your Feedback Congratulations on exploring the powerful capabilities of Ibis Next for seamless eBook creation!