EPUB

From BrycesWiki
Jump to navigationJump to search

The EPUB standard is a fairly new standard from an organization known as IDPF. It is an attempt to create the eBook equivalent of MP3s.


Description

EPUB, like MOBI, is an ebook standard that scales according to screen and window size, known as a reflowable format. As there were hardly any viable formats for eBooks that did not depend on screen size and cross-platform, the members of IDPF brought standards such as XML, XHTML, and Zip together into a new standard called EPUB.

Creation

The creation of EPUB eBooks is fairly simple, especially if one is familiar with HTML standards. In order to create such eBooks, one needs four files.

Content OPF

All EPUB files must have a listing of all files included in the zip. This helps to ensure that the reader can find all the contents of that particular eBook.

<?xml version="1.0"?>

<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="dcidid" 
   version="2.0"> 
   <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" 
      xmlns:dcterms="http://purl.org/dc/terms/" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:opf="http://www.idpf.org/2007/opf"> 
      <dc:title>Man's Punishment</dc:title> 
      <dc:language xsi:type="dcterms:RFC3066">en</dc:language> 
      <dc:identifier id="dcidid" opf:scheme="None">
         </dc:identifier> 
      <dc:subject>Crime Fiction
         </dc:subject> 
      <dc:description>There have been many murders recently. 
However, these aren't ordinary murder cases. The culprits are obvious, 
but they don't remember anything except for a bloody scene, the corpse, and a weapon with fresh blood dripping from it. 
Intrigued by these strange occurrences, 
a high schooler starts investigating, in order to find a way to prevent the problem. Eventually he falls victim to the incident as well. 
Can he find a solution to the plague of homicidal sleepwalkers?</dc:description> 
      <dc:relation>Bryce</dc:relation> 
      <dc:creator>Bryce Campbell</dc:creator> 
      <dc:publisher>Bryce Campbell</dc:publisher> 
      <dc:date xsi:type="dcterms:W3CDTF">2010-11</dc:date> 
      <dc:rights>Copyright (c) 2010, Bryce Campbell</dc:rights>
	<meta name="cover" content="cover-image" /> 
   </metadata>

<manifest>
	<item id="ncx"      href="toc.ncx"                 
         media-type="application/x-dtbncx+xml" />  
      <item id="logical-toc"      href="toc.html"                 
         media-type="application/xhtml+xml" /> 
      <item id="css"      href="content.css"           
         media-type="text/css" />
	<item id="cover-page"    href="front.html"    
         media-type="application/xhtml+xml" />
	<item id="cover-image"    href="mp_cover.jpg"    
         media-type="image/jpeg" />
	<item id="copyright-page"    href="copyright.html"    
         media-type="application/xhtml+xml" />
	<item id="thanks"    href="thanks.html"    
         media-type="application/xhtml+xml" />
      <item id="title-page"    href="title.html"    
         media-type="application/xhtml+xml" /> 
      <item id="p1" href="p1.html" 
         media-type="application/xhtml+xml" />
      <item id="ch1"    href="ch1.html"        
         media-type="application/xhtml+xml" />
	<item id="ch2"    href="ch2.html"        
         media-type="application/xhtml+xml" />
	<item id="ch3"    href="ch3.html"        
         media-type="application/xhtml+xml" />
	<item id="ch4"    href="ch4.html"        
         media-type="application/xhtml+xml" />
	<item id="ch5"    href="ch5.html"        
         media-type="application/xhtml+xml" />
	  <item id="p2"    href="p2.html"        
         media-type="application/xhtml+xml" /> 
      <item id="ch6"    href="ch6.html"        
         media-type="application/xhtml+xml" />
	<item id="ch7"    href="ch7.html"        
         media-type="application/xhtml+xml" />
	<item id="ch8"    href="ch8.html"        
         media-type="application/xhtml+xml" />
	  <item id="p3"    href="p3.html"        
         media-type="application/xhtml+xml" /> 
      <item id="ch9"    href="ch9.html"        
         media-type="application/xhtml+xml" />
      <item id="find"    href="find.html"        
         media-type="application/xhtml+xml" />
	  <item id="about"    href="about.html"    
         media-type="application/xhtml+xml" />
	  <item id="coverback"    href="back.html"    
         media-type="application/xhtml+xml" />
	  <item id="coverback-image"    href="mp_cover_back.jpg"    
         media-type="image/jpeg" />
   </manifest> 

<spine toc="ncx">
<itemref idref="cover-page" />
<itemref idref="copyright-page" />
<itemref idref="thanks" />
<itemref idref="title-page" />
<itemref idref="logical-toc" />
<itemref idref="p1" />
<itemref idref="ch1" />
<itemref idref="ch2" />
<itemref idref="ch3" />
<itemref idref="ch4" />
<itemref idref="ch5" />
<itemref idref="p2" />
<itemref idref="ch6" />
<itemref idref="ch7" />
<itemref idref="ch8" />
<itemref idref="p3" />
<itemref idref="ch9" />
<itemref idref="find" />
<itemref idref="about" />
<itemref idref="coverback" />
</spine>
<guide>
<reference type="cover" title="Cover page" href="front.html" />
<reference type="copyright-page" title="Copyright" href="copyright.html" />
<reference type="thanks" title="Special Thanks" href="thanks.html" />
<reference type="title-page" title="Title Page" href="title.html" />
<reference type="toc" title="Table of Contents" href="toc.html" />
<reference type="about" title="About Author" href="about.html" />
<reference type="back cover" title="Back Cover" href="back.html" />
</guide>
</package>

The above code creates a content.opf file that can be used in the creation of both EPUB and MOBI files.

