Documentation ¶
Index ¶
- Constants
- type Contributor
- type Coverage
- type Creator
- type DCMESOptionalElement
- type Date
- type Description
- type Href
- type ID
- type Identifier
- type Language
- type Link
- type MediaType
- type Meta
- type Metadata
- type Package
- type Prefix
- type Properties
- type Property
- type Publisher
- type Refines
- type Rel
- type Relation
- type Rights
- type Scheme
- type Source
- type Subject
- type TextDirection
- type Title
- type Type
- type UniqueIdentifier
- type Version
- type XMLLang
Constants ¶
const ISO8601Date = `2006-01-02`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contributor ¶
type Contributor struct {
DCMESOptionalElement
}
type Coverage ¶
type Coverage struct {
DCMESOptionalElement
}
type Creator ¶
type Creator struct {
DCMESOptionalElement
}
type DCMESOptionalElement ¶
type DCMESOptionalElement struct { Text string // Optional ID ID Dir TextDirection Lang XMLLang // contains filtered or unexported fields }
DCMESOptionalElement is a template for several elements that are identical except for their names. This was the best solution I could come up with. See https://www.w3.org/publishing/epub3/epub-packages.html#sec-opf-dcmes-optional
func (DCMESOptionalElement) MarshalXML ¶
func (element DCMESOptionalElement) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML will not write a DCMESOptionalElement without any inner text.
func (*DCMESOptionalElement) UnmarshalXML ¶
func (element *DCMESOptionalElement) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Date ¶
Date is a Marshal/Unmarshal wrapper around time.Time See https://www.w3.org/publishing/epub3/epub-packages.html#sec-opf-dcdate
func (*Date) MarshalXML ¶
func (*Date) UnmarshalXML ¶
type Description ¶
type Description struct {
DCMESOptionalElement
}
type ID ¶
type ID string
ID is an identifier for the element. This will be referenced by other elements such as meta elements.
type Identifier ¶
Identifier is some kind of identifier for the publication, for example a UUID or a publisher's id. If the identifier comes from an established system, an accompanying meta tag for the property "identifier-type" should be provided. See https://www.w3.org/publishing/epub3/epub-packages.html#sec-opf-dcidentifier
func (Identifier) MarshalXML ¶
func (identifier Identifier) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML will not write an identifier without any Text
func (*Identifier) UnmarshalXML ¶
func (identifier *Identifier) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Language ¶
Language designates a language used in the publication. Metadata must contain at least one Language. Multiple languages may be specified in the case of multilingual publication, but the first Language is considered primary. Not that this does not specify the language of any child content. See https://www.w3.org/publishing/epub3/epub-packages.html#sec-opf-dclanguage
func (Language) MarshalXML ¶
MarshalXML will not write a language without any Text
func (*Language) UnmarshalXML ¶
type Link ¶
type Link struct { // Required Href Href Rel Rel // Required for external resources MediaType MediaType // Optional ID ID Properties Properties Refines Refines }
Link represents a link to a resource either internally or externally. If the resource is external, MediaType must be populated. See https://www.w3.org/publishing/epub3/epub-packages.html#sec-link-elem
func (Link) MarshalXML ¶
MarshalXML should write a self-closing tag, but the current xml implementation does not support it. It may look kind of ugly, but in theory it shouldn't be an issue unless a reader does not support the full xml spec.
func (*Link) UnmarshalXML ¶
type Meta ¶
type Meta struct { // Required Text string Property Property //Optional Refines Refines Scheme Scheme XMLLang XMLLang TextDirection TextDirection ID ID }
Meta contains meta information See https://www.w3.org/publishing/epub3/epub-packages.html#sec-meta-elem
func (*Meta) MarshalXML ¶
MarshalXML will not write out a meta element without any text
func (*Meta) UnmarshalXML ¶
type Metadata ¶
type Metadata struct { XMLName xml.Name Identifiers []Identifier Titles []Title Languages []Language Metas []Meta //Optional Creators []Creator Descriptions []Description Publishers []Publisher Contributors []Contributor Coverages []Coverage Relations []Relation Rights []Rights Subjects []Subject Types []Type Links []Link Sources []Source Date Date }
Metadata contains the metadata about the epub file See https://www.w3.org/publishing/epub3/epub-packages.html#sec-metadata-elem
func (Metadata) MarshalXML ¶
func (*Metadata) UnmarshalXML ¶
type Package ¶
type Package struct { XMLName xml.Name `xml:"package"` // Required Version Version UniqueIdentifier UniqueIdentifier // Optional TextDirection TextDirection ID ID Prefix Prefix XMLLang XMLLang Metadata Metadata }
Package contains all the information about the epub See https://www.w3.org/publishing/epub3/epub-packages.html#sec-package-elem
func GetPackage ¶
GetPackage retrieves the package from an epub file (which is a zip) and parses it using ParsePackage
func ParsePackage ¶
ParsePackage parses a package file into a Package.
func (Package) MarshalXML ¶
func (*Package) UnmarshalXML ¶
type Prefix ¶
type Prefix string
See https://www.w3.org/publishing/epub3/epub-packages.html#sec-prefix-attr
type Properties ¶
type Properties string
func (Properties) String ¶
func (properties Properties) String() string
type Property ¶
type Property string
Property is the property specified by the meta tag, for example "dcterms:modified" specifies the last modified date for the document.
type Publisher ¶
type Publisher struct {
DCMESOptionalElement
}
type Refines ¶
type Refines string
Refines links the meta tag to another element by specifying an element id in the format "#element-id"
type Relation ¶
type Relation struct {
DCMESOptionalElement
}
type Rights ¶
type Rights struct {
DCMESOptionalElement
}
type Source ¶
type Source struct {
DCMESOptionalElement
}
type Subject ¶
type Subject struct {
DCMESOptionalElement
}
type TextDirection ¶
type TextDirection string
TextDirection annotates the direction of the text in the contained content and attributes
const ( TextDirectionLTR TextDirection = `ltr` TextDirectionRTL TextDirection = `rtl` )
func (TextDirection) String ¶
func (d TextDirection) String() string
type Title ¶
type Title struct { // Required Text string // Optional ID ID Dir TextDirection Lang XMLLang }
Title identifies a title of the document. At least one Title is required. If a title and subtitle are used, meta tags should identify which is which. The first Title is considered the primary title.
func (Title) MarshalXML ¶
MarshalXML will not write a Title without any Text
func (*Title) UnmarshalXML ¶
type Type ¶
type Type struct {
DCMESOptionalElement
}
type UniqueIdentifier ¶
type UniqueIdentifier string
UniqueIdentifier idenitifies the primary Identifier in the metadata
func (UniqueIdentifier) Name ¶
func (UniqueIdentifier) Name() string
Name gives the xml attribute name
func (UniqueIdentifier) String ¶
func (uid UniqueIdentifier) String() string