epub

package
v0.45.5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 16 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Data   string `xml:",chardata" `
	FileAs string `xml:"file-as,attr" `
	Role   string `xml:"role,attr" `
}

Author author.

type Container

type Container struct {
	Rootfile Rootfile `xml:"rootfiles>rootfile" `
}

Container META-INF/container.xml file.

type Content

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

Content nav-point content.

type Date

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

Date date.

type Epub

type Epub struct {
	Path      string
	Ncx       Ncx
	Opf       Opf
	Container Container
	Mimetype  string
	Hash      string
	Metadata  *ebook.Metadata
	// contains filtered or unexported fields
}

Epub book metadata.

func New added in v0.9.0

func New(path string) (*Epub, error)

func NewWithGoodReads added in v0.10.0

func NewWithGoodReads(path, grAPIKey string) (*Epub, error)

func (*Epub) Check added in v0.9.0

func (e *Epub) Check() (bool, error)

Check the retail epub integrity.

func (*Epub) GetHash added in v0.9.0

func (e *Epub) GetHash() error

GetHash calculates an epub's current hash.

func (*Epub) GetOnlineMetadata added in v0.13.0

func (e *Epub) GetOnlineMetadata(showDiff bool, forbiddenTags []string, tagAliases map[string][]string) error

func (*Epub) LoadMetadata added in v0.13.0

func (e *Epub) LoadMetadata(file string) error

func (*Epub) Parse

func (e *Epub) Parse() error

Open and parse an epub file.

func (*Epub) ReadMetadata added in v0.13.0

func (e *Epub) ReadMetadata(askForISBN, useFirstISBN bool) error

func (*Epub) SaveMetadata added in v0.13.0

func (e *Epub) SaveMetadata() error

func (*Epub) SaveMetadataTo added in v0.13.0

func (e *Epub) SaveMetadataTo(filename string) error

func (*Epub) ShowInfo added in v0.13.0

func (e *Epub) ShowInfo(fields ...string) string

ShowInfo returns a table with relevant information about a book.

type Identifier

type Identifier struct {
	Data   string `xml:",chardata" `
	ID     string `xml:"id,attr"`
	Scheme string `xml:"scheme,attr"`
}

Identifier identifier.

type Manifest

type Manifest struct {
	ID           string `xml:"id,attr" `
	Href         string `xml:"href,attr" `
	MediaType    string `xml:"media-type,attr" `
	Fallback     string `xml:"media-fallback,attr" `
	Properties   string `xml:"properties,attr" `
	MediaOverlay string `xml:"media-overlay,attr" `
}

Manifest manifest.

type MetaField

type MetaField struct {
	Data     string `xml:",chardata" `
	Name     string `xml:"name,attr" `
	Content  string `xml:"content,attr" `
	ID       string `xml:"id,attr" `
	Property string `xml:"property,attr" `
}

MetaField metafield.

type Metadata

type Metadata struct {
	Title       []string     `xml:"title"`
	Language    []string     `xml:"language"`
	Identifier  []Identifier `xml:"identifier"`
	Creator     []Author     `xml:"creator" `
	Subject     []string     `xml:"subject"`
	Description []string     `xml:"description"`
	Publisher   []string     `xml:"publisher"`
	Contributor []Author     `xml:"contributor" `
	Date        []Date       `xml:"date" `
	Type        []string     `xml:"type"`
	Format      []string     `xml:"format" `
	Source      []string     `xml:"source" `
	Relation    []string     `xml:"relation" `
	Coverage    []string     `xml:"coverage"`
	Rights      []string     `xml:"rights" `
	Meta        []MetaField  `xml:"meta" `
}

Metadata contains epub metadata.

type NavPoint struct {
	Text    string     `xml:"navLabel>text"`
	Content Content    `xml:"content"`
	Points  []NavPoint `xml:"navPoint"`
}

NavPoint nav point.

type Ncx

type Ncx struct {
	Meta   []MetaField `xml:"head>meta"`
	Points []NavPoint  `xml:"navMap>navPoint"`
}

Ncx OPS/toc.ncx.

type Opf

type Opf struct {
	Metadata Metadata   `xml:"metadata"`
	Manifest []Manifest `xml:"manifest>item"`
	Spine    Spine      `xml:"spine"`
}

Opf content.opf.

type Rootfile

type Rootfile struct {
	Path string `xml:"full-path,attr"`
	Type string `xml:"media-type,attr" `
}

Rootfile root file.

type Spine

type Spine struct {
	ID              string      `xml:"id,attr" `
	Toc             string      `xml:"toc,attr" `
	PageProgression string      `xml:"page-progression-direction,attr"`
	Items           []SpineItem `xml:"itemref" `
}

Spine spine.

type SpineItem

type SpineItem struct {
	IDref      string `xml:"idref,attr"`
	Linear     string `xml:"linear,attr" `
	ID         string `xml:"id,attr"`
	Properties string `xml:"properties,attr" `
}

SpineItem spine item.

Jump to

Keyboard shortcuts

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