|
|
#1 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
|
|
#2 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
As for nested CSS, I'm not for it at all. |
|
|
|
|
|
|
#3 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
![]() I wonder if this is just another case of planned obsolescence so you MUST by a new one? |
|
|
|
|
|
|
#4 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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 |
|
|
|
|
|
#5 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 51,179
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.
|
|
|
|
|
|
#6 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
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 |