rwpm

package
v0.0.0-...-da9a50a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BelongsTo

type BelongsTo struct {
	Series     []Collection `json:"series,omitempty"`
	Collection []Collection `json:"collection,omitempty"`
}

BelongsTo is a list of collections/series that a publication belongs to

type Collection

type Collection struct {
	Name       string  `json:"name"`
	SortAs     string  `json:"sort_as,omitempty"`
	Identifier string  `json:"identifier,omitempty"`
	Position   float32 `json:"position,omitempty"`
}

Collection construct used for collection/serie metadata

type Contributor

type Contributor struct {
	Name       MultiLanguage `json:"name,omitempty"`
	SortAs     string        `json:"sortAs,omitempty"`
	Identifier string        `json:"identifier,omitempty"`
	Role       string        `json:"role,omitempty"`
}

Contributor construct used internally for all contributors

func (Contributor) MarshalJSON

func (c Contributor) MarshalJSON() ([]byte, error)

MarshalJSON marshals Contributor

func (*Contributor) UnmarshalJSON

func (c *Contributor) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Contributor

type Contributors

type Contributors []Contributor

Contributors is an array of contributors

func (*Contributors) Add

func (c *Contributors) Add(ctor Contributor)

Add adds a Contributor to Contributors

func (*Contributors) AddName

func (c *Contributors) AddName(name string)

AddName adds a Contributor to Contributors

func (Contributors) MarshalJSON

func (c Contributors) MarshalJSON() ([]byte, error)

MarshalJSON marshals Contributors

func (Contributors) Name

func (c Contributors) Name() string

Name gets the name of a contributor

func (*Contributors) UnmarshalJSON

func (c *Contributors) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals contributors

type Date

type Date time.Time

Date struct

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON marshalls Date

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls Date

type DateOrDatetime

type DateOrDatetime time.Time

DateOrDatetime struct

func (DateOrDatetime) MarshalJSON

func (d DateOrDatetime) MarshalJSON() ([]byte, error)

MarshalJSON marshalls DateOrDatetime

func (*DateOrDatetime) UnmarshalJSON

