Epub puust ja punaseks
Epub fail kujutab endast tegelikult .zip faili mis minimaalselt sisaldab järgnevaid faile/kaustu:
- mimetype - tells a reader/operating system what's in here
- META-INF folder - This folder contains, at minimum, the container.xml file, which tells the reader software where in the zip file to find the book.
- OEBPS folder - (OPS kaust) Recommended location for the books content. It contains:
- images kaust - pildid lähevad siia
- toc.ncx - This is the table of Contents
- fonts folder (sisaldab ttf fonte)
- content1.xhtml - raamatu sisu
- content.opf - XML fail kus nimekiri zipi sees asuvatest failidest
Failide sisust lähemalt
The mimetype file has no extension, and the content must read exactly as follows:
The container.xml file, MIME type, and folder structure are pretty standard for all books. Images can be in PNG, JPEG, GIF or SVG format. I usually stick with PNG, with JPEG as a fall-back.
The epb.ncx file is the table of contents and is pretty straightforward.
The epb.opf file is the manifest where you set the meta data (title, author, ISBN, etc.), but it’s also where every other file in the EPUB is declared. Every image, HTML or CSS file must be listed here. It’s a pain in the butt and one reason why I personally avoid hand-coding EPUB if possible.
The CSS is pretty much what you’d expect, although a very limited subset. The HTML is also very straightforward. Below is a sample of the HTML.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>1 Moving Day | Ghost Hunters - Book 1 The Haunted House</title> <link rel="stylesheet" href="css/book.css" type="text/css"/> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><meta name="EPB-UUID" content="3B0A6B89-F890-4843-AA2A-01C27CE8D573"/> </head> <body> <div style="white-space:pre-wrap"> <div>CHAPTER 1</div> <div>Samantha and Dylan looked eagerly out the car window. Today was the day that they were moving to their new house. They were both excited, but sometimes a look of worry would cross Sam’s face.</div> </div> </body> </html>