View Single Post
Old 08-24-2010, 03:19 AM   #11652
Sweetpea
Grand Sorcerer
Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.Sweetpea ought to be getting tired of karma fortunes by now.
 
Sweetpea's Avatar
 
Posts: 9,707
Karma: 32763414
Join Date: Dec 2008
Location: Krewerd
Device: Pocketbook Inkpad 4 Color; Samsung Galaxy Tab S6
Quote:
Originally Posted by phenomshel View Post
Is it just a text file with the extension .opf?

Yes

It's actually rather simple at that!

Here's an example of the metadata.opf I use to create my epub and mobi books:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="bookid">
	<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
		<dc:identifier id="bookid">[Book ID]</dc:identifier>
		<dc:title>[Book Title]</dc:title>
		<dc:creator opf:file-as="[Author]" opf:role="aut">[Author]</dc:creator>
		<dc:creator opf:file-as="[Author 2]" opf:role="aut">[Author]</dc:creator>
		<dc:language>en</dc:language>
		<dc:subject>[subject]</dc:subject>
		<meta name="cover" content="cover" />
	</metadata>
	<manifest>
		<item id="ncx" href="toc.ncx" media-type="application/x-dtbncx+xml"/>
		<item id="stylesheetMain" href="content/styles/main.css" media-type="text/css" />
		<item id="stylesheetTOC" href="content/styles/toc.css" media-type="text/css" />

		<item id="cover" href="content/images/cover.jpg" media-type="image/jpeg" />
		<item id="html-cover" href="content/cover.html" media-type="application/xhtml+xml" />

		<item id="titlepage" href="content/title.html" media-type="application/xhtml+xml" />
		<item id="toc" href="content/toc.html" media-type="application/xhtml+xml"/>
		<item id="text" href="content/text.html" media-type="application/xhtml+xml" />

		<item id="image_1" href="content/images/[image-name].jpg" media-type="image/jpeg" />
	</manifest>
	<spine toc="ncx">
		<itemref idref="html-cover" linear="no" />
		<itemref idref="titlepage" />
		<itemref idref="toc" />
		<itemref idref="text" />
	</spine>
	<guide>
		<reference type="cover" title="Cover Image" href="content/cover.html" />
		<reference type="title-page" title="Title page" href="content/title.html"/>
		<reference type="toc" title="Table of Contents" href="content/toc.html" />
	</guide>
</package>
Now, your XHTML files go to the "<manifest>" part. (<item id="titlepage" href="content/title.html" media-type="application/xhtml+xml" /> for example).

The HREF is the location of the file, relative to where you put the .OPF file. Id must be unique.

The <spine> is where you add them all together, in order. Actually the same as a real paper (or leather or any other material!) spine works. I'm not sure if epub uses the <guide>, but that's what you'll see in mobipocket books.

And XHTML is the same as HTML.
Sweetpea is offline   Reply With Quote