func (d *DateOrDatetime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls DateOrDatetime

type Encrypted

type Encrypted struct {
	Scheme         string `json:"scheme,omitempty"`
	Profile        string `json:"profile,omitempty"`
	Algorithm      string `json:"algorithm,omitempty"`
	Compression    string `json:"compression,omitempty"`
	OriginalLength int    `json:"originalLength,omitempty"`
}

Encrypted contains metadata from encryption xml

type Link struct {
	Href       string      `json:"href"`
	Templated  bool        `json:"templated,omitempty"`
	Type       string      `json:"type,omitempty"`
	Title      string      `json:"title,omitempty"`
	Rel        MultiString `json:"rel,omitempty"`
	Height     int         `json:"height,omitempty"`
	Width      int         `json:"width,omitempty"`
	Duration   float32     `json:"duration,omitempty"`
	Bitrate    int         `json:"bitrate,omitempty"`
	Properties *Properties `json:"properties,omitempty"`
	Alternate  []Link      `json:"alternate,omitempty"`
	Children   []Link      `json:"children,omitempty"`
}

Link object used in collections and links

func (*Link) AddHrefAbsolute

func (link *Link) AddHrefAbsolute(href string, baseFile string)

AddHrefAbsolute modifies Href with a calculated path based on a referend file

func (*Link) AddRel

func (link *Link) AddRel(rel string)

AddRel adds a relation to a Link

type Meta

type Meta struct {
	Property string
	Value    interface{}
	Children []Meta
}

Meta is a generic structure for other metadata

type Metadata

type Metadata struct {
	Type               string        `json:"@type,omitempty"`
	Identifier         string        `json:"identifier,omitempty"`
	Title              MultiLanguage `json:"title"`
	Subtitle           MultiLanguage `json:"subtitle,omitempty"`
	SortAs             string        `json:"sortAs,omitempty"`
	Description        string        `json:"description,omitempty"`
	Language           MultiString   `json:"language,omitempty"`
	ReadingProgression string        `json:"readingProgression,omitempty"`
	//
	Modified  *time.Time `json:"modified,omitempty"`
	Published *Date      `json:"published,omitempty"`
	// contributors
	Publisher   Contributors `json:"publisher,omitempty"`
	Artist      Contributors `json:"artist,omitempty"`
	Author      Contributors `json:"author,omitempty"`
	Colorist    Contributors `json:"colorist,omitempty"`
	Contributor Contributors `json:"contributor,omitempty"`
	Editor      Contributors `json:"editor,omitempty"`
	Illustrator Contributors `json:"illustrator,omitempty"`
	Imprint     Contributors `json:"imprint,omitempty"`
	Inker       Contributors `json:"inker,omitempty"`
	Letterer    Contributors `json:"letterer,omitempty"`
	Narrator    Contributors `json:"narrator,omitempty"`
	Penciler    Contributors `json:"penciler,omitempty"`
	Translator  Contributors `json:"translator,omitempty"`
	// other descriptive metadata
	Subject       Subjects `json:"subject,omitempty"`
	Duration      float32  `json:"duration,omitempty"`
	NumberOfPages int      `json:"numberOfPages,omitempty"`
	Abridged      bool     `json:"abridged,omitempty"`
	// collections & series
	BelongsTo *BelongsTo `json:"belongsTo,omitempty"`

	OtherMetadata []Meta `json:"-"` //Extension point for other metadata
}

Metadata for the default context in WebPub

type MultiLanguage

type MultiLanguage map[string]string

MultiLanguage stores one or more values indexed by language.

func (MultiLanguage) MarshalJSON

func (m MultiLanguage) MarshalJSON() ([]byte, error)

MarshalJSON marshalls MultiLanguage

func (*MultiLanguage) Set

func (m *MultiLanguage) Set(language string, value string)

Set inits a localized value

func (*MultiLanguage) SetDefault

func (m *MultiLanguage) SetDefault(literal string)

SetDefault inits the "und" localized value

func (MultiLanguage) Text

func (m MultiLanguage) Text() string

Text returns the "und" language value or the single value found in the map

func (*MultiLanguage) UnmarshalJSON

func (m *MultiLanguage) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls Multilanguage The "und" (undefined)language corresponds to a literal value

type MultiString

type MultiString []string

MultiString stores one or more strings Used for properties which take a string || an array of strings

func (*MultiString) Add

func (m *MultiString) Add(value string)

Add adds a value to a multistring array

func (MultiString) MarshalJSON

func (m MultiString) MarshalJSON() ([]byte, error)

MarshalJSON marshalls MultiString

func (MultiString) Text

func (m MultiString) Text() string

Text returns the concatenation of all string values

func (*MultiString) UnmarshalJSON

func (m *MultiString) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals MultiString

type Properties

type Properties struct {
	Contains     []string   `json:"contains,omitempty"`
	Layout       string     `json:"layout,omitempty"`
	MediaOverlay string     `json:"mediaOverlay,omitempty"`
	Orientation  string     `json:"orientation,omitempty"`
	Overflow     string     `json:"overflow,omitempty"`
	Page         string     `json:"page,omitempty"`
	Spread       string     `json:"spread,omitempty"`
	Encrypted    *Encrypted `json:"encrypted,omitempty"`
}

Properties object used to link properties Used also in Rendition for fxl

type Publication

type Publication struct {
	Context      MultiString `json:"@context,omitempty"`
	Metadata     Metadata    `json:"metadata"`
	Links        []Link      `json:"links,omitempty"`
	ReadingOrder []Link      `json:"readingOrder,omitempty"`
	Resources    []Link      `json:"resources,omitempty"`
	TOC          []Link      `json:"toc,omitempty"`
	PageList     []Link      `json:"page-list,omitempty"`
	Landmarks    []Link      `json:"landmarks,omitempty"`
	LOI          []Link      `json:"loi,omitempty"` //List of illustrations
	LOA          []Link      `json:"loa,omitempty"` //List of audio files
	LOV          []Link      `json:"lov,omitempty"` //List of videos
	LOT          []Link      `json:"lot,omitempty"` //List of tables

	OtherLinks       []Link                  `json:"-"` //Extension point for links that shouldn't show up in the manifest
	OtherCollections []PublicationCollection `json:"-"` //Extension point for collections that shouldn't show up in the manifest
}

Publication = Readium manifest

func (publication *Publication) AddLink(linkType string, rel []string, url string, templated bool)

AddLink Adds a link to a publication

func (*Publication) Cover

func (publication *Publication) Cover() (Link, error)

Cover returns the link relative to the cover

func (*Publication) NavDoc

func (publication *Publication) NavDoc() (Link, error)

NavDoc returns the link relative to the navigation document

func (*Publication) TransformLinkToFullURL

func (publication *Publication) TransformLinkToFullURL(baseURL string)

TransformLinkToFullURL adds a base url to every link

type PublicationCollection

type PublicationCollection struct {
	Role     string
	Metadata []Meta
	Links    []Link
	Children []PublicationCollection
}

PublicationCollection is used as an extension point for other collections in a Publication

type Subject

type Subject struct {
	Name   string `json:"name"`
	SortAs string `json:"sortAs,omitempty"`
	Scheme string `json:"scheme,omitempty"`
	Code   string `json:"code,omitempty"`
}

Subject of a publication

func (Subject) MarshalJSON

func (s Subject) MarshalJSON() ([]byte, error)

MarshalJSON marshals Subject

func (*Subject) UnmarshalJSON

func (s *Subject) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Subject

type Subjects

type Subjects []Subject

Subjects is an array of subjects

func (*Subjects) Add

func (s *Subjects) Add(item Subject)

Add adds a value to a subject array

func (Subjects) MarshalJSON

func (s Subjects) MarshalJSON() ([]byte, error)

MarshalJSON marshals Subjects

func (*Subjects) UnmarshalJSON

func (s *Subjects) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Subjects

type W3CContributor

type W3CContributor struct {
	Type       MultiString      `json:"type,omitempty"`
	Name       W3CMultiLanguage `json:"name,omitempty"`
	ID         string           `json:"id,omitempty"`
	URL        string           `json:"url,omitempty"`
	Identifier MultiString      `json:"identifier,omitempty"`
}

W3CContributor construct used internally for all contributors

func (W3CContributor) MarshalJSON

func (c W3CContributor) MarshalJSON() ([]byte, error)

MarshalJSON marshals W3CContributor

func (*W3CContributor) UnmarshalJSON

func (c *W3CContributor) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals W3CContributor

type W3CContributors

type W3CContributors []W3CContributor

W3CContributors is an array of contributors

func (W3CContributors) MarshalJSON

func (c W3CContributors) MarshalJSON() ([]byte, error)

MarshalJSON marshals W3CContributors

func (*W3CContributors) UnmarshalJSON

func (c *W3CContributors) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals contributors

type W3CLink struct {
	URL            string           `json:"url"`
	EncodingFormat string           `json:"encodingFormat,omitempty"`
	Name           W3CMultiLanguage `json:"name,omitempty"`
	Description    W3CMultiLanguage `json:"description,omitempty"`
	Rel            MultiString      `json:"rel,omitempty"`
	Integrity      string           `json:"integrity,omitempty"`
	Duration       string           `json:"duration,omitempty"`
	Alternate      W3CLinks         `json:"alternate,omitempty"`
}

W3CLink object

func (W3CLink) MarshalJSON

func (l W3CLink) MarshalJSON() ([]byte, error)

MarshalJSON marshals W3CLink

func (*W3CLink) UnmarshalJSON

func (l *W3CLink) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals W3CLink

type W3CLinks []W3CLink

W3CLinks struct

func (W3CLinks) MarshalJSON

func (l W3CLinks) MarshalJSON() ([]byte, error)

MarshalJSON marshals W3CLinks

func (*W3CLinks) UnmarshalJSON

func (l *W3CLinks) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls W3CLinks

type W3CLocalized

type W3CLocalized struct {
	Language  string `json:"language"`
	Value     string `json:"value"`
	Direction string `json:"direction,omitempty"`
}

W3CLocalized represents a single value of a W3CMultiLanguage property

func (W3CLocalized) MarshalJSON

func (l W3CLocalized) MarshalJSON() ([]byte, error)

MarshalJSON marshalls W3CLocalized

func (*W3CLocalized) UnmarshalJSON

func (l *W3CLocalized) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls W3CLocalized

type W3CMultiLanguage

type W3CMultiLanguage []W3CLocalized

W3CMultiLanguage struct

func (W3CMultiLanguage) MarshalJSON

func (m W3CMultiLanguage) MarshalJSON() ([]byte, error)

MarshalJSON marshalls W3CMultiLanguage

func (W3CMultiLanguage) Text

func (m W3CMultiLanguage) Text() string

Text returns the "und" language value or the first value found in the map

func (*W3CMultiLanguage) UnmarshalJSON

func (m *W3CMultiLanguage) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshalls W3CMultilanguge

type W3CPublication

type W3CPublication struct {
	ConformsTo         string           `json:"conformsTo,omitempty"`
	ID                 string           `json:"id,omitempty"`
	URL                string           `json:"url,omitempty"`
	Name               W3CMultiLanguage `json:"name"`
	Publisher          W3CContributors  `json:"publisher,omitempty"`
	Artist             W3CContributors  `json:"artist,omitempty"`
	Author             W3CContributors  `json:"author,omitempty"`
	Colorist           W3CContributors  `json:"colorist,omitempty"`
	Contributor        W3CContributors  `json:"contributor,omitempty"`
	Creator            W3CContributors  `json:"creator,omitempty"`
	Editor             W3CContributors  `json:"editor,omitempty"`
	Illustrator        W3CContributors  `json:"illustrator,omitempty"`
	Inker              W3CContributors  `json:"inker,omitempty"`
	Letterer           W3CContributors  `json:"letterer,omitempty"`
	Penciler           W3CContributors  `json:"penciler,omitempty"`
	ReadBy             W3CContributors  `json:"readBy,omitempty"`
	Translator         W3CContributors  `json:"translator,omitempty"`
	InLanguage         MultiString      `json:"inLanguage,omitempty"`
	DatePublished      *DateOrDatetime  `json:"datePublished,omitempty"`
	DateModified       *DateOrDatetime  `json:"dateModified,omitempty"`
	ReadingProgression string           `json:"readingProgression,omitempty"`
	Duration           string           `json:"duration,omitempty"`
	Description        string           `json:"dcterms:description,omitempty"`
	Subject            Subjects         `json:"dcterms:subject,omitempty"`
	Links              W3CLinks         `json:"links,omitempty"`
	ReadingOrder       W3CLinks         `json:"readingOrder,omitempty"`
	Resources          W3CLinks         `json:"resources,omitempty"`
}

W3CPublication = W3C manifest

Jump to

Keyboard shortcuts

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