Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-30-2018, 05:24 PM   #1
n9qqk
Junior Member
n9qqk began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Feb 2018
Device: Nook Simple Touch; Kindle Fire
Sigil Deleting a file on save.

I wrote a program to clean up the OPF file in my EPUBs. Being cautious, in addition to saving the cleaned OPF, I save the old OPF with an OPFO suffix. I can then restore (with WinRAR) the old OPF if my cleaning broke anything.

I've just noticed that if I open the cleaned EPUB in SIGIL, and then do a SAVE,
the OPFO file is no longer in the saved EPUB. My question is why? The OPFO isn't hurting anything. Is SIGIL actively getting rid of unnecessary files in the EPUB?
n9qqk is offline   Reply With Quote
Old 03-30-2018, 06:52 PM   #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: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
Sorry but that is expcted behaviour. Sigil is for editing epubs not hiding files inside the epub.. If you want to save an opf file, simply use "open with" to edit the file and save it to someplace else. Yes, if a file is not properly registered in the manifest of the epub then it will not be written out.
KevinH is offline   Reply With Quote
Old 03-30-2018, 06:53 PM   #3
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: 7,644
Karma: 5433388
Join Date: Nov 2009
Device: many
This is also true for file extensions not recognized in the IDPF epub standard as recognized resource types.
KevinH is offline   Reply With Quote
Old 04-15-2018, 01:23 PM   #4
AlanHK
Guru
AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.AlanHK ought to be getting tired of karma fortunes by now.
 
AlanHK's Avatar
 
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
Quote:
Originally Posted by KevinH View Post
This is also true for file extensions not recognized in the IDPF epub standard as recognized resource types.
So don't use a made-up resource type, (mis)use a recognised resource type:

If you want to stash a backup file (or any file at all) in an epub, save it out, or extract with a unzipper. Rename it with a font suffix:

e.g. content.opf.otf
Now "Add existing files" and import the otf. Sigil will put it in the Fonts folder.
(It won't check its contents if you don't try to use it as a font i.e., reference it in a font declaration.)

It's in the manifest as :

<item id="content.opf.otf" href="Fonts/content.opf.otf" media-type="application/vnd.ms-opentype"/>
And it passes epubcheck.

(if you are doing this outside Sigil, you'd need to add this declaration to the manifest in the (new) OPF.)

You can access the text to copy, read or change in Sigil, using right-click "Open with" and choose Notepad or any text editor. Then you can copy and paste from that to the current OPF file.

Another way: use the css type: do "Add blank stylesheet".

Copy-paste all the opf text into it. Save. This will work, but if you do epubcheck it will give you errors.
If you want to avoid that, open a C-style comment at the top and close at the bottom of the file and the entire contents will be ignored:

/*
... OPF code
*/

-- and this has a declaration:
<item id="Style0001.css" href="Styles/Style0001.css" media-type="text/css"/>


Related issue: I found you cannot comment out text in the OPF, since Sigil only stores parseable text. Comments are deleted on saving, or opening if left by another editor.

But you CAN put comments in HTML files (with HTML comment tags :
<!-- Whatever -->
and they will be preserved. So you could paste the contents of the OPF, or any other text, inside a comment in a HTML file. Might be the simpler way if you just want to keep a few lines of code.
But not everything is hidden inside a comment.
Seems for instance that -- (2 hyphens) causes an error.

Last edited by AlanHK; 04-15-2018 at 01:57 PM.
AlanHK is offline   Reply With Quote
Old 04-15-2018, 01:50 PM   #5
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: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Very good suggestions/workarounds. Thanks.
DiapDealer is offline   Reply With Quote
Reply

Tags
delete file in epub


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sigil Error Message: Book File Would Not Open in Sigil fkustaa Sigil 5 03-18-2017 12:54 AM
the 'save' file feature on Sigil abethan53 Introduce Yourself 6 06-15-2013 07:33 AM
Sigil Save As... Fabe Sigil 5 01-20-2012 08:55 PM
Sigil 1.6 - deleting blank line very slow lol Sigil 2 12-24-2009 11:54 AM
Save File location and Save As question DougFNJ Calibre 0 09-17-2009 04:56 PM


All times are GMT -4. The time now is 01:09 AM.


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