Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 07:00 AM   #1
philja
Evangelist
philja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enough
 
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.
philja is offline   Reply With Quote
Old Yesterday, 07:48 AM   #2
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,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.
KevinH is offline   Reply With Quote
Old Yesterday, 08:31 AM   #3
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
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?
Can confirm that this is not the case. The newly added (templated) css file has its contents wiped out regardless of any css links in the existing xhtml file being added. In my case, it imported an image, and another differently named css file while erasing the contents of the newly added (templated) css file.

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.
DiapDealer is online now   Reply With Quote
Old Yesterday, 09:06 AM   #4
philja
Evangelist
philja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enoughphilja will become famous soon enough
 
Posts: 404
Karma: 518
Join Date: Nov 2015
Location: Europe EEC
Device: Kindle Fire HD6 & HD8
Quote:
Originally Posted by KevinH View Post
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.
The back-matter file did have a link to a style sheet but not the same name.

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.
Attached Files
File Type: zip Archive.zip (1.0 KB, 6 views)
philja is offline   Reply With Quote
Old Yesterday, 09:17 AM   #5
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,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.
KevinH is offline   Reply With Quote
Old Yesterday, 09:19 AM   #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,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.
KevinH is offline   Reply With Quote
Old Yesterday, 10:58 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Will adding
Code:
new_resource->SaveToDisk();
to BookBrowser::AddNewCSS be enough, or should we check to see if it contains any data (added from the user template via Book::CreateEmptyCSSFile) first?

It seems to work well enough without checking for data first in my testing.

Last edited by DiapDealer; Yesterday at 11:01 AM.
DiapDealer is online now   Reply With Quote
Old Yesterday, 11:03 AM   #8
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,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.
KevinH is offline   Reply With Quote
Old Yesterday, 11:08 AM   #9
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,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.
KevinH is offline   Reply With Quote
Old Yesterday, 11:20 AM   #10
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by KevinH View Post
So perhaps right after this line unconditionally?

https://github.com/Sigil-Ebook/Sigil...522C18-L522C19

Does that work?
I'll rebuild and check. I was doing it in BookBrowser (Similar to how AddNewJS uses it).
DiapDealer is online now   Reply With Quote
Old Yesterday, 11:31 AM   #11
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
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.
DiapDealer is online now   Reply With Quote
Old Yesterday, 11:39 AM   #12
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,947
Karma: 7500000
Join Date: Nov 2009
Device: many
I do not have access to a Desktop now. Would you please push that fix?
KevinH is offline   Reply With Quote
Old Yesterday, 12:08 PM   #13
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 29,664
Karma: 212299010
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Sure thing.
DiapDealer is online now   Reply With Quote
Old Yesterday, 12:35 PM   #14
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,947
Karma: 7500000
Join Date: Nov 2009
Device: many
Thanks!

And thank you philja for your bug report and test case to reproduce it!
KevinH is offline   Reply With Quote
Old Yesterday, 02:36 PM   #15
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: 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.
DNSB is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 03:07 PM.


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