Skip to content

Commit

Permalink
build: Keep vh/vw units in CSS, but add % as fallback.
Browse files Browse the repository at this point in the history
  • Loading branch information
gvtulder committed Sep 6, 2024
1 parent 8df18d3 commit f8438f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion se/se_epub_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def build(self, run_epubcheck: bool, check_only: bool, build_kobo: bool, build_k
processed_css = regex.sub(r"(\s+)page-break-(before|after):\s+page;", "\\1page-break-\\2: always;", processed_css)

# Replace `vw` or `vh` units with percent, a reasonable approximation
processed_css = regex.sub(r"([0-9\.]+\s*)v(w|h);", r"\1%;", processed_css)
processed_css = regex.sub(r"^(.+?:\s*[0-9\.]+\s*)(v(w|h));", r"\1%;\n\1\2;", processed_css, flags=regex.MULTILINE)

if processed_css != css:
file.seek(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@

figure.full-page{
max-height: 100%;
max-height: 100vh;
}

section.epub-type-preface{
margin-top: 20%;
margin-top: 20vh;
}

p{
margin-top: 20%;
margin-top: 20vh;
margin-right: 10%;
margin-bottom: 10px;
margin-left: 10em;
width: 5%;
width: 5vw;
max-width: 12.5%;
max-width: 12.5vh;
}

0 comments on commit f8438f9

Please sign in to comment.