TOC NCX

The toc.ncx file is the EPUBs table of contents. Unlike the OPF file, only HTML files must be listed.

<?xml version="1.0"?> 
<!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" 
   "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> 
<ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> 
   <head> 
      <meta name="dtb:uid" content= 
         "manspunishment.epub"/> 
      <meta name="dtb:depth" content="2"/> 
      <meta name="dtb:totalPageCount" content="0"/> 
      <meta name="dtb:maxPageNumber" content="0"/> 
   </head> 
   <docTitle> 
      <text>Man's Punishment</text> 
   </docTitle> 
   <navMap>
	<navPoint id="navPoint-1" playOrder="1"> 
         <navLabel> 
            <text>Cover Page</text> 
         </navLabel> 
         <content src="front.html"/> 
      </navPoint>  
	<navPoint id="navPoint-2" playOrder="2"> 
         <navLabel> 
            <text>Copyright Page</text> 
         </navLabel> 
         <content src="copyright.html"/> 
      </navPoint> 
      <navPoint id="navPoint-3" playOrder="3"> 
         <navLabel> 
            <text>Special Thanks</text> 
         </navLabel> 
         <content src="thanks.html"/> 
      </navPoint> 
      <navPoint id="navPoint-4" playOrder="4"> 
         <navLabel> 
            <text>Title</text> 
         </navLabel> 
         <content src="title.html"/> 
      </navPoint>  
      <navPoint id="navPoint-5" playOrder="5"> 
         <navLabel> 
            <text>Part 1:  The Mysterious Plague</text> 
         </navLabel> 
         <content src="p1.html"/>
	</navPoint>
   <navPoint id="navPoint-6" playOrder="6"> 
      <navLabel> 
               <text>Ch. 1</text> 
            </navLabel>
            <content src="ch1.html"/> 
         </navPoint>
	<navPoint id="navPoint-7" playOrder="7"> 
      <navLabel> 
               <text>Ch. 2</text> 
            </navLabel>
            <content src="ch2.html"/> 
         </navPoint>
	<navPoint id="navPoint-8" playOrder="8"> 
      <navLabel> 
               <text>Ch. 3</text> 
            </navLabel>
            <content src="ch3.html"/> 
         </navPoint>
	<navPoint id="navPoint-9" playOrder="9"> 
      <navLabel> 
               <text>Ch. 4</text> 
            </navLabel>
            <content src="ch4.html"/> 
         </navPoint>
	<navPoint id="navPoint-10" playOrder="10"> 
      <navLabel> 
               <text>Ch. 5</text> 
            </navLabel>
            <content src="ch5.html"/> 
         </navPoint>
         <navPoint id="navPoint-11" playOrder="11"> 
            <navLabel> 
               <text>Part 2:  The Investigation Starts</text> 
            </navLabel> 
            <content src="p2.html"/> 
         </navPoint>
		 <navPoint id="navPoint-12" playOrder="12"> 
         <navLabel> 
            <text>Ch. 6</text> 
         </navLabel> 
         <content src="ch6.html"/>
	</navPoint>
	 <navPoint id="navPoint-13" playOrder="13"> 
         <navLabel> 
            <text>Ch. 7</text> 
         </navLabel> 
         <content src="ch7.html"/>
	</navPoint>
	 <navPoint id="navPoint-14" playOrder="14"> 
         <navLabel> 
            <text>Ch. 8</text> 
         </navLabel> 
         <content src="ch8.html"/>
	</navPoint>

   <navPoint id="navPoint-15" playOrder="15"> 
      <navLabel> 
               <text>Part 3: The Only Solution</text> 
            </navLabel>
			<content src="p3.html"/> 
         </navPoint>
         <navPoint id="navPoint-16" playOrder="16"> 
            <navLabel> 
               <text>Ch. 9</text> 
            </navLabel> 
            <content src="ch9.html"/> 
         </navPoint> 
		    <navPoint id="navPoint-17" playOrder="17"> 
      <navLabel> 
               <text>Find More Works</text> 
            </navLabel>
			<content src="find.html"/> 
         </navPoint>
         <navPoint id="navPoint-18" playOrder="18"> 
            <navLabel> 
               <text>About Author</text> 
            </navLabel> 
            <content src="about.html"/> 
         </navPoint>
		 <navPoint id="navPoint-19" playOrder="19"> 
            <navLabel> 
               <text>Back Cover</text> 
            </navLabel> 
            <content src="back.html"/> 
         </navPoint> 
                    </navMap> 
</ncx> 

The code above is a simple table of content that gives details to each part, chapter, or other kind of page.

Container

All EPUBs must have the location of the OPF file specified. The location is specified in the container.xml file, which is located in the META-INF directory.

<?xml version="1.0"?>
<container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfiles>
	<rootfile full-path="content.opf" media-type="application/oebps-package+xml" />
</rootfiles>
</container>

The above code states that content.opf contains the list of files and that it is in the root directory of the EPUB.

MimeType

All EPUBs must be declared as epub files. The file is named mimetype.

application/epub+zip

The above tells the reading software that the file is not an ordinary zip file.

Zip Content

All EPUBs are basically Zip wrappers. To get a correctly made epub, run this command in a terminal emulator (e.g. Command Prompt (Windows) or Terminal (Mac/Linux/BSD))

zip -Xr9D <filename>.epub mimetype *

Other details

IDPF states that EPUBs must validate against XHTML1.1, but valid EPUBs can validate against XHTML 1.0.

Books

The following titles are available in EPUB format:

  • Death's Representatives by Bryce Campbell
  • Divinity's End by Bryce Campbell
  • Man's Punishment by Bryce Campbell