mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Add basic nav bars to web versions of the books
These are fixed on (portrait) tablet and mobile, static on desktop.
This commit is contained in:
parent
b60d795e82
commit
8a13046496
2 changed files with 43 additions and 3 deletions
|
@ -290,6 +290,9 @@ 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}/www/css/web.css" "${workDir}"
|
||||
|
||||
# Add a navbar with a link back to the homepage
|
||||
sed --in-place --regexp-extended 's/<body(.*?)>/<body\1><header><nav><ul><li><a href="\/">Standard Ebooks<\/a><\/li><\/ul><\/nav><\/header>/' "${workDir}"/single-page.xhtml
|
||||
|
||||
# Adjust sponsored links in the colophon
|
||||
sed --in-place 's|<p><a href="http|<p><a rel="nofollow" href="http|g' "${workDir}"/single-page.xhtml
|
||||
|
||||
|
@ -298,7 +301,7 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
# Make some compatibilty adjustments for the individual XHTML files
|
||||
# Make some compatibility adjustments for the individual XHTML files
|
||||
|
||||
# Remove instances of the .xhtml filename extension in the source text
|
||||
find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place 's/\.xhtml//g'
|
||||
|
@ -316,6 +319,9 @@ do
|
|||
workTitle=$(grep --only-matching --extended-regexp "<dc:title id=\"title\">(.+?)</dc:title>" "${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>|<title>${workTitle} - |g"
|
||||
|
||||
# Add the 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="\.">Table of contents<\/a><\/li><\/ul><\/nav><\/header>/'
|
||||
|
||||
# Adjust sponsored links in the colophon
|
||||
sed --in-place 's|<p><a href="http|<p><a rel="nofollow" href="http|g' "${workDir}"/src/epub/text/colophon.xhtml
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue