From 537e14122f231836fe6ed45e573943441592a66d Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 11 Nov 2022 20:47:16 -0800 Subject: [PATCH] Wrap book contents in a
tag --- scripts/deploy-ebook-to-www | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/deploy-ebook-to-www b/scripts/deploy-ebook-to-www index c9eed45f..f287321f 100755 --- a/scripts/deploy-ebook-to-www +++ b/scripts/deploy-ebook-to-www @@ -310,8 +310,11 @@ do # We do this first because the tweaks below shouldn't apply to the single-page file se recompose-epub --xhtml --output "${workDir}"/single-page.xhtml --extra-css-file="${webRoot}/css/web.css" "${workDir}" + # Wrap book contents in a
tag + sed --in-place --regexp-extended "s|]*)>||; s||
|" "${workDir}"/single-page.xhtml + # Add a navbar with a link back to the homepage - sed --in-place --regexp-extended "s||
|" "${workDir}"/single-page.xhtml + sed --in-place --regexp-extended "s|]*)>|
|" "${workDir}"/single-page.xhtml # Adjust sponsored links in the colophon sed --in-place 's|

(.+?)" "${workDir}"/src/epub/content.opf | sed --regexp-extended "s/<[^>]+?>//g") find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place --regexp-extended "s||<title>${workTitle} - |g" + # Wrap book contents in a <main> tag + find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place --regexp-extended "s%<body([^>]*)>%<body><main\1>%; s%</body>%</main></body>%" + # Add the header nav to each page - find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place --regexp-extended "s%<body(.*?)>%<body\1><header><nav><ul><li><a href=\"/\">Standard Ebooks</a></li><li><a href=\"${bookUrl}\">Back to ebook</a></li><li><a href=\"${bookUrl}/text\">Table of contents</a></li></ul></nav></header>%" + find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place --regexp-extended "s%<body([^>]*)>%<body\1><header><nav><ul><li><a href=\"/\">Standard Ebooks</a></li><li><a href=\"${bookUrl}\">Back to ebook</a></li><li><a href=\"${bookUrl}/text\">Table of contents</a></li></ul></nav></header>%" # Add a chapter navigation footer to each page "${scriptsDir}"/inject-chapter-navigation-footer "${workDir}"/src/epub "${bookUrl}"