Documentation
¶
Overview ¶
Package epub provides basic support for reading EPUB archives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoRootfile occurs when there are no rootfile entries found in // container.xml. ErrNoRootfile = errors.New("epub: no rootfile found in container") // ErrBadRootfile occurs when container.xml references a rootfile that does // not exist in the zip. ErrBadRootfile = errors.New("epub: container references non-existent rootfile") // ErrNoItemref occurrs when a content.opf contains a spine without any // itemref entries. ErrNoItemref = errors.New("epub: no itemrefs found in spine") // ErrBadItemref occurs when an itemref entry in content.opf references an // item that does not exist in the manifest. ErrBadItemref = errors.New("epub: itemref references non-existent item") // ErrBadManifest occurs when a manifest in content.opf references an item // that does not exist in the zip. ErrBadManifest = errors.New("epub: manifest references non-existent item") )
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container struct {
Rootfiles []*Rootfile `xml:"rootfiles>rootfile"`
}
Container serves as a directory of Rootfiles.
type Item ¶
type Item struct {
ID string `xml:"id,attr"`
HREF string `xml:"href,attr"`
MediaType string `xml:"media-type,attr"`
// contains filtered or unexported fields
}
Item represents a file stored in the epub.
type Manifest ¶
type Manifest struct {
Items []Item `xml:"manifest>item"`
}
Manifest lists every file that is part of the epub.
type Metadata ¶
type Metadata struct {
Title string `xml:"metadata>title"`
Language string `xml:"metadata>language"`
Identifier string `xml:"metadata>idenifier"`
Creator string `xml:"metadata>creator"`
Contributor string `xml:"metadata>contributor"`
Publisher string `xml:"metadata>publisher"`
Subject string `xml:"metadata>subject"`
Description string `xml:"metadata>description"`
Event []struct {
Name string `xml:"event,attr"`
Date string `xml:",innerxml"`
} `xml:"metadata>date"`
Type string `xml:"metadata>type"`
Format string `xml:"metadata>format"`
Source string `xml:"metadata>source"`
Relation string `xml:"metadata>relation"`
Coverage string `xml:"metadata>coverage"`
Rights string `xml:"metadata>rights"`
}
Metadata contains publishing information about the epub.
type ReadCloser ¶
type ReadCloser struct {
Reader
// contains filtered or unexported fields
}
ReadCloser represents a readable epub file that can be closed.
func OpenReader ¶
func OpenReader(name string) (*ReadCloser, error)
OpenReader will open the epub file specified by name and return a ReadCloser.
func (*ReadCloser) Close ¶
func (rc *ReadCloser) Close()
Close closes the epub file, rendering it unusable for I/O.
type Reader ¶
type Reader struct {
Container
// contains filtered or unexported fields
}
Reader represents a readable epub file.
Click to show internal directories.
Click to hide internal directories.