03-30-2018, 05:24 PM | #1 |
Junior Member
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? |
03-30-2018, 06:52 PM | #2 |
Sigil Developer
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.
|
03-30-2018, 06:53 PM | #3 |
Sigil Developer
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.
|
04-15-2018, 01:23 PM | #4 | |
Guru
Posts: 668
Karma: 929286
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
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. |
|
04-15-2018, 01:50 PM | #5 |
Grand Sorcerer
Posts: 27,549
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Very good suggestions/workarounds. Thanks.
|
Tags |
delete file in epub |
|
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 |