Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 04-07-2026, 10:02 AM   #1
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
Sigil CSS parser will not understand the new nested CSS

Hi All,

Just a warning. Sigil's CSS Parser which is used throughout the Sigil Reports codebase and a few other places does not understand the new (2025) allowed nested css structure.

https://developer.mozilla.org/en-US/.../Nesting/Using

I would guess that is true for most epub ereaders not based on very very recent webkit/webengine browsers. So using it will limit your base for your epub.

Personally, I think the ability to nest css selectors inside each other is for the birds when it adds nothing and the first thing the downstream software generally does is flatten it back to a simple list an no one wants to process a second tree inside the html DOM tree.

So if you do attempt to write and use nested css in Sigil be prepared for it to get mangled.

Most of the younger devs never seem to have learned about the KISS principle of engineering. So sad. Or is this just my age showing ...

Last edited by KevinH; 04-07-2026 at 11:01 AM.
KevinH is offline   Reply With Quote
Old 04-07-2026, 11:37 AM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 82,839
Karma: 153071045
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by KevinH View Post
Most of the younger devs never seem to have learned about the KISS principle of engineering. So sad. Or is this just my age showing ...
I agree that devs these devs just don't follow the rules for KISS. Look at a lot of eBooks and you'll see that the code can be quite a mess.

As for nested CSS, I'm not for it at all.
JSWolf is offline   Reply With Quote
Old 04-07-2026, 11:50 AM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,674
Karma: 64144480
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by KevinH View Post
Hi All,

Just a warning. Sigil's CSS Parser which is used throughout the Sigil Reports codebase and a few other places does not understand the new (2025) allowed nested css structure.

https://developer.mozilla.org/en-US/.../Nesting/Using

I would guess that is true for most epub ereaders not based on very very recent webkit/webengine browsers. So using it will limit your base for your epub.

Personally, I think the ability to nest css selectors inside each other is for the birds when it adds nothing and the first thing the downstream software generally does is flatten it back to a simple list an no one wants to process a second tree inside the html DOM tree.

So if you do attempt to write and use nested css in Sigil be prepared for it to get mangled.

Most of the younger devs never seem to have learned about the KISS principle of engineering. So sad. Or is this just my age showing ...
Or just because you can do it, that you SHOULD
I wonder if this is just another case of planned obsolescence so you MUST by a new one?
theducks is offline   Reply With Quote
Old 04-07-2026, 12:38 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
Either way, I was able to use the Google AI to help write a CSSDenester.h code that will flatten nested css back to "normal" unnested css.

I have added it my personal c++ std::string cssparser repo. I will next take that code and rewrite it using Qt's QString and once tested will add it to Sigil's internal qCSSParser implemetation.

That way future versions of Sigil will produce flattened CSS when you reformat your css. That way your css is kept as viable as possible for older epub e-readers.

(In other words I was too lazy to completely rewrite our current cssparser to be tree based!).

Update:

This has now been added to Sigil master for testing.

Last edited by KevinH; 04-07-2026 at 02:45 PM. Reason: Update that qCSSDenester,h is now in Sigil master
KevinH is offline   Reply With Quote
Old 04-07-2026, 03:28 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 51,178
Karma: 179232776
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For anyone interested in testing, here's a link to my compile of the latest code from Sigil's Github repository: Sigil-2.7.6-Windows-x64-Setup.exe.
DNSB is offline   Reply With Quote
Old 04-07-2026, 03:55 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 9,528
Karma: 6774048
Join Date: Nov 2009
Device: many
Thanks! If anyone is looking for some small css testcases that use nesting, see

https://github.com/Sigil-Ebook/cssparser

And grab nesttest*.css and you can drag and drop them on Sigil.

To flatten the css back to normal simply use the reformat css multiline or single line routines.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how are nested+contradictory CSS dealt with ? cybmole Calibre 13 10-21-2011 11:55 AM
Sigil 0.3.4 / Problème CSS entre Sigil et iPad Grivels Software 10 07-03-2011 09:06 AM
css pseudo elements and adjacent combinators in extra css? ldolse Calibre 2 12-21-2010 05:09 PM
NCX creation -- nested or not, css classes illustrata ePub 3 08-25-2010 08:56 AM
Trying to understand re-css-ification. brewt Calibre 10 12-08-2009 03:27 PM


All times are GMT -4. The time now is 06:13 PM.


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