|
|
#1 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
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. |
|
|
|
|
|
#2 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,909
Karma: 153071045
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
As for nested CSS, I'm not for it at all. |
|
|
|
|
|
|
#3 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,682
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:
![]() I wonder if this is just another case of planned obsolescence so you MUST by a new one? |
|
|
|
|
|
|
#4 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
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 |
|
|
|
|
|
#5 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,273
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.
Last edited by DNSB; 04-12-2026 at 02:09 PM. |
|
|
|
|
|
#6 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
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. |
|
|
|
|
|
#7 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
According to DNSB's testing and feedback the added de-nest css code had to be replaced even though it did de-nest truly nested css properly it could not properly handle normal un-nested css.
So I want back to the drawing board and Sigil now has completely redesigned de-nest software that passes through un-nested css unchanged. @DNSB, Thank you! |
|
|
|
|
|
#8 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,273
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 with the fixed de-nest code from Sigil's Github repository: Sigil-2.7.6-Windows-x64-Setup.exe.
|
|
|
|
|
|
#9 |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,909
Karma: 153071045
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Is there any ePub reading software that handles nested CSS?
|
|
|
|
|
|
#10 | |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
Any ereader that uses a webkit or webengine core that was made in the last two years (2024?) probably could.
Quote:
Last edited by KevinH; 04-12-2026 at 02:58 PM. |
|
|
|
|
|
|
#11 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,909
Karma: 153071045
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
|
|
|
|
|
#12 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
My guess is native nested css would work just fine in Calibre and Sigil's Previewer right now.
|
|
|
|
|
|
#13 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,555
Karma: 6774048
Join Date: Nov 2009
Device: many
|
And if you think about it, as long as CSS and Html standards are live standards (whatwg) that continuously grow and change, the days of dedicated e-readers are either numbered or will require firmware updates quite often.
This is another reason why both Sigil and Calibre are constantly updating to the latest Qt and QtWebEngine versions. Last edited by KevinH; 04-12-2026 at 04:35 PM. |
|
|
|
![]() |
|
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 |