Documentation ¶
Index ¶
- Constants
- type Container
- type Epub
- func (epub *Epub) Close()
- func (epub *Epub) GetContentByHref(href HRef) (string, error)
- func (epub *Epub) GetContentByManifestId(id ManifestId) (string, error)
- func (epub *Epub) GetFullPath(href HRef) string
- func (epub *Epub) GetNextSection(id ManifestId) (string, ManifestId, error)
- func (epub *Epub) GetPrevSection(id ManifestId) (string, ManifestId, error)
- func (epub *Epub) GetSpinContent() (*SpineContent, error)
- func (epub *Epub) GetTableOfContent() *TableOfContent
- func (epub *Epub) HrefToManifestId(href HRef) ManifestId
- func (epub *Epub) ManifestIdToHref(id ManifestId) HRef
- func (epub *Epub) Open() error
- func (epub *Epub) Title() string
- type HRef
- type ManifestId
- type Rootfile
- type SpineContent
- type TableOfContent
- type Toc
Constants ¶
View Source
const (
ContainerFilename = "META-INF/container.xml" // filename of container.xml
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Epub ¶
type Epub struct { Filename string Container Container Rootfile Rootfile Toc Toc SeqFiles []*zip.File Files map[string]*zip.File Styles []*cssparser.Rule // contains filtered or unexported fields }
func (*Epub) GetContentByHref ¶
GetContentByHref return file content by href(setted in spine)
func (*Epub) GetContentByManifestId ¶
func (epub *Epub) GetContentByManifestId(id ManifestId) (string, error)
GetContentByManifestId return file content by manifest id
func (*Epub) GetFullPath ¶
GetFullPath return full filepath(relative to rootfile) by href(setted in spine)
func (*Epub) GetNextSection ¶
func (epub *Epub) GetNextSection(id ManifestId) (string, ManifestId, error)
func (*Epub) GetPrevSection ¶
func (epub *Epub) GetPrevSection(id ManifestId) (string, ManifestId, error)
func (*Epub) GetSpinContent ¶
func (epub *Epub) GetSpinContent() (*SpineContent, error)
GetSpinContent return all spine content in `href: html content` format
func (*Epub) GetTableOfContent ¶
func (epub *Epub) GetTableOfContent() *TableOfContent
func (*Epub) HrefToManifestId ¶
func (epub *Epub) HrefToManifestId(href HRef) ManifestId
func (*Epub) ManifestIdToHref ¶
func (epub *Epub) ManifestIdToHref(id ManifestId) HRef
type Rootfile ¶
type Rootfile struct { Metadata struct { Rights string `xml:"rights"` ISBN string `xml:"identifier"` Title string `xml:"title"` Description string `xml:"description"` Creator string `xml:"creator"` Date string `xml:"date"` Publisher string `xml:"publisher"` Language string `xml:"language"` Format string `xml:"format"` } `xml:"metadata"` Manifest struct { Items []struct { ID ManifestId `xml:"id,attr"` Href HRef `xml:"href,attr"` MediaType string `xml:"media-type,attr"` } `xml:"item"` } `xml:"manifest"` Spine struct { TocID ManifestId `xml:"toc,attr"` Items []struct { IDref ManifestId `xml:"idref,attr"` Link string `xml:"linear,attr"` } `xml:"itemref"` } `xml:"spine"` Guide struct { Items []struct { Type string `xml:"type,attr"` Href string `xml:"href,attr"` Title string `xml:"title"` } `xml:"reference"` } `xml:"guide"` }
type SpineContent ¶
type SpineContent struct { Orders []ManifestId Contents map[ManifestId]string }
type TableOfContent ¶
type TableOfContent struct { Orders []string // Titles in order Content map[string]struct { Level int ID ManifestId } }
type Toc ¶
type Toc struct { Head struct { Metas []struct { Name string `xml:"name,attr"` Value string `xml:"content,attr"` } `xml:"meta"` } `xml:"head"` DocTitle struct { Text string `xml:",chardata"` } `xml:"docTitle"` //TODO(elinx): better way to express nested navPoint NavPoints []struct { ID string `xml:"id,attr"` PlayOrder string `xml:"playOrder,attr"` NavLable struct { Text string `xml:",chardata"` } `xml:"navLabel>text"` Content struct { Src HRef `xml:"src,attr"` } `xml:"content"` NavPoints []navPoint `xml:"navPoint"` } `xml:"navPoint"` } `xml:"navMap"` }
Click to show internal directories.
Click to hide internal directories.