mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Fix margin collapse issue
This commit is contained in:
parent
5f2339a690
commit
13f15e34a1
2 changed files with 11 additions and 8 deletions
|
@ -310,8 +310,8 @@ do
|
||||||
# We do this first because the tweaks below shouldn't apply to the single-page file
|
# 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}"
|
se recompose-epub --xhtml --output "${workDir}"/single-page.xhtml --extra-css-file="${webRoot}/css/web.css" "${workDir}"
|
||||||
|
|
||||||
# Wrap book contents in a <main> tag
|
# Wrap book contents in a <main> tag (and extra <div> for styling reasons)
|
||||||
sed --in-place --regexp-extended "s|<body([^>]*)>|<body><main\1>|; s|</body>|</main></body>|" "${workDir}"/single-page.xhtml
|
sed --in-place --regexp-extended "s|<body([^>]*)>|<body><main\1><div>|; s|</body>|</div></main></body>|" "${workDir}"/single-page.xhtml
|
||||||
|
|
||||||
# Add a navbar with a link back to the homepage
|
# 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><li><a href=\"${bookUrl}\">Back to ebook</a></li></ul></nav></header>|" "${workDir}"/single-page.xhtml
|
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></ul></nav></header>|" "${workDir}"/single-page.xhtml
|
||||||
|
@ -342,8 +342,8 @@ do
|
||||||
workTitle=$(grep --only-matching --extended-regexp "<dc:title id=\"title\">(.+?)</dc:title>" "${workDir}"/src/epub/content.opf | sed --regexp-extended "s/<[^>]+?>//g")
|
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"
|
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"
|
||||||
|
|
||||||
# Wrap book contents in a <main> tag
|
# Wrap book contents in a <main> tag (and extra <div> for styling reasons)
|
||||||
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>%"
|
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><div>%; s%</body>%</div></main></body>%"
|
||||||
|
|
||||||
# Add the header nav to each page
|
# 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>%"
|
||||||
|
|
|
@ -10,10 +10,13 @@ body{
|
||||||
}
|
}
|
||||||
|
|
||||||
main{
|
main{
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
main > div{
|
||||||
margin: 8rem auto 3rem;
|
margin: 8rem auto 3rem;
|
||||||
max-width: 55ch;
|
max-width: 55ch;
|
||||||
padding: 0 3rem;
|
padding: 0 3rem;
|
||||||
flex-grow: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body > header{
|
body > header{
|
||||||
|
@ -70,8 +73,8 @@ body > footer li{
|
||||||
max-width: 40%;
|
max-width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
body > main > section[epub|type~="titlepage"],
|
body > main > div > section[epub|type~="titlepage"],
|
||||||
body > main > section[epub|type~="halftitlepage"]{
|
body > main > div > section[epub|type~="halftitlepage"]{
|
||||||
min-height: auto;
|
min-height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +94,7 @@ nav[epub|type~="toc"] ol{
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(max-width: 65ch){
|
@media(max-width: 65ch){
|
||||||
main{
|
main > div{
|
||||||
padding: 0 2rem;
|
padding: 0 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue