epub

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT, BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCoverImage

func GetCoverImage(stock string, book *model.Book) (image.Image, error)

func GetOPFPath

func GetOPFPath(zr *zip.ReadCloser) (string, error)

Get OPF file path fron OCF file

Types

type OCF

type OCF struct {
	Container xml.Name `xml:"container"`
	RootFiles struct {
		RootFile struct {
			FullPath string `xml:"full-path,attr"`
		} `xml:"rootfile"`
	} `xml:"rootfiles"`
}

EPUB Open Container Format (OCF) 3.2

type OPF

type OPF struct {
	// The root element of the Package Document and defines various aspects of the EPUB Package
	Package xml.Name `xml:"package"`
	// Specifies the language used in the contents and attribute values of the carrying element and its descendants
	Lang string `xml:"xml:lang,attr,omitempty"`
	// Specifies the EPUB specification version to which the given EPUB Package conforms.
	Version string `xml:"version,attr"`

	// Here only a minimal set of meta information for Reading Systems to use to internally catalogue an EPUB Publication
	Metadata struct {
		// Contains an identifier associated with the given Rendition, such as a UUID, DOI or ISBN.
		Identifier []struct {
			ID string `xml:"id,attr,omitempty"`
			// ID value
			Text string `xml:",chardata"`
		} `xml:"identifier"`
		// Rrepresents an instance of a name given to the EPUB Publication.
		Title []string `xml:"title"`
		// Specifies the language of the content of the given Rendition.
		Language []string `xml:"language"`
		// Represents the name of a person, organization, etc. responsible for the creation of the content of the Rendition
		Creator []struct {
			// The ID [XML] of the element, which MUST be unique within the document scope.
			ID string `xml:"id,attr,omitempty"`
			// Can be attached to the element to indicate the function the creator played in the creation of the content.
			Role   string `xml:"role,attr,omitempty"`
			FileAs string `xml:"file-as,attr,omitempty"`
			// Creator value
			Text string `xml:",chardata"`
		} `xml:"creator,omitempty"`
		// Description provides a description of the publication's content.
		Description []string `xml:"description,omitempty"`
		// Identifies the subject of the EPUB Publication.
		Subject []string `xml:"subject,omitempty"`
		// Identifies the publication's publisher.
		Publisher []string `xml:"publisher,omitempty"`
		// MUST only be used to define the publication date of the EPUB Publication.
		Date string `xml:"date"`
		// Provides a generic means of including package metadata.
		Meta []struct {
			// Takes a property data type value that defines the statement being made in the expression, and the text content of the element represents the assertion
			Property string `xml:"property,attr"`
			// Enhances the meaning of the expression or resource referenced
			Refines string `xml:"refines,attr,omitempty"`
			// Identifies metadata name - OPF2 extension
			Name string `xml:"name,attr"`
			// Contents metadata value of name  - OPF2 extension
			Content string `xml:"content,attr"`
			// Meta value
			Text string `xml:",chardata"`
		} `xml:"meta"`
	} `xml:"metadata"`
	// Provides an exhaustive list of the Publication Resources that constitute the given Rendition, each represented by an item element.
	Manifest struct {
		// Each item element in the manifest identifies a Publication Resource by the IRI provided in its href attribute.
		Item []struct {
			// The ID [XML] of the element, which MUST be unique within the document scope.
			ID string `xml:"id,attr"`
			// An absolute or relative IRI reference [RFC3987] to a resource.
			Href string `xml:"href,attr"`
			// Item element MUST conform to the applicable specification(s) as inferred from the MIME media type
			MediaType string `xml:"media-type,attr"`
			// A space-separated list of property values.
			Properties string `xml:"properties,attr,omitempty"`
		} `xml:"item"`
	} `xml:"manifest"`
}

EPUB Packages 3.2

func NewOPF

func NewOPF(zr *zip.ReadCloser, path string) (*OPF, error)

Creates an opf package object from an OPF content.

func (*OPF) GetAuthors

func (ep *OPF) GetAuthors() []*model.Author

func (*OPF) GetCover

func (ep *OPF) GetCover() string

func (*OPF) GetFormat

func (ep *OPF) GetFormat() string

func (*OPF) GetGenres

func (ep *OPF) GetGenres() []string

func (*OPF) GetKeywords

func (ep *OPF) GetKeywords() string

func (*OPF) GetLanguage

func (ep *OPF) GetLanguage() *model.Language

func (*OPF) GetPlot

func (ep *OPF) GetPlot() string

func (*OPF) GetSerie

func (ep *OPF) GetSerie() *model.Serie

func (*OPF) GetSerieNumber

func (ep *OPF) GetSerieNumber() int

func (*OPF) GetSort

func (ep *OPF) GetSort() string

func (*OPF) GetTitle

func (ep *OPF) GetTitle() string

func (*OPF) GetYear

func (ep *OPF) GetYear() string

func (*OPF) String

func (opf *OPF) String() string

Jump to

Keyboard shortcuts

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