From fa973917f29bed0f398ac368a7630cc700b62c00 Mon Sep 17 00:00:00 2001 From: bsncubed Date: Sat, 30 Mar 2024 17:08:41 +1100 Subject: [PATCH] Update book-to-static.php Added the HTML to not show random Unicode characters Added customizable css --- book-to-static.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/book-to-static.php b/book-to-static.php index c72df43..8db3d72 100644 --- a/book-to-static.php +++ b/book-to-static.php @@ -7,6 +7,7 @@ $apiUrl = getenv('BS_URL') ?: ''; $clientId = getenv('BS_TOKEN_ID') ?: ''; $clientSecret = getenv('BS_TOKEN_SECRET') ?: ''; +$htmlCss = getenv('BS_CSS_FILE') ?: ''; // Output Folder // Can be provided as a arguments when calling the script @@ -132,7 +133,8 @@ function getImageFile(string $url): string { * Get the HTML representation of a book. */ function getBookHtmlOutput(array $book, array $chapters, array $pages): string { - $content = ""; + global $htmlCss; + $content = ""; $content .= "

{$book['name']}

"; $content .= "

{$book['description']}

"; $content .= "
"; @@ -157,7 +159,8 @@ function getBookHtmlOutput(array $book, array $chapters, array $pages): string { * Get the HTML representation of a chapter. */ function getChapterHtmlOutput(array $chapter, array $pages): string { - $content = ""; + global $htmlCss; + $content = ""; $content .= "

Back to book

"; $content .= "

{$chapter['name']}

"; $content .= "

{$chapter['description']}

"; @@ -176,7 +179,8 @@ function getChapterHtmlOutput(array $chapter, array $pages): string { * Get the HTML representation of a page. */ function getPageHtmlOutput(array $page, ?array $parentChapter): string { - $content = ""; + global $htmlCss; + $content = ""; if (is_null($parentChapter)) { $content .= "

Back to book

"; } else {