Friday, January 27, 2012

The Guide

The guide, and I know this from personal experience, plays an important role in a mobipocket book. Not so, for an EPUB book. In EPUB Straight to the Point Elizabeth Castro says the guide is optional, its purpose to identify the role of the different files making up the book.

Not so in its mobipocket manifestation. Here, it serves as another table of contents, only this time for the "book" menu in the Kindle (or other mobipocket reading device) by turning the anchors created in the .html-formatted novel into selectable links. The Mobipocket Developer Center (see sidebar) describes guide items as content for the book’s "Go to" menu in the eReader.

For the Kindle, the "guide" requires only two anchors. Indeed, if I interpret Joshua Tallent's guidance correctly, only two are used by Kindle, the novel's "#toc" (the book’s table of contents) and "#start" (in the case of my book, River's Bend, the "start" is Chapter 1).

Other mobipocket devices use additional anchors and you can expand the guide if you like. River's Bend uses only the #toc and #start, since I figure if I can get the reader (by this I mean the human reader) to the toc, he/she can get anywhere else in the book.

If the guide is not formatted correctly, the reader can't get anywhere short of clicking the device's forward and reverse buttons. I know, because the "guide" was the last thing I had to unravel to get River's Bend to work correctly in mobipocket format.

I had trouble with River's Bend's "guide" section from the moment Mobipocket Creator produced the first .opf, but it was not until a month had passed following my first warning- and error-filled "build" and I had uploaded my hand-made files into the Creator's Publishing window and created a seemingly flawless "build" that I realized something was still wrong. In the Kindle Previewer, when I clicked on the Table of Contents in Kindle's menu on the top bar, I went to the cover. I couldn't get to any of the chapters, including chapter one the designated "beginning" (#start) of my book. Always, I went to the cover.

It took a little while longer and another review of the Joshua Tallent book to zero in on the "guide", which, in the section of his book of the same name (chapter 7), he states quite clearly that if the reference in the guide is incorrect, "Kindle will not contain active links to the Table of Contents and the Beginning of the book." Well, the "toc" and "start" reference types were both there, but my error proved to be in the href. My guide read thus:

<guide>
<reference type="toc" title="Table of Contents" href="Riversbend.html"></reference>
<reference type="start" title="Start" href="Riversbend.html"></reference>
</guide>

What it should have read (and now does) is this:

<guide>
<reference type="toc" title="Table of Contents" href="Riversbend.html#toc"></reference>
<reference type="start" title="Start" href="Riversbend.html#start"></reference>
</guide>

I fixed, I rebuilt, and I uploaded to the DTP. Amazon blessed it and put it in the Kindle Store. I downloaded it to my Kindle. It looked nice. I'd worked long and hard on it. I was so proud of the thing. That's when I noticed that when filling out my data on my DTP dashboard I spelled my name with three "s"s--Charlsie Russsell. No one would find me by that name. Could I have been any dumber? I was sick, afraid it would never upload right again.

Well, I guess I just answered my last question, didn't I? Amazon corrected it. Piece of cake, but it did elicit a final gasp and one last curse from silly me.

Hope some of you will find my struggle with creating a mobipocket book of use. Thanks so much for reading, and once again, comments are appreciated--especially if you can contribute ideas to improve my efforts at mobi production.

Charlsie

Friday, January 20, 2012

Manifest, Spine, and Tours

I decided to combine what I've learned about the manifest, spine, and tours sections of a mobipocket book's .opf document into one post. The first two are linked in that the "item id" in the manifest must match exactly the "itemref idref" in the spine. There’s not much to say about tours, but what I know, I share below.

First, I want to show you how River's Bend's final manifest, spine and tours sections turned out:

<manifest>
<item id="toc" media-type="application/x-dtbncx+xml" href="toc.ncx"></item>
<item id="item1" media-type="text/x-oeb1-document" href="Riversbend.html"></item>
<item id="item2" media-type="image/jpg" href="Riversbendcover.jpg" ></item>
<item id="item3" media-type="image/jpg" href="Riversbendlogo.jpg"></item>
</manifest>

<spine toc="toc">
<itemref idref="item1"/>
<itemref idref="item2"/>
<itemref idref="item3"/>
</spine>

<tours></tours>

The manifest lists the files that make up the mobipocket book, and the spine arranges the documents in a linear reading order. The manifest begins with a <manifest> element and contains an "itemid" for each "item" making up the book. Each item is annotated by its "media type," a declaration of what kind of item it is. Choices include "text" (the .html book), "image" (cover and/or logo and any other pictures in the book), "application," I assume that means how it's applied or used within the book (i.e. the navigational table of contents--.ncx file), and "font." That would be an embedded font, and I’m pretty certain embedded fonts are not applicable to a mobi book.

The section closes with the corresponding </manifest> tag. In the case of River's Bend, the manifest includes the toc.ncx file; the novel formatted in .html; and two graphics, one being the cover and the second, Loblolly Writer's House's logo, which appears on the book's title page. Four items, that's all.

The Spine section, as you’d expect, opens with a <spine> tag and closes with </spine>. In between, it tells the e-Reader (the machine not the person) the order in which to read the files. You can see the relationship between the item id in the manifest and the itemref idref noted in the opening paragraph of this post. Except for...

Okay, I admit it, the spine has caused me some confusion. In River's Bend's file, I called it, not "<spine>," but "<spine toc="toc">." My guidance came from Joshua Tallent in his example of the .opf file in Chapter 7 of Kindle Formatting (see sidebar).

Now, look at the manifest. The first item id in the manifest="toc" and its href is the "toc.ncx" file. Yes, that's right; it should be the toc.ncx element, but why isn't there a spine itemref idref like this

<spine>
<itemref idref="toc"/>

to make the spine parallel with the manifest?

First off, Elizabeth Castro states in Chapter 3 of EPUB Straight to the Point (see sidebar) that the spine element "must have a toc attribute whose value matches the value of the id in the item that referenced the toc.ncx file in the manifest." Now, I've noticed that what's right for epub more often than not is right for mobi. The two are kissing cousins, so that explains that. And although the "toc" attribute in the spine header is present (<spine="toc">) in Joshua Tallent's example, the itemref idref="toc" in the spine's body is not. His spine is very simple:

<spinetoc="toc">
<itemref idref="item1"/>
</spine>

"Item 1" in his example references the .html book itself, the reference to the table of contents being covered in the spine's opening tag.

Now, let's keep going. In April L. Hamilton's example of the spine in her Indie Author Guide To Publishing for The Kindle (see sidebar), there is an itemref idref="toc" in the body of the spine, but if you look at Liz Castro's example of the spine in Chapter 3 of EPUB Straight..., she does not place the itemref idref="toc" [or maybe it should read "ncx" ?] within the spine either.

I conclude that the digital book works either way. Which way is the correct way is a different matter. Certainly mine, without the itemref idref="toc" within the spine, works fine, and I'd be willing to bet everything April Hamilton formats works, too. By my own assessment (I've already told y'all I can be anal), I think the itemref idref="toc" should be in the body of the spine section. If so, River's Bend's spine should actually look like this:

<spine toc="toc">
<itemref idref="toc">
<itemref idref="item1"/>
<itemref idref="item2"/>
<itemref idref="item3"/>
</spine>

Anal or not, I'm not about to tempt fate. My River's Bend Kindle book works as is, and I "ain't" messin' with it. I will change the template, though, and see how Epico Bayou works with the itemref idref="toc" within the spine.

<tours></tours>

Here's how the International Digital Publishing Forum defines the <tours></tours> element: "A set of alternate reading sequences through the publication, such as selective views for various reading purposes, reader expertise levels, etc."

Got that? Neither did I.

River's Bend's "tours" section is empty. In truth, the tours section is deprecated. I do wonder what would happen if I deleted it from my .opf document altogether. I'd be willing to bet if my itemref idref="toc" missing from the body of my spine slips by unnoticed, the same would be true of a non-existing tours, but then I think if I ever understand its purpose, I might use it someday. It can be used and probably is by somebody somewhere. I’m just gonna leave it. Everyone else does.

Want to study more? My resources are in the sidebar.

Thanks for reading. Next week I plan to finish up the .opf file with the "guide" section.

Charlsie

Saturday, January 14, 2012

Metadata

A Mobipocket publication is an Open Publication Format (.opf) file composed of one master eXtensible Markup Language (.xml) file and multiple .html and graphic files. The master file, bearing the suffix .opf, is a text (.txt) document and contains data that points to the content files (i.e. the book and cover graphic) and includes the book's manifest, spine, and guide sections. But before those, the .opf file contains the book’s metadata.

The metadata section includes information about the book: author, publisher, description, identifier, etc., which allows the buyer to find the book. This section also has a subset, which includes the output encoding, the embedded cover graphic, and the price of the book.

The metadata section begins with two metadata namespace attributes: Dublin Core metadata specifications (dc-metadata) and “open ebook” specifications (oebps), which keeps the .xml document valid. The dc-metadata elements, oebps elements, and x-metadata were deprecated with the launch of the ePub format in 2007, but the Mobipocket format continues to use them.

Here’s what those statements look like:

<metadata>
<dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/">

And here’s the rest of River’s Bend’s metadata section:

<dc:Title>River's Bend</dc:Title>
<dc:Language>en-us</dc:Language>
<dc:Identifier id="uid">978-09769824-8-7</dc:Identifier>
<dc:Creator>Russell, Charlsie</dc:Creator>
<dc:Publisher>Loblolly Writer’s House</dc:Publisher>
<dc:SubjectBASICCode="FIC014000">Historical Fiction</dc:Subject>
<dc:Description>Thirty years following the War Between the States a handsome stranger comes to Mississippi and marries a cast-away beauty in exchange for a now decrepit antebellum home steeped in dark history and rumored to hold the secret to a fortune in missing Yankee gold. Mystery, suspense, and romance that will keep the lights on and the pages turning until the final mystery is solved.</dc:Description>
<dc:Date>12/21/2011</dc:Date>
</dc-metadata>

<x-metadata>
<output encoding="utf-8" content-type="text/x-oeb1-document" </output>
<Embeddedcover>RBcvrkindle.jpg</Embeddedcover>
<SRP currency="USD">2.99</SRP>
</x-metadata>
</metadata>

For those of you who want to delve further into the “why’s” of a mobipocket book, here are the sources I used: Joshua Tallent’s Kindle Formatting, April I. Hamilton’s Indie Author Guide To Publishing For the Kindle..., the Mobipocket Development Center website, the International Digital Publishing Forum website, the Dublin Core website, and good ole Wikipedia.

I love it when this stuff starts making sense, even if just “sorta.” Next week I'll discuss the “manifest, spine, and tours.”

And if anyone is interested in how my baby looks on Kindle I'd love for you to go over and take a look at the Kindle Store.





Thanks for reading,

Charlsie

Saturday, January 7, 2012

Mobipocket's OPF File Part 1

Of the three .txt files making up the mobipocket version of my first Kindle book, River's Bend, I found the .opf file the hardest “to get right.” The .opf or open (ebook) package format has a number of sections, all different, but related, making its structure confusing. Accuracy, however, is critical.

Mobipocket Creator produced River’s Bend's original .opf file in a subfolder on my hard drive way back in November when I first hit “build” in the Creator’s publishing window. The book built with 56 warnings and three errors and it continued to produce a significant number of warnings and errors “build” after “build”. The warnings I soon associated with my chapter heads and pages containing front and back matter. Mobipocket Creator identified the errors as a missing cover and missing table of contents (the latter, no doubt, the cause of those 56 warnings). The problem (and solution) was the .opf file. Simply put, the .opf file is the glue that holds the digital book together--it’s what makes the e-reader (Kindle, Nook, ipad, whatever) work. It’s the “brain” of the digital book, and if its circuitry isn’t right, the book is screwy.

The .opf file is an .xml (eXtensible markup language) file, which, as I understand it, is a container file within which .html and .xhtml/.css (used for EPUB) languages are placed. I have no idea what else .xml files are used for, but certainly they contain .txt documents belonging to digital books, because that’s what the mobi and epub .opf files are--.txt files. Regardless, .xml is equal to, but different than the formatted text that goes into them. Think of the combo as “language within a container”--assuming you want to think about it at all. For our purpose here, you really don’t have to. Suffice it to say, the format for this file is rigid, if simple. All you have to do is get the letters, numbers, and goofy-looking characters in the right place and you can create your own .opf file from scratch.

BUT, Mobipocket Creator can create one for you based on the data you feed its publication window.  River’s Bend’s first .opf file I liken to a shell. The Creator produced a perfectly formatted header for me as well as all the sections, but a lot of needed information was missing. Further, the file was not well structured. The solution was to edit it. Given the .opf file is a .txt document, the ideal editor is Notepad++. If you don’t already have that particular software, go here for a free download.

I edited River’s Bend's .opf file from the dc:identifier down. I also broke down the sections so I could "see" them. My Mobipocket Creator-produced file ran from the left to the right side of the screen, then disappeared from view. It’s hard to work with that, and even scrolling doesn’t organize the sections so I can tell where one section/subsection ends and the next one begins. Clearly, carriage returns were needed.

The mobi .opf file consists of five sections wrapped up within a package.
The sections are:
(1) Metadata
(2) Manifest
(3) Spine
(4) Tours (unused)
(5) Guide

Over the next several weeks I intend to detail the .opf file section by section. I’ll start next week with metadata. My goal to produce a mobi book evolved into a plan to create a template whereby I could produce from scratch the files required to build a mobi book. By this, I mean, not using Mobipocket Creator to create the “files.” I think I’ve accomplished that--I'm happy to announce that River's Bend is now for sale at the Kindle Store.

Using the Creator to produce the .prc book for upload to the DTP is a different matter and will be the subject of a later post. Thanks for reading.

Charlsie