Documentation
¶
Index ¶
- type Author
- type Book
- func (b *Book) AddCover(path string, mimetype string, src io.Reader, options interface{}) (string, io.Writer, error)
- func (b *Book) AddFile(path string, mimetype string, src io.Reader, id string, options interface{}) (string, io.Writer, error)
- func (b *Book) AddPage(path string, mimetype string, src io.Reader, id string, options interface{}) (string, io.Writer, ugarit.TOCRef, error)
- func (b *Book) AddTOC(gen ugarit.IndexGenerator, id string) (string, error)
- func (b *Book) Close() error
- func (b *Book) SpineAttr(key, val string)
- func (b *Book) SubSectionStyle(sty ugarit.SectionStyle)
- func (b *Book) TOCChild(n int) ugarit.TOC
- func (b *Book) TOCLen() int
- type Content
- type Date
- type EPubOptions
- type Guide
- type Identifier
- type IndexGenerator
- func (gen *IndexGenerator) AddItem(item *html.Node) error
- func (gen *IndexGenerator) GetDocument() (io.Reader, error)
- func (gen IndexGenerator) GetId() string
- func (gen *IndexGenerator) GetMimeType() string
- func (gen *IndexGenerator) GetPathName() string
- func (gen IndexGenerator) GetPropertyValue() string
- type IndexOptions
- type Manifest
- type Metadata
- type Metatag
- type NavPoint
- type Ncx
- type Package
- type PageTarget
- type Reference
- type Signature
- type Spine
- type SpineItem
- type Store
- type TOCContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Author struct { Role string `xml:"role,attr,omitempty"` FileAs string `xml:"file-as,attr,omitempty"` Data string `xml:",chardata"` }
Author
type Book ¶
type Book struct { Package Package `xml:"package"` RootFolder string // contains filtered or unexported fields }
Book epub book
func New ¶
func New( target io.WriteCloser, Title []string, Language []string, identifier []string, Creator []Author, Publisher []string, Date []Date, signature Signature, metatag []Metatag, PageProgression string) (*Book, error)
Create a blank EPub Book
func (*Book) AddCover ¶
func (b *Book) AddCover(path string, mimetype string, src io.Reader, options interface{}) (string, io.Writer, error)
AddCover saves the Cover in the E-Book. Use it before saving any content to the E-Book
func (*Book) AddFile ¶
func (b *Book) AddFile(path string, mimetype string, src io.Reader, id string, options interface{}) (string, io.Writer, error)
AddFile stores the file in the E-Book. It does not include it in the TOC.
func (*Book) AddPage ¶
func (b *Book) AddPage(path string, mimetype string, src io.Reader, id string, options interface{}) (string, io.Writer, ugarit.TOCRef, error)
AddPage saves the page to the E-Book and adds an entry in the TOC pointing to it It calls AddFile. So, if you use this method, you don't need to call AddFile to save it otherwise it will be stored twice in the E-Book file.
func (*Book) AddTOC ¶
AddTOC saves the TOC file to the E-Book. Use it just before closing the E-Book
func (*Book) SubSectionStyle ¶
func (b *Book) SubSectionStyle(sty ugarit.SectionStyle)
SubSectionStyle sets the object to style the top level section of the TOC
type EPubOptions ¶
type Identifier ¶
type Identifier struct { Data string `xml:",chardata"` ID string `xml:"id,attr,omitempty"` Scheme string `xml:"scheme,attr,omitempty"` }
Identifier
type IndexGenerator ¶
type IndexGenerator struct {
// contains filtered or unexported fields
}
func NewIndexGenerator ¶
func NewIndexGenerator(lang string, uid string, tit string, auth string, b ugarit.Book) (*IndexGenerator, error)
Creates an index generator object
func (*IndexGenerator) AddItem ¶
func (gen *IndexGenerator) AddItem(item *html.Node) error
AddItem adds a new TOC entry
func (*IndexGenerator) GetDocument ¶
func (gen *IndexGenerator) GetDocument() (io.Reader, error)
GetDocument returns the XHTML content of the TOC file
func (IndexGenerator) GetId ¶
func (gen IndexGenerator) GetId() string
GetId returns the ID to use in the TOC OPF entry and the Spine TOC reference.
func (*IndexGenerator) GetMimeType ¶
func (gen *IndexGenerator) GetMimeType() string
GetMimeType returns the mimetype of the TOC file.
func (*IndexGenerator) GetPathName ¶
func (gen *IndexGenerator) GetPathName() string
GetPathName returns the relative pathname of the TOC file
func (IndexGenerator) GetPropertyValue ¶
func (gen IndexGenerator) GetPropertyValue() string
GetPropertyValue returns the the value to set in the property attribute of the TOC OPF entry. It is not defined in the EPub 2.x specs.
type IndexOptions ¶
type IndexOptions struct { IndexGenerator ugarit.IndexGenerator Id string Prop int }
type Manifest ¶
type Manifest struct { ID string `xml:"id,attr,omitempty"` Href string `xml:"href,attr"` MediaType string `xml:"media-type,attr"` MediaOverlay string `xml:"media-overlay,attr,omitempty"` }
Manifest manifest
type Metadata ¶
type Metadata struct { Xmlns string `xml:"xmlns:dc,attr"` Title []string `xml:"dc:title"` Language []string `xml:"dc:language"` Identifier []Identifier `xml:"dc:identifier"` Creator []Author `xml:"dc:creator"` Publisher []string `xml:"dc:publisher"` Date []Date `xml:"dc:date"` Signature *Signature `xml:"link,omitempty"` Metatag []Metatag `xml:"meta"` }
Metadata metadata
type Metatag ¶
type Metatag struct { Name string `xml:"name,attr,omitempty"` Langattr string `xml:"xml:lang,attr,omitempty"` Content string `xml:"content,attr,omitempty"` Data string `xml:",chardata"` }
Metatag
type Ncx ¶
type Ncx struct { XMLName struct{} `xml:"ncx"` Version string `xml:"version,attr"` Langattr string `xml:"xml:lang,attr"` Xmlns string `xml:"xmlns,attr"` Metatag []Metatag `xml:"head>meta"` Title string `xml:"docTitle>text,omitempty"` Author string `xml:"docAuthor>text,omitempty"` Points []NavPoint `xml:"navMap>navPoint"` Pages []PageTarget `xml:"pageList,omitempty"` }
Ncx OPS/toc.ncx
type Package ¶
type Package struct { XMLName struct{} `xml:"package"` Version string `xml:"version,attr"` Xmlns string `xml:"xmlns,attr"` UID string `xml:"unique-identifier,attr"` Metadata Metadata `xml:"metadata"` Manifest []Manifest `xml:"manifest>item"` Spine Spine `xml:"spine"` Guide Guide `xml:"guide,omitempty"` }
Package content.opf
type PageTarget ¶
type Spine ¶
type Spine struct { ID string `xml:"id,attr,omitempty"` Toc string `xml:"toc,attr,omitempty"` PageProgression string `xml:"page-progression-direction,attr,omitempty"` Itemref []SpineItem `xml:"itemref"` }
Spine spine
type SpineItem ¶
type SpineItem struct { IDref string `xml:"idref,attr"` ID string `xml:"id,attr,omitempty"` Linear string `xml:"linear,attr,omitempty"` Properties string `xml:"properties,attr,omitempty"` }
SpineItem spine item
type TOCContent ¶
type TOCContent struct { Title string // contains filtered or unexported fields }
func (*TOCContent) ContentRef ¶
func (tc *TOCContent) ContentRef() string
ContentRef retrieves the path o the file pointed by the TOC entry
func (*TOCContent) ItemRef ¶
func (tc *TOCContent) ItemRef() string
ItemRef retrieves the reference ID of the TOC Item
func (*TOCContent) ItemTitle ¶
func (tc *TOCContent) ItemTitle() string
ItemTitle retrieves the item title (label) as it appears in the TOC
func (*TOCContent) SubSectionStyle ¶
func (tc *TOCContent) SubSectionStyle(sty ugarit.SectionStyle)
SubSectionStyle sets the object to style this TOC subsection
func (*TOCContent) TOCChild ¶
func (tc *TOCContent) TOCChild(n int) ugarit.TOC
TOCChild retrieves the Nth child of the TOC item
func (*TOCContent) TOCLen ¶
func (tc *TOCContent) TOCLen() int
TOCLen retrieves the item count in this TOC section