Skip to content

Commit

Permalink
Sort definitions in SCSS files to make them pass validators (#485)
Browse files Browse the repository at this point in the history
* Make SCCS files pass validators (1/4)

Fixed font namings, as their names mentioned in the CSS were not matching the
fonts' internal name in the *.ttf file. I'm sure this isn't important for
eBook readers, but it doesn't hurt either to have it matching now.

Added generic font-family to all symbol-only fonts to please CSS validators.
That generic font will never be used and, as eBook readers would have to go
with some font anyways (in case e.g. the "Font Awesome" is missing in the
output document), I decided to use "monospace" here.

Fixed missing leading 0s in decimal numbers.

Commented-out duplicate margin and font-size definitions in <h4> block. I
assume eBook readers parse the document from top to bottom and take the last
definition they find, so I disabled the definition at the top and kept the
one at the bottom alive.

Tested and verified with Calibre and my ancient Kobo GloHD device.

* Make SCCS files pass validators (2/4)

No semantical changes, just changed the sequence of some blocks due to
CSS validators complaining about it.

Moved <th.halign> and <th.valign> further down

Moved <blockquote> and <pre> blocks further up before <div.abstract>

Moved <div.footnotes> before <table.table td>

Merged the two <dt> blocks into a single one.

Tested and verified my changes with Calibre and my ancient Kobo GloHD device.
Only 20 errors remaining with this change (and my previous commit).

* Make SCCS files pass validators (3/4)

Further changes in sequence:

Moved <dl dd> down just after <dd>

Moved ul, ul ul, ..., ol, ol ol, ... further up to the other <ul> definition

Moved <figure.image> further up before <.chapter-header p.byline img>

Moved <div.verse > pre> before <figure.listing > figcaption + pre>

Had to split <th> and <td> from their existing block to move them
before <table.table th> and <table.table td>

Tested and verified my changes with Calibre and my ancient Kobo GloHD device.
Only 12 errors remaining now.

* Make SCCS files pass validators (4/4)

Final commit changing the sequence of blocks to please CSS validators

Moved <table.table-grid-all th> and <table.table-grid-all td> up a bit to
define it before <table.table thead th>

Moved <hr.pagebreak + *> further up before <table.table thead th>

Moved <table.table-grid-all thead tr > *:last-child> further down
after <table.table-grid-cols tbody tr > td:last-child>

Moved <table.table-grid-cols th> and <table.table-grid-cols td> a bit up
before <table.table thead th>

Validator now says: "0 errors", yay!

Tested and verified my changes yet again with Calibre and my ancient
Kobo GloHD device.
  • Loading branch information
LPT-BlubbY authored Nov 19, 2024
1 parent 72c5d6f commit 88c0172
Show file tree
Hide file tree
Showing 3 changed files with 298 additions and 291 deletions.
2 changes: 1 addition & 1 deletion data/styles/epub3-css3-only.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ body code, body kbd, body :not(.verse) > pre, :not(.verse) > pre :not(code) {
.icon {
display: inline-block;
/* !important required to override custom font setting in Kindle (since .icon can appear inside a span) */
font-family: "FontAwesome" !important;
font-family: "Font Awesome 6 Free Solid", monospace !important;
font-style: normal !important;
font-weight: normal !important;
line-height: 1;
Expand Down
6 changes: 3 additions & 3 deletions data/styles/epub3-fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
}

@font-face {
font-family: "M+ 1p";
font-family: "M+ 1p light";
font-style: normal;
font-weight: 200;
src: url(../fonts/mplus1p-light-latin.ttf);
}

@font-face {
font-family: "M+ 1p";
font-family: "M+ 1p bold";
font-style: normal;
font-weight: 700;
src: url(../fonts/mplus1p-bold-latin.ttf);
Expand Down Expand Up @@ -82,7 +82,7 @@
}

@font-face {
font-family: "FontAwesome";
font-family: "Font Awesome 6 Free Solid";
font-style: normal;
font-weight: normal;
src: url(../fonts/awesome/fa-solid-900.ttf);
Expand Down
Loading

0 comments on commit 88c0172

Please sign in to comment.