epub20

package
v0.0.0-...-a1112d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2017 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

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

func (b *Book) AddTOC(gen ugarit.IndexGenerator, id string) (string, error)

AddTOC saves the TOC file to the E-Book. Use it just before closing the E-Book

func (*Book) Close

func (b *Book) Close() error

Closes and saves the E-Book

func (*Book) SpineAttr

func (b *Book) SpineAttr(key, val string)

Sets spine attributes

func (*Book) SubSectionStyle

func (b *Book) SubSectionStyle(sty ugarit.SectionStyle)

SubSectionStyle sets the object to style the top level section of the TOC

func (*Book) TOCChild

func (b *Book) TOCChild(n int) ugarit.TOC

TOCChild retrieves the Nth child of the TOC top level

func (*Book) TOCLen

func (b *Book) TOCLen() int

TOCLen retrieves the item count in the TOC top level section

type Content

type Content struct {
	Src string `xml:"src,attr"`
}

Content nav-point content

type Date

type Date struct {
	Event string `xml:"event,attr,omitempty"`
	Data  string `xml:",chardata"`
}

Date

type EPubOptions

type EPubOptions struct {
	Prop         int
	TOCTitle     string
	TOC          ugarit.TOCRef
	TOCItemTitle string
}

type Guide

type Guide struct {
	Reference []Reference `xml:"reference,omitempty"`
}

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 NavPoint struct {
	Id        string     `xml:"id,attr"`
	PlayOrder string     `xml:"playOrder,attr"`
	Label     string     `xml:"navLabel>text"`
	Content   Content    `xml:"content"`
	Points    []NavPoint `xml:"navPoint"`
}

NavPoint nav point

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 PageTarget struct {
	XMLName struct{} `xml:"pageTarget"`
	Id      string   `xml:"id,attr"`
	Type    string   `xml:"type,attr"`
	Value   string   `xml:"value,attr"`
	Label   string   `xml:"navLabel>text"`
	Content Content  `xml:"content"`
}

type Reference

type Reference struct {
	Href  string `xml:"href,attr"`
	Type  string `xml:"type,attr,omitempty"`
	Title string `xml:"title,attr,omitempty"`
}

type Signature

type Signature struct {
	Rel  string `xml:"rel,attr"`
	Href string `xml:"href,attr"`
}

Signature pathname

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 Store

type Store struct {
	// contains filtered or unexported fields
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL