View Single Post
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: 681
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