|
|
#1 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() Posts: 404
Karma: 518
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6 & HD8
|
Unexpected erasure of the style sheet contents
In Sigil 2.8.1 Mac, Linux and Windows11.
These are the steps I took: 1. Start a new default file (epub3) 2. Add a new blank stylesheet - this correctly opens my epub3 template, renaming it to Style001.css 3. Check contents of the stylesheet - all good and as expected from the template 4. 'Add Existing File' to add a ready made back-matter.xhtml file from the computer - it opens correctly 5. recheck contents of the stylesheet - all obliterated - the style sheet still exists but is completely blank. Is this expected behaviour? The order appears critical. Changing the order to 1. 4. 2. 3. and the result is correct. Also, 'adding an existing' xhtml file from the computer to an existing epub3 doesn't wipe out the stylesheet. |
|
|
|
|
|
#2 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
That should not happen.
Using AddExisting on an xhtml file has always pulled in any properly linked images and stylesheets automatically. So did your backmatter xhtml already have a link to a stylesheet with the exact same name? Did that pulled in stylesheet file actually exist at the relative location pointed to in the backmatter file? Either way, please attach as zips to this thread the stylesheet file and backmatter .xhtml (scramble the xhtml and cut the stylesheet down to just one class if needed) but keep all file names exactly as they were and include any img files or stylesheets that had proper relative links to your backmatter code. That way we can try to recreate what you are seeing. And fwiw, loading a prebuilt official template eoub with all base pieces already in place is a much faster way to get started. Epub templates can be created for both epub2 and epub3 style epubs and co-exist in your Sigil Prefs folder happily. Last edited by KevinH; Yesterday at 07:55 AM. |
|
|
|
|
|
#3 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
In case it helps track things down, this behavior can be eliminated by saving the epub after adding the new (templated) css file (before adding the xhtml file). And it does need to be a templated css file to reproduce. I tried adding an empty css file (no template) and then adding something to the new css file before adding the xhtml file and nothing got erased after Add Existing (xhml file). Seems to me that until saving the epub (after adding the templated css file with Add Empty CSS), nothing has been flushed to disk prior to running Add Existing and something is getting lost in the mix somehow. Last edited by DiapDealer; Yesterday at 09:51 AM. |
|
|
|
|
|
|
#4 | |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() Posts: 404
Karma: 518
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6 & HD8
|
Quote:
I've confected a couple of files for demonstration: user-template3.css and back-matter.xhtml. The problem works with these two if you respect the order of steps I described. |
|
|
|
|
|
|
#5 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Great. And I think DiapDealer hit the nail on its head. We are missing a flush to disk or save to file someplace. It used to be explicitly done for every css file added by add existing. Somehow that got lost or it was never done properly on templated css.
Probably the latter. |
|
|
|
|
|
#6 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Since lots of things start with a flush to disk, we probably never noticed it was not done on templated CSS.
|
|
|
|
|
|
#7 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Will adding
Code:
new_resource->SaveToDisk(); It seems to work well enough without checking for data first in my testing. Last edited by DiapDealer; Yesterday at 11:01 AM. |
|
|
|
|
|
#8 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Yes that would fix it. If the problem only happens with the template maybe we put that change on that path. But if it happens with the css from any blank epub, then make it unconditional.
|
|
|
|
|
|
#9 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
So perhaps right after this line unconditionally?
https://github.com/Sigil-Ebook/Sigil...522C18-L522C19 Does that work? Last edited by KevinH; Yesterday at 11:14 AM. |
|
|
|
|
|
#10 | |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
|
|
|
|
|
#11 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yes. That seems to work unconditionally in that location as well. Regardless of whether the "blank" css is created empty, or created from the user template data.
|
|
|
|
|
|
#12 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
I do not have access to a Desktop now. Would you please push that fix?
|
|
|
|
|
|
#13 |
|
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Sure thing.
|
|
|
|
|
|
#14 |
|
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,947
Karma: 7500000
Join Date: Nov 2009
Device: many
|
Thanks!
And thank you philja for your bug report and test case to reproduce it! |
|
|
|
|
|
#15 |
|
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 53,795
Karma: 181843001
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
For those who want to test this fix: Sigil-2.8.1-Windows-x64-Setup.exe.
The SHA-256 for this file is: A5A83015227FBBB10CC5D8BAB46BD5325CE62F3E8108125D7B 670EAC47A604F5 One note is that the image popup code has been removed. |
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unexpected Missing Generic Font Family (Style Sheet.css) | Seth H | Editor | 3 | 09-29-2024 08:49 AM |
| Crazy style sheet | jiembe | Editor | 10 | 12-20-2020 07:48 PM |
| Style Sheet entry for a 'hanging' style | AThirstyMind | Kindle Formats | 6 | 12-10-2016 12:28 AM |
| Print style sheet | ronaldl | Sigil | 2 | 10-29-2012 04:32 PM |
| Missing style sheet | mauvais | Barnes & Noble NOOK | 3 | 12-05-2011 06:29 PM |