Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 12:15 AM   #1
quinta@ebf.cz
Connoisseur
quinta@ebf.cz began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Mar 2019
Device: Kindle 3 Paperwhite
Automatic fix of an ID name causes loss of CSS styling

When Calibre Editor's Check Book function reports an invalid ID, the automatic correction "Replace this id with a randomly generated valid id" (or "Try to automatically fix all fixable errors") changes the id attribute in the XHTML file, but does not update CSS selector referring to the ID.

As a result, the CSS rule no longer matches the element and its formatting is silently lost.

example:
xhtml:
Code:
<p id="_example">This paragraph is formatted by CSS.</p>
css:
Code:
#_example {
    text-align: right;
    font-weight: bold;
}
after autofix:
xhtml:
Code:
<p id="uiIKYKleNpAABQhFyzTceGC">This paragraph is formatted by CSS.</p>
css:
(without change)

expected behaviour:
css:
Code:
#uiIKYKleNpAABQhFyzTceGC {
    text-align: right;
    font-weight: bold;
}
Alternatively, if Calibre intentionally does not update CSS selectors, the automatic correction should warn that changing the ID may invalidate CSS rules referring to it.

(This appears to be a different issue from the historical bug concerning ID references in the OPF spine (Calibre bug 1479462).)
quinta@ebf.cz is offline   Reply With Quote
Old Today, 12:31 PM   #2
quinta@ebf.cz
Connoisseur
quinta@ebf.cz began at the beginning.
 
Posts: 64
Karma: 10
Join Date: Mar 2019
Device: Kindle 3 Paperwhite
Potential issue: A straightforward modification of the selector—based on changing a specific ID—could cause unwanted formatting change in (hypothetical) other XHTML document using the same CSS and containing an (hypothetical) ID of the same name...

Therefore, the solution would have to be more complex. And probably include analyzing occurrences of IDs with the same name and, if necessary, generating new CSS definitions (rather than modifying the selector in the existing one).
quinta@ebf.cz is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ordering css styling within a given class ElMiko ePub 5 08-18-2025 10:18 PM
Image styling css... what do all these properties do? ElMiko Sigil 107 06-30-2025 05:16 PM
CSS Styling based on class/existing styling 1ily Calibre 8 03-17-2025 06:37 AM
Incorrect styling with specific CSS quiris Marvin 9 07-04-2016 01:04 PM
CSS Styling not showing up in digital editions sjkramer Sigil 9 01-30-2010 10:46 AM


All times are GMT -4. The time now is 03:19 PM.


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