08-22-2016, 04:12 PM | #1 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Unifying stylesheets
Unifying stylesheets.
I have the habit to use two stylesheets. One is produced converting the odt source file, the other is automatically inserted, if need be. Once I finish tweaking the styles and polishing the EPUB, I use the Calibre editor to suppress the unused CSS rules (Sigil can do it too). Then I can mix (fusionner) the remaining parts ot the two stylesheets. However this process only puts one stylesheet on top of another. I would like to do better. Question: I would like to know how to sort the items on the stylesheet to get a cleaner result and this way display possible redundancies like. Code:
body body h2 h2 p p .small .small Last edited by roger64; 08-22-2016 at 04:15 PM. |
08-22-2016, 04:23 PM | #2 |
Grand Sorcerer
Posts: 6,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Look at this message.
|
Advert | |
|
08-22-2016, 04:38 PM | #3 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
I think the only way to do this reliably is using programming tools which understand how CSS works. I know it can be done using a combo of Python and cssutils in a calibre user interface plugin or calibre editor plugin but some programming skills are required.
|
08-22-2016, 05:11 PM | #4 |
Grand Sorcerer
Posts: 6,233
Karma: 11768331
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
@jackie_w, for sorting items the plugin is enough, no programming skills needed.
|
08-22-2016, 05:16 PM | #5 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
|
Advert | |
|
08-22-2016, 05:50 PM | #6 |
Wizard
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
I try it.
Thanks for your replies. I tried it with Calibre book-edit but it failed... Traceback (most recent call last): File "calibre_plugins.sortcss.main", line 83, in sort_stylesheets File "calibre_plugins.sortcss.main", line 117, in sort_stylesheet File "calibre_plugins.sortcss.main", line 117, in <lambda> AttributeError: 'CSSFontFaceRule' object has no attribute 'selectorText' I'll ask for support on the Calibre forum Last edited by roger64; 08-22-2016 at 06:04 PM. |
08-22-2016, 06:29 PM | #7 |
Well trained by Cats
Posts: 29,801
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Stylesheets work on 'Last processed', is what gets used
so those with 2 definitions If they both contain some of the same attributes, the last definition prevails, otherwise they merge. But why make it obscure? Do the 'Combine' with an editor and KISS Old, Arnold era Baen CSS had 3 body definitions over 3 stylesheets (one tha had no entries), obvious remnants of evolved 'automation' . Part ov my cleanup was to replace those 3 with a Single, clean CSS that did exactly the same in the end |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with stylesheets in Calibre | hikerguy | Editor | 8 | 04-01-2015 02:30 AM |
Stylesheets | Phylis Sophical | Sigil | 10 | 10-28-2014 03:56 PM |
error in linking stylesheets | eschwartz | Editor | 3 | 01-09-2014 02:25 AM |
Alternate stylesheets | Jellby | ePub | 1 | 08-19-2011 06:44 PM |
User stylesheets for ePub files | salty-horse | Sony Reader Dev Corner | 12 | 02-23-2010 07:44 AM |