opf

package
v0.0.0-...-6e95190 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
}

Item is the manifest item structure

type Manifest

type Manifest struct {
	Items []Item `xml:"http://www.idpf.org/2007/opf item"`
}

Manifest is the package manifest structure

func (Manifest) ItemWithPath

func (m Manifest) ItemWithPath(path string) (Item, bool)

ItemWithPath looks for the manifest item corresponding to a given path

type Meta

type Meta struct {
	Name     string `xml:"name,attr"` // EPUB 2
	Content  string `xml:"content,attr"`
	Property string `xml:"property,attr"` // EPUB 3
	Refines  string `xml:"refines,attr"`
	Text     string `xml:",chardata"`
}

Meta is the metadata item structure

type Metadata

type Metadata struct {
	Identifier  string   `json:"identifier" xml:"http://purl.org/dc/elements/1.1/ identifier"`
	Title       []string `json:"title" xml:"http://purl.org/dc/elements/1.1/ title"`
	Description string   `json:"description" xml:"http://purl.org/dc/elements/1.1/ description"`
	Date        string   `json:"date" xml:"http://purl.org/dc/elements/1.1/ date"`
	Author      []string `json:"author" xml:"http://purl.org/dc/elements/1.1/ creator"`
	Contributor []string `json:"contributor" xml:"http://purl.org/dc/elements/1.1/ contributor"`
	Publisher   []string `json:"publisher" xml:"http://purl.org/dc/elements/1.1/ publisher"`
	Language    []string `json:"language" xml:"http://purl.org/dc/elements/1.1/ language"`
	Subject     []string `json:"subject" xml:"http://purl.org/dc/elements/1.1/ subject"`
	Metas       []Meta   `xml:"http://www.idpf.org/2007/opf meta"`
}

Metadata is the package metadata structure

type Package

type Package struct {
	BasePath string   `xml:"-"`
	Metadata Metadata `xml:"http://www.idpf.org/2007/opf metadata"`
	Manifest Manifest `xml:"http://www.idpf.org/2007/opf manifest"`
}

Package is the main opf structure

func Parse

func Parse(r io.Reader) (Package, error)

Parse parses the opf xml struct and returns a Package object

Jump to

Keyboard shortcuts

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