epub

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Mimetype = "application/epub+zip"

Variables

This section is empty.

Functions

This section is empty.

Types

type FileProperties

type FileProperties struct {
	ManifestId string
	MimeType   string
	Properties string
}

type Item

type Item struct {
	Id         string `xml:"id,attr"`
	Href       string `xml:"href,attr"`
	MediaType  string `xml:"media-type,attr"`
	Properties string `xml:"properties,attr,omitempty"`
}

type ItemRef

type ItemRef struct {
	IdRef string `xml:"idref,attr"`
}

type Meta

type Meta struct {
	Text     string `xml:",chardata"`
	Name     string `xml:"name,attr,omitempty"`
	Content  string `xml:"content,attr,omitempty"`
	Property string `xml:"property,attr,omitempty"`
}

type Ncx

type Ncx struct {
	XMLName xml.Name `xml:"ncx"`
	Head    struct {
		Meta []struct {
			Name    string `xml:"name,attr"`
			Content string `xml:"content,attr"`
		} `xml:"meta"`
	} `xml:"head"`
}

func ReadNcx

func ReadNcx(path string) (*Ncx, error)

type Opf

type Opf struct {
	XMLName          xml.Name `xml:"http://www.idpf.org/2007/opf package"`
	Version          string   `xml:"version,attr"`
	UniqueIdentifier string   `xml:"unique-identifier,attr"`

	Metadata struct {
		Opf string `xml:"xmlns:opf,attr"`
		Dc  string `xml:"xmlns:dc,attr"`

		Language string `xml:"dc:language"`
		Title    string `xml:"dc:title"`
		Creator  string `xml:"dc:creator"`

		Identifier struct {
			Text string `xml:",chardata"`
			Id   string `xml:"id,attr"`
		} `xml:"dc:identifier"`

		Meta []Meta `xml:"meta"`
	} `xml:"metadata"`

	Manifest struct {
		Item []Item `xml:"item"`
	} `xml:"manifest"`

	Spine struct {
		ItemRef []ItemRef `xml:"itemref"`
	} `xml:"spine"`

	Guide struct {
		Reference []Reference `xml:"reference"`
	} `xml:"guide"`
}

func (*Opf) Encode

func (p *Opf) Encode(w io.Writer) error

type Reference

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

type Writer

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

func NewWriter

func NewWriter(w io.Writer) (*Writer, error)

func (*Writer) AddFile

func (w *Writer) AddFile(path string, r io.Reader, props FileProperties) error

func (*Writer) AddGuide

func (w *Writer) AddGuide(guideType, title, href string)

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) SetCreator

func (w *Writer) SetCreator(creator string)

func (*Writer) SetIdentifier

func (w *Writer) SetIdentifier(identifier string)

func (*Writer) SetLanguage

func (w *Writer) SetLanguage(language string)

func (*Writer) SetTitle

func (w *Writer) SetTitle(title string)

Jump to

Keyboard shortcuts

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