Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
Old 07-31-2022, 09:18 AM   #1
bookworm2000
Member
bookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the rough
 
Posts: 14
Karma: 7220
Join Date: Dec 2012
Device: Kindle 4NT, Android
(page-break-x + feature queries + class selector) not working in CV

Hunting for what I assumed was a bug in one of my books I stumbled upon some strange behaviour in Calibre Viewer. It took me a while to identify the culprit(s) (or better, the combination thereof). I boiled it down to this test file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
  <meta charset="utf-8"/>
  <title>Test</title>
  <style>
    p {
      color: red;
    }
    @supports(display: flex) {
      p {color: green;}
    }
    h1 {
      break-after: avoid;
      page-break-after: avoid;   /* delete here... */
      break-inside: avoid;
      page-break-inside: avoid;  /* ...and here... */
    }
    @supports(font-variant-numeric: oldstyle-nums) {
      p.test {color: blue;}  /* ...or remove class */
    }
  </style>
</head>
<body>
  <p class="test">Test</p>
</body>
</html>
Chrome, FF, Opera, and Edge work as expected and render blue text. Calibre Viewer only accepts the first feature query and produces the text in green.

There would be two ways two make CV understand the second query:
  • Delete page-break-after and page-break-inside from the completely unrelated h1 declaration (break-after and break-inside seem to be no problem).
  • Or, remove the class test from the p selector.
Sadly, none of these are acceptable workarounds in my case.

Tested with Calibre 6.2.1 (from PortableApps) and some old 5.x installed version on Windows 10.

Last edited by bookworm2000; 07-31-2022 at 09:24 AM.
bookworm2000 is offline   Reply With Quote
Old 07-31-2022, 10:36 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That will take care of it: https://github.com/kovidgoyal/calibr...766da74f5457f4

Note that you will have to reload the book to see the fix.
kovidgoyal is online now   Reply With Quote
Old 07-31-2022, 11:46 AM   #3
bookworm2000
Member
bookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the rough
 
Posts: 14
Karma: 7220
Join Date: Dec 2012
Device: Kindle 4NT, Android
Thank you!

But where should I put render_book.py? I think I tried every subdirectory of the Calibre folder.
bookworm2000 is offline   Reply With Quote
Old 07-31-2022, 11:49 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Run calibre from source or wait for the next release.
kovidgoyal is online now   Reply With Quote
Old 07-31-2022, 12:11 PM   #5
bookworm2000
Member
bookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the roughbookworm2000 is a jewel in the rough
 
Posts: 14
Karma: 7220
Join Date: Dec 2012
Device: Kindle 4NT, Android
Ah, I see. Thank you so much. I will happily wait for the next release.
bookworm2000 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page-break-after avoid not working scruffs Amazon Kindle 50 01-27-2023 06:28 AM
Alternative to "class=chapter" to force a page break porphyry5 Conversion 6 01-27-2022 06:10 PM
page-break-after: always not working franc ePub 11 03-01-2021 04:33 PM
iPad iBooks: page-break-after/inside/before NOT working? philx Apple Devices 7 01-27-2013 12:42 AM


All times are GMT -4. The time now is 02:40 AM.


MobileRead.com is a privately owned, operated and funded community.