Documentation
¶
Index ¶
- Constants
- func IsHorizontal(progression ReadingProgression) *bool
- type A11y
- type A11yAccessMode
- type A11yCertification
- type A11yExemption
- type A11yFeature
- type A11yHazard
- type A11yPrimaryAccessMode
- type A11yProfile
- type Collection
- type Collections
- type Contributor
- type Contributors
- type EPUBLayout
- type Encryption
- type Fit
- type GuidedNavigationDocument
- type GuidedNavigationObject
- type HREF
- type HREFNormalizer
- type Link
- type LinkList
- func (ll LinkList) AllAreAudio() bool
- func (ll LinkList) AllAreBitmap() bool
- func (ll LinkList) AllAreHTML() bool
- func (ll LinkList) AllAreVideo() bool
- func (ll LinkList) AllAreVisual() bool
- func (ll LinkList) AllMatchMediaType(mt ...*mediatype.MediaType) bool
- func (ll LinkList) Copy(transformer ManifestTransformer) LinkList
- func (ll LinkList) FilterByMediaType(mt ...*mediatype.MediaType) LinkList
- func (ll LinkList) FilterByRel(rel string) LinkList
- func (ll LinkList) FirstWithHref(href url.URL) *Link
- func (ll LinkList) FirstWithMediaType(mt *mediatype.MediaType) *Link
- func (ll LinkList) FirstWithRel(rel string) *Link
- func (ll LinkList) Flatten() LinkList
- func (ll LinkList) IndexOfFirstWithHref(href url.URL) int
- type LocalizedString
- func (l *LocalizedString) DefaultTranslation() string
- func (l *LocalizedString) GetOrFallback(language string) string
- func (l *LocalizedString) Length() int
- func (l LocalizedString) MarshalJSON() ([]byte, error)
- func (l *LocalizedString) SetDefaultTranslation(value string)
- func (l *LocalizedString) SetTranslation(language string, value string)
- func (l *LocalizedString) String() string
- func (l *LocalizedString) UnmarshalJSON(data []byte) error
- type Locations
- type Locator
- type Manifest
- func (m Manifest) ConformsTo(profile Profile) bool
- func (m Manifest) Copy(transformer ManifestTransformer) Manifest
- func (m Manifest) LinkWithHref(href url.URL) *Link
- func (m Manifest) LinkWithRel(rel string) *Link
- func (m Manifest) LinksWithRel(rel string) []Link
- func (m Manifest) LocatorFromLink(link Link) *Locator
- func (m Manifest) MarshalJSON() ([]byte, error)
- func (m Manifest) NormalizeHREFsToBase(baseURL url.URL) Manifest
- func (m Manifest) NormalizeHREFsToSelf() Manifest
- func (m Manifest) ToMap(selfLink *Link) map[string]interface{}
- func (m *Manifest) UnmarshalJSON(b []byte) error
- type ManifestTransformer
- type MediaOverlay
- type Metadata
- func (m Metadata) BelongsToCollections() []Collection
- func (m Metadata) BelongsToSeries() []Collection
- func (m Metadata) Copy(transformer ManifestTransformer) Metadata
- func (m Metadata) EffectiveReadingProgression() ReadingProgression
- func (m Metadata) InferredAccessibility() *A11y
- func (m Metadata) MarshalJSON() ([]byte, error)
- func (m Metadata) SetOtherMetadata(key string, value interface{}) error
- func (m Metadata) SortAs() string
- func (m Metadata) Subtitle() string
- func (m Metadata) Title() string
- func (m *Metadata) UnmarshalJSON(b []byte) error
- type Orientation
- type Overflow
- type Page
- type Presentation
- type Profile
- type Profiles
- type Properties
- func (p Properties) Clipped() *bool
- func (p Properties) Contains() []string
- func (p Properties) Encryption() *Encryption
- func (p Properties) Fit() Fit
- func (p *Properties) Get(key string) interface{}
- func (p Properties) GetBool(key string) *bool
- func (p Properties) GetString(key string) string
- func (p Properties) Layout() EPUBLayout
- func (p Properties) Orientation() Orientation
- func (p Properties) Overflow() Overflow
- func (p Properties) Page() Page
- func (p Properties) Spread() Spread
- func (p *Properties) UnmarshalJSON(data []byte) error
- type PublicationCollection
- type PublicationCollectionMap
- type ReadingProgression
- type Spread
- type Strings
- type Subject
- type Text
Constants ¶
const InferredAccessibilityMetadataKey = "https://readium.org/webpub-manifest#inferredAccessibility"
const PresentationDefaultClipped = false // Default value for Presentation.Clipped
const PresentationDefaultContinuous = false // Default value for Presentation.Continuous
const ProfileAudiobook = Profile("https://readium.org/webpub-manifest/profiles/audiobook")
Profile for audiobooks
const ProfileDivina = Profile("https://readium.org/webpub-manifest/profiles/divina")
Profile for visual narratives (comics, manga, webtoons and bandes dessinées)
const ProfileEPUB = Profile("https://readium.org/webpub-manifest/profiles/epub")
Profile for EPUB publications
const ProfilePDF = Profile("https://readium.org/webpub-manifest/profiles/pdf")
Profile for PDF documents
const UndefinedLanguage = "und"
const WebpubManifestContext = "https://readium.org/webpub-manifest/context.jsonld"
Variables ¶
This section is empty.
Functions ¶
func IsHorizontal ¶
func IsHorizontal(progression ReadingProgression) *bool
Types ¶
type A11y ¶
type A11y struct {
ConformsTo []A11yProfile `json:"conformsTo,omitempty"` // An established standard to which the described resource conforms.
Certification *A11yCertification `json:"certification,omitempty"` // Certification of accessible publications.
Summary string `json:"summary,omitempty"` // A human-readable summary of specific accessibility features or deficiencies, consistent with the other accessibility metadata but expressing subtleties such as "short descriptions are present but long descriptions will be needed for non-visual users" or "short descriptions are present and no long descriptions are needed."
AccessModes []A11yAccessMode `json:"accessMode,omitempty"` // The human sensory perceptual system or cognitive faculty through which a person may process or perceive information.
AccessModesSufficient [][]A11yPrimaryAccessMode `json:"accessModeSufficient,omitempty"` // A list of single or combined accessModes that are sufficient to understand all the intellectual content of a resource.
Features []A11yFeature `json:"feature,omitempty"` // Content features of the resource, such as accessible media, alternatives and supported enhancements for accessibility.
Hazards []A11yHazard `json:"hazard,omitempty"` // A characteristic of the described resource that is physiologically dangerous to some users.
Exemptions []A11yExemption `json:"exemption,omitempty"` // Justifications for non-conformance based on exemptions in a given jurisdiction.
}
A11y holds the accessibility metadata of a Publication.
https://www.w3.org/2021/a11y-discov-vocab/latest/ https://readium.org/webpub-manifest/schema/a11y.schema.json
func A11yFromJSON ¶
func (*A11y) UnmarshalJSON ¶
type A11yAccessMode ¶
type A11yAccessMode string
A11yAccessMode is a human sensory perceptual system or cognitive faculty through which a person may process or perceive information.
const ( // Indicates that the resource contains information encoded in auditory form. A11yAccessModeAuditory A11yAccessMode = "auditory" // Indicates that the resource contains charts encoded in visual form. A11yAccessModeChartOnVisual A11yAccessMode = "chartOnVisual" // Indicates that the resource contains chemical equations encoded in visual form. A11yAccessModeChemOnVisual A11yAccessMode = "chemOnVisual" // Indicates that the resource contains information encoded such that color perception is necessary. A11yAccessModeColorDependent A11yAccessMode = "colorDependent" // Indicates that the resource contains diagrams encoded in visual form. A11yAccessModeDiagramOnVisual A11yAccessMode = "diagramOnVisual" // Indicates that the resource contains mathematical notations encoded in visual form. A11yAccessModeMathOnVisual A11yAccessMode = "mathOnVisual" // Indicates that the resource contains musical notation encoded in visual form. A11yAccessModeMusicOnVisual A11yAccessMode = "musicOnVisual" // Indicates that the resource contains information encoded in tactile form. // // Note that although an indication of a tactile mode often indicates the content is encoded // using a braille system, this is not always the case. Tactile perception may also indicate, // for example, the use of tactile graphics to convey information. A11yAccessModeTactile A11yAccessMode = "tactile" // Indicates that the resource contains text encoded in visual form. A11yAccessModeTextOnVisual A11yAccessMode = "textOnVisual" // Indicates that the resource contains information encoded in textual form. A11yAccessModeTextual A11yAccessMode = "textual" // Indicates that the resource contains information encoded in visual form. A11yAccessModeVisual A11yAccessMode = "visual" )
func A11yAccessModesFromStrings ¶
func A11yAccessModesFromStrings(strings []string) []A11yAccessMode
type A11yCertification ¶
type A11yCertification struct {
CertifiedBy string `json:"certifiedBy,omitempty"` // Identifies a party responsible for the testing and certification of the accessibility of a Publication.
Credential string `json:"credential,omitempty"` // Identifies a credential or badge that establishes the authority of the party identified in the associated `certifiedBy` property to certify content accessible.
Report string `json:"report,omitempty"` // Provides a link to an accessibility report created by the party identified in the associated `certifiedBy` property.
}
A11yCertification represents a certification for an accessible publication.
func (A11yCertification) IsEmpty ¶
func (c A11yCertification) IsEmpty() bool
type A11yExemption ¶ added in v0.7.0
type A11yExemption string
A11yExemption is a justification for non-conformance based on an exemption in a given jurisdiction.
const ( A11yExemptionEAASisproportionateBurden A11yExemption = "eaa-disproportionate-burden" A11yExemptionEAAFundamentalAlteration A11yExemption = "eaa-fundamental-alteration" A11yExemptionEAAMicroenterprise A11yExemption = "eaa-microenterprise" )
func A11yExemptionsFromStrings ¶ added in v0.7.0
func A11yExemptionsFromStrings(strings []string) []A11yExemption
type A11yFeature ¶
type A11yFeature string
A11yFeature is a content feature of the described resource, such as accessible media, alternatives and supported enhancements for accessibility.
const ( // The work includes annotations from the author, instructor and/or others. A11yFeatureAnnotations A11yFeature = "annotations" // Indicates the resource includes ARIA roles to organize and improve the structure and navigation. // // The use of this value corresponds to the inclusion of Document Structure, Landmark, // Live Region, and Window roles [WAI-ARIA]. A11yFeatureAria A11yFeature = "ARIA" // The work includes bookmarks to facilitate navigation to key points. A11yFeatureBookmarks A11yFeature = "bookmark" // The work includes an index to the content. A11yFeatureIndex A11yFeature = "index" // The most common way of providing page navigation in digital publications is through a page list. A11yFeaturePageNavigation A11yFeature = "pageNavigation" // The reading order of the content is clearly defined in the markup // (e.g., figures, sidebars and other secondary content has been marked up to allow it // to be skipped automatically and/or manually escaped from). A11yFeatureReadingOrder A11yFeature = "readingOrder" // allowing navigation by assistive technologies. A11yFeatureStructuralNavigation A11yFeature = "structuralNavigation" // The work includes a table of contents that provides links to the major sections of the content. A11yFeatureTableOfContents A11yFeature = "tableOfContents" // The contents of the PDF have been tagged to permit access by assistive technologies. A11yFeatureTaggedPDF A11yFeature = "taggedPDF" // Alternative text is provided for visual content (e.g., via the HTML `alt` attribute). A11yFeatureAlternativeText A11yFeature = "alternativeText" // Audio descriptions are available (e.g., via an HTML `track` element with its `kind` // attribute set to "descriptions". A11yFeatureAudioDescription A11yFeature = "audioDescription" // Indicates that synchronized captions are available for audio and video content. A11yFeatureCaptions A11yFeature = "captions" // Textual descriptions of math equations are included, whether in the alt attribute // for image-based equations, A11yFeatureDescribedMath A11yFeature = "describeMath" // Descriptions are provided for image-based visual content and/or complex structures // such as tables, mathematics, diagrams, and charts. A11yFeatureLongDescription A11yFeature = "longDescription" // Indicates that `ruby` annotations HTML are provided in the content. Ruby annotations // are used as pronunciation guides for the logographic characters for languages like // Chinese or Japanese. It makes difficult Kanji or CJK ideographic characters more accessible. // // The absence of rubyAnnotations implies that no CJK ideographic characters have ruby. A11yFeatureRubyAnnotations A11yFeature = "rubyAnnotations" // Sign language interpretation is available for audio and video content. A11yFeatureSignLanguage A11yFeature = "signLanguage" // Indicates that a transcript of the audio content is available. A11yFeatureTranscript A11yFeature = "transcript" // Display properties are controllable by the user. This property can be set, for example, // if custom CSS style sheets can be applied to the content to control the appearance. // It can also be used to indicate that styling in document formats like Word and PDF // can be modified. A11yFeatureDisplayTransformability A11yFeature = "displayTransformability" // Describes a resource that offers both audio and text, with information that allows them // to be rendered simultaneously. The granularity of the synchronization is not specified. // This term is not recommended when the only material that is synchronized is // the document headings. A11yFeatureSynchronizedAudioText A11yFeature = "synchronizedAudioText" // For content with timed interaction, this value indicates that the user can control // the timing to meet their needs (e.g., pause and reset) A11yFeatureTimingControl A11yFeature = "timingControl" // No digital rights management or other content restriction protocols have been applied // to the resource. A11yFeatureUnlocked A11yFeature = "unlocked" // Identifies that chemical information is encoded using the ChemML markup language. A11yFeatureChemML A11yFeature = "ChemML" // Identifies that mathematical equations and formulas are encoded in the LaTeX // typesetting system. A11yFeatureLatex A11yFeature = "latex" // Identifies that mathematical equations and formulas are encoded in MathML. A11yFeatureMathML A11yFeature = "MathML" // One or more of SSML, Pronunciation-Lexicon, and CSS3-Speech properties has been used // to enhance text-to-speech playback quality. A11yFeatureTTSMarkup A11yFeature = "ttsMarkup" // Audio content with speech in the foreground meets the contrast thresholds set out // in WCAG Success Criteria 1.4.7. A11yFeatureHighContrastAudio A11yFeature = "highContrastAudio" // Content meets the visual contrast threshold set out in WCAG Success Criteria 1.4.6. A11yFeatureHighContrastDisplay A11yFeature = "highContrastDisplay" // The content has been formatted to meet large print guidelines. // // The property is not set if the font size can be increased. See DisplayTransformability. A11yFeatureLargePrint A11yFeature = "largePrint" // The content is in braille format, or alternatives are available in braille. A11yFeatureBraille A11yFeature = "braille" // When used with creative works such as books, indicates that the resource includes // tactile graphics. When used to describe an image resource or physical object, // indicates that the resource is a tactile graphic. A11yFeatureTactileGraphic A11yFeature = "tactileGraphic" // When used with creative works such as books, indicates that the resource includes models // to generate tactile 3D objects. When used to describe a physical object, // indicates that the resource is a tactile 3D object. A11yFeatureTactileObject A11yFeature = "tactileObject" // Indicates that the resource does not contain any accessibility features. A11yFeatureNone A11yFeature = "none" )
func A11yFeaturesFromStrings ¶
func A11yFeaturesFromStrings(strings []string) []A11yFeature
type A11yHazard ¶
type A11yHazard string
A11yHazard is a characteristic of the described resource that is physiologically dangerous to some users.
const ( // Indicates that the resource presents a flashing hazard for photosensitive persons. A11yHazardFlashing A11yHazard = "flashing" // Indicates that the resource does not present a flashing hazard. A11yHazardNoFlashingHazard A11yHazard = "noFlashingHazard" // Indicates that the resource contains instances of motion simulation that // may affect some individuals. // // Some examples of motion simulation include video games with a first-person perspective // and CSS-controlled backgrounds that move when a user scrolls a page. A11yHazardMotionSimulation A11yHazard = "motionSimulation" // Indicates that the resource does not contain instances of motion simulation. A11yHazardNoMotionSimulationHazard A11yHazard = "noMotionSimulationHazard" // Indicates that the resource contains auditory sounds that may affect some individuals. A11yHazardSound A11yHazard = "sound" // Indicates that the resource does not contain auditory hazards. A11yHazardNoSoundHazard A11yHazard = "noSoundHazard" // Indicates that the author is not able to determine if the resource presents any hazards. A11yHazardUnknown A11yHazard = "unknown" // Indicates that the resource does not contain any hazards. A11yHazardNone A11yHazard = "none" )
func A11yHazardsFromStrings ¶
func A11yHazardsFromStrings(strings []string) []A11yHazard
type A11yPrimaryAccessMode ¶
type A11yPrimaryAccessMode string
A11yPrimaryAccessMode is a human primary sensory perceptual system or cognitive faculty through which a person may process or perceive information.
const ( // Indicates that auditory perception is necessary to consume the information. A11yPrimaryAccessModeAuditory A11yPrimaryAccessMode = "auditory" // Indicates that tactile perception is necessary to consume the information. A11yPrimaryAccessModeTactile A11yPrimaryAccessMode = "tactile" // Indicates that the ability to read textual content is necessary to consume the information. // // Note that reading textual content does not require visual perception, as textual content // can be rendered as audio using a text-to-speech capable device or assistive technology. A11yPrimaryAccessModeTextual A11yPrimaryAccessMode = "textual" // Indicates that visual perception is necessary to consume the information. A11yPrimaryAccessModeVisual A11yPrimaryAccessMode = "visual" )
func A11yPrimaryAccessModesFromStrings ¶
func A11yPrimaryAccessModesFromStrings(strings []string) []A11yPrimaryAccessMode
type A11yProfile ¶
type A11yProfile string
A11yProfile represents an established accessibility standard a publication can conform to.
const ( // EPUB Accessibility 1.0 - WCAG 2.0 Level A EPUBA11y10WCAG20A A11yProfile = "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a" // EPUB Accessibility 1.0 - WCAG 2.0 Level AA EPUBA11y10WCAG20AA A11yProfile = "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa" // EPUB Accessibility 1.0 - WCAG 2.0 Level AAA EPUBA11y10WCAG20AAA A11yProfile = "http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa" )
func A11yProfilesFromStrings ¶
func A11yProfilesFromStrings(strings []string) []A11yProfile
type Collection ¶
type Collection = Contributor
type Collections ¶
type Collections = Contributors
type Contributor ¶
type Contributor struct {
LocalizedName LocalizedString `json:"name" validate:"required"` // The name of the contributor.
LocalizedSortAs *LocalizedString `json:"sortAs,omitempty"` // The string used to sort the name of the contributor.
Identifier string `json:"identifier,omitempty"` // An unambiguous reference to this contributor.
Roles Strings `json:"role,omitempty"` // The roles of the contributor in the making of the publication.
Position *float64 `json:"position,omitempty"` // The position of the publication in this collection/series, when the contributor represents a collection. TODO validator
Links LinkList `json:"links,omitempty"` // Used to retrieve similar publications for the given contributor.
}
Contributor https://github.com/readium/webpub-manifest/tree/master/contexts/default#contributors https://github.com/readium/webpub-manifest/schema/contributor-object.schema.json
func ContributorFromJSON ¶
func ContributorFromJSON(rawJson interface{}) (*Contributor, error)
Parses a Contributor from its RWPM JSON representation. A contributor can be parsed from a single string, or a full-fledged object. The [links]' href and their children's will be normalized recursively using the provided [normalizeHref] closure.
func ContributorFromJSONArray ¶
func ContributorFromJSONArray(rawJsonArray interface{}) ([]Contributor, error)
func (Contributor) Copy ¶ added in v0.6.0
func (c Contributor) Copy(transformer ManifestTransformer) Contributor
func (Contributor) MarshalJSON ¶
func (c Contributor) MarshalJSON() ([]byte, error)
func (Contributor) Name ¶
func (c Contributor) Name() string
func (Contributor) SortAs ¶
func (c Contributor) SortAs() string
func (*Contributor) UnmarshalJSON ¶
func (c *Contributor) UnmarshalJSON(data []byte) error
type Contributors ¶
type Contributors []Contributor
TODO replace with generic
func (Contributors) Copy ¶ added in v0.6.0
func (c Contributors) Copy(transformer ManifestTransformer) Contributors
func (Contributors) MarshalJSON ¶
func (c Contributors) MarshalJSON() ([]byte, error)
type EPUBLayout ¶
type EPUBLayout string
Hints how the layout of the resource should be presented. https://readium.org/webpub-manifest/schema/extensions/epub/metadata.schema.json
const ( EPUBLayoutFixed EPUBLayout = "fixed" EPUBLayoutReflowable EPUBLayout = "reflowable" )
type Encryption ¶
type Encryption struct {
Scheme string `json:"scheme,omitempty"`
Profile string `json:"profile,omitempty"`
Algorithm string `json:"algorithm,omitempty"`
Compression string `json:"compression,omitempty"`
OriginalLength int64 `json:"originalLength,omitempty"`
}
Encryption contains metadata from encryption xml
func EncryptionFromJSON ¶
func EncryptionFromJSON(rawJson map[string]interface{}) (*Encryption, error)
func (Encryption) ToMap ¶
func (m Encryption) ToMap() map[string]interface{}
func (*Encryption) UnmarshalJSON ¶
func (e *Encryption) UnmarshalJSON(data []byte) error
type GuidedNavigationDocument ¶ added in v0.5.0
type GuidedNavigationDocument struct {
}
Readium Guided Navigation Document https://readium.org/guided-navigation/schema/document.schema.json
type GuidedNavigationObject ¶ added in v0.5.0
type GuidedNavigationObject struct {
}
Readium Guided Navigation Object https://readium.org/guided-navigation/schema/object.schema.json TODO: Role should be typed TODO: all refs should be url.URL
type HREF ¶ added in v0.6.0
type HREF struct {
// contains filtered or unexported fields
}
An hypertext reference points to a resource in a [Publication]. It is potentially templated, use [Resolve] to get the actual URL.
func MustNewHREFFromString ¶ added in v0.6.0
Proxy for NewHREFFromString which panics if the URL is invalid.
func NewHREFFromString ¶ added in v0.6.0
Creates an HREF from a valid URL or URL template (RFC 6570). `templated` Indicates whether [href] is a URL template.
func (HREF) Copy ¶ added in v0.6.0
func (h HREF) Copy(transformer ManifestTransformer) HREF
func (HREF) IsTemplated ¶ added in v0.6.0
Indicates whether this HREF is templated.
func (HREF) Parameters ¶ added in v0.6.0
List of URI template parameter keys, if the HREF is templated.
func (HREF) Resolve ¶ added in v0.6.0
Returns the URL represented by this HREF, resolved to the given [base] URL. If the HREF is a template, the [parameters] are used to expand it according to RFC 6570.
type HREFNormalizer ¶ added in v0.6.0
type HREFNormalizer struct {
// contains filtered or unexported fields
}
func NewHREFNormalizer ¶ added in v0.6.0
func NewHREFNormalizer(baseURL url.URL) HREFNormalizer
func (HREFNormalizer) TransformHREF ¶ added in v0.6.0
func (n HREFNormalizer) TransformHREF(href HREF) HREF
TransformHREF implements ManifestTransformer
func (HREFNormalizer) TransformLink ¶ added in v0.6.0
func (n HREFNormalizer) TransformLink(link Link) Link
TransformLink implements ManifestTransformer
func (HREFNormalizer) TransformManifest ¶ added in v0.6.0
func (n HREFNormalizer) TransformManifest(manifest Manifest) Manifest
TransformManifest implements ManifestTransformer
func (HREFNormalizer) TransformMetadata ¶ added in v0.6.0
func (n HREFNormalizer) TransformMetadata(metadata Metadata) Metadata
TransformMetadata implements ManifestTransformer
type Link ¶
type Link struct {
Href HREF `json:"href"` // URI or URI template of the linked resource.
MediaType *mediatype.MediaType `json:"type,omitempty"` // MIME type of the linked resource.
Title string `json:"title,omitempty"` // Title of the linked resource.
Rels Strings `json:"rel,omitempty"` // Relation between the linked resource and its containing collection.
Properties Properties `json:"properties,omitempty"` // Properties associated to the linked resource.
Height uint `json:"height,omitempty"` // Height of the linked resource in pixels.
Width uint `json:"width,omitempty"` // Width of the linked resource in pixels.
Bitrate float64 `json:"bitrate,omitempty"` // Bitrate of the linked resource in kbps.
Duration float64 `json:"duration,omitempty"` // Length of the linked resource in seconds.
Languages Strings `json:"language,omitempty"` // Expected language of the linked resource (BCP 47 tag).
Alternates LinkList `json:"alternate,omitempty"` // Alternate resources for the linked resource.
Children LinkList `json:"children,omitempty"` // Resources that are children of the linked resource, in the context of a given collection role.
}
Link https://github.com/readium/webpub-manifest/blob/master/README.md#24-the-link-object https://github.com/readium/webpub-manifest/blob/master/schema/link.schema.json
func LinkFromJSON ¶
Creates an Link from its RWPM JSON representation.
func LinksFromJSONArray ¶
func (Link) Copy ¶ added in v0.6.0
func (l Link) Copy(transformer ManifestTransformer) Link
func (Link) MarshalJSON ¶
func (Link) NormalizeHREFsToBase ¶ added in v0.6.0
Returns a copy of the receiver after normalizing its HREFs to the given [baseUrl].
func (Link) URL ¶ added in v0.6.0
Returns the URL represented by this link's HREF, resolved to the given [base] URL. If the HREF is a template, the [parameters] are used to expand it according to RFC 6570.
func (*Link) UnmarshalJSON ¶
type LinkList ¶
type LinkList []Link
Slice of links
func (LinkList) AllAreAudio ¶
Returns whether all the resources in the collection are audio clips.
func (LinkList) AllAreBitmap ¶
Returns whether all the resources in the collection are bitmaps.
func (LinkList) AllAreHTML ¶
Returns whether all the resources in the collection are HTML documents.
func (LinkList) AllAreVideo ¶
Returns whether all the resources in the collection are video clips.
func (LinkList) AllAreVisual ¶
Returns whether all the resources in the collection are bitmaps or video clips.
func (LinkList) AllMatchMediaType ¶
Returns whether all the resources in the collection are matching the given media type.
func (LinkList) Copy ¶ added in v0.6.0
func (ll LinkList) Copy(transformer ManifestTransformer) LinkList
func (LinkList) FilterByMediaType ¶
Finds all the links matching any of the given media types.
func (LinkList) FilterByRel ¶
Finds all the links with the given relation.
func (LinkList) FirstWithHref ¶
Finds the first link matching the given HREF.
func (LinkList) FirstWithMediaType ¶
Finds the first link matching the given media type.
func (LinkList) FirstWithRel ¶
Finds the first link with the given relation.
type LocalizedString ¶
func LocalizedStringFromJSON ¶
func LocalizedStringFromJSON(d interface{}) (*LocalizedString, error)
func NewLocalizedStringFromString ¶
func NewLocalizedStringFromString(value string) LocalizedString
func NewLocalizedStringFromStrings ¶
func NewLocalizedStringFromStrings(strings map[string]string) LocalizedString
Shortcut to create a LocalizedString using a map of translations indexed by the BCP 47 language tag.
func (*LocalizedString) DefaultTranslation ¶
func (l *LocalizedString) DefaultTranslation() string
func (*LocalizedString) GetOrFallback ¶
func (l *LocalizedString) GetOrFallback(language string) string
GetOrFallback Returns the first translation for the given [language] BCP–47 tag.
func (*LocalizedString) Length ¶
func (l *LocalizedString) Length() int
func (LocalizedString) MarshalJSON ¶
func (l LocalizedString) MarshalJSON() ([]byte, error)
func (*LocalizedString) SetDefaultTranslation ¶
func (l *LocalizedString) SetDefaultTranslation(value string)
func (*LocalizedString) SetTranslation ¶
func (l *LocalizedString) SetTranslation(language string, value string)
func (*LocalizedString) String ¶
func (l *LocalizedString) String() string
func (*LocalizedString) UnmarshalJSON ¶
func (l *LocalizedString) UnmarshalJSON(data []byte) error
type Locations ¶
type Locations struct {
Fragments []string `json:"fragments,omitempty"` // Contains one or more fragment in the resource referenced by the [Locator].
Progression *float64 `json:"progression,omitempty"` // Progression in the resource expressed as a percentage (between 0 and 1).
Position *uint `json:"position,omitempty"` // An index in the publication (>= 1).
TotalProgression *float64 `json:"totalProgression,omitempty"` // Progression in the publication expressed as a percentage (between 0 and 1).
OtherLocations map[string]interface{} // Additional locations for extensions.
}
One or more alternative expressions of the location. https://github.com/readium/architecture/tree/master/models/locators#the-location-object
func LocationsFromJSON ¶
func (Locations) CSSSelector ¶
func (Locations) MarshalJSON ¶
func (*Locations) UnmarshalJSON ¶
type Locator ¶
type Locator struct {
Href url.URL `json:"href"`
MediaType mediatype.MediaType `json:"type"`
Title string `json:"title,omitempty"`
Locations Locations `json:"locations,omitempty"`
Text Text `json:"text,omitempty"`
}
Locator provides a precise location in a publication in a format that can be stored and shared.
There are many different use cases for locators:
- getting back to the last position in a publication
- bookmarks
- highlights & annotations
- search results
- human-readable (and shareable) reference in a publication
https://github.com/readium/architecture/tree/master/locators
func LocatorFromJSON ¶
func (Locator) MarshalJSON ¶
func (*Locator) UnmarshalJSON ¶
type Manifest ¶
type Manifest struct {
Context Strings `json:"@context,omitempty"`
Metadata Metadata `json:"metadata"`
Links LinkList `json:"links"`
ReadingOrder LinkList `json:"readingOrder,omitempty"`
Resources LinkList `json:"resources,omitempty"` //Replaces the manifest but less redundant
TableOfContents LinkList `json:"toc,omitempty"`
Subcollections PublicationCollectionMap `json:"-"` //Extension point for collections that shouldn't show up in the manifest
}
Manifest Main structure for a publication
func ManifestFromJSON ¶
Parses a Manifest from its RWPM JSON representation.
TODO log [warnings] ? https://readium.org/webpub-manifest/ https://readium.org/webpub-manifest/schema/publication.schema.json
func (Manifest) ConformsTo ¶
Returns whether this manifest conforms to the given Readium Web Publication Profile.
func (Manifest) Copy ¶ added in v0.6.0
func (m Manifest) Copy(transformer ManifestTransformer) Manifest
Creates a copy of the receiver Manifest, applying the given [transformer] to each component.
func (Manifest) LinkWithHref ¶
Finds the first Link with the given href in the manifest's links. Searches through (in order) the reading order, resources and links recursively following alternate and children links. If there's no match, tries again after removing any query parameter and anchor from the given href.
func (Manifest) LinkWithRel ¶
Finds the first Link with the given relation in the manifest's links.
func (Manifest) LinksWithRel ¶
Finds all [Link]s having the given [rel] in the manifest's links.
func (Manifest) LocatorFromLink ¶
Creates a new Locator object from a Link to a resource of this manifest. Returns nil if the resource is not found in this manifest.
func (Manifest) MarshalJSON ¶
func (Manifest) NormalizeHREFsToBase ¶ added in v0.6.0
Returns a copy of the receiver after normalizing its HREFs to the given [baseUrl].
func (Manifest) NormalizeHREFsToSelf ¶ added in v0.6.0
Returns a copy of the receiver after normalizing its HREFs to the link with `rel="self"`.
func (*Manifest) UnmarshalJSON ¶
type ManifestTransformer ¶ added in v0.6.0
type ManifestTransformer interface {
TransformManifest(manifest Manifest) Manifest
TransformMetadata(metadata Metadata) Metadata
TransformLink(link Link) Link
TransformHREF(href HREF) HREF
}
Transforms a manifest's components.
type MediaOverlay ¶ added in v0.5.0
type MediaOverlay struct {
ActiveClass string `json:"activeClass,omitempty"` // Author-defined CSS class name to apply to the currently-playing EPUB Content Document element.
PlaybackActiveClass string `json:"playbackActiveClass,omitempty"` // Author-defined CSS class name to apply to the EPUB Content Document's document element when playback is active.
}
EPUB profile extension for WebPub Manifest for media overlay features.
type Metadata ¶
type Metadata struct {
Identifier string `json:"identifier,omitempty"`
Type string `json:"@type,omitempty"`
ConformsTo Profiles `json:"conformsTo,omitempty"`
LocalizedTitle LocalizedString `json:"title" validate:"required"`
LocalizedSubtitle *LocalizedString `json:"subtitle,omitempty"`
LocalizedSortAs *LocalizedString `json:"sortAs,omitempty"`
Accessibility *A11y `json:"accessibility,omitempty"`
Modified *time.Time `json:"modified,omitempty"`
Published *time.Time `json:"published,omitempty"`
Languages Strings `json:"language,omitempty" validate:"BCP47"` // TODO validator
Subjects []Subject `json:"subject,omitempty"`
Authors Contributors `json:"author,omitempty"`
Translators Contributors `json:"translator,omitempty"`
Editors Contributors `json:"editor,omitempty"`
Artists Contributors `json:"artist,omitempty"`
Illustrators Contributors `json:"illustrator,omitempty"`
Letterers Contributors `json:"letterer,omitempty"`
Pencilers Contributors `json:"penciler,omitempty"`
Colorists Contributors `json:"colorist,omitempty"`
Inkers Contributors `json:"inker,omitempty"`
Narrators Contributors `json:"narrator,omitempty"`
Contributors Contributors `json:"contributor,omitempty"`
Publishers Contributors `json:"publisher,omitempty"`
Imprints Contributors `json:"imprint,omitempty"`
ReadingProgression ReadingProgression `json:"readingProgression,omitempty" validate:"readingProgression"` // TODO validator.
Description string `json:"description,omitempty"`
Duration *float64 `json:"duration,omitempty" validator:"positive"` // TODO validator
NumberOfPages *uint `json:"numberOfPages,omitempty"`
BelongsTo map[string]Collections `json:"belongsTo,omitempty"`
Presentation *Presentation `json:"presentation,omitempty"`
MediaOverlay *MediaOverlay `json:"mediaOverlay,omitempty"`
OtherMetadata map[string]interface{} `json:"-"` // Extension point for other metadata.
}
Metadata for the default context in WebPub
func MetadataFromJSON ¶
func (Metadata) BelongsToCollections ¶
func (m Metadata) BelongsToCollections() []Collection
func (Metadata) BelongsToSeries ¶
func (m Metadata) BelongsToSeries() []Collection
func (Metadata) Copy ¶ added in v0.6.0
func (m Metadata) Copy(transformer ManifestTransformer) Metadata
func (Metadata) EffectiveReadingProgression ¶
func (m Metadata) EffectiveReadingProgression() ReadingProgression
func (Metadata) InferredAccessibility ¶
InferredAccessibility returns the accessibility metadata inferred from the manifest and stored in OtherMetadata.
func (Metadata) MarshalJSON ¶
func (Metadata) SetOtherMetadata ¶
SetOtherMetadata marshalls the value to a JSON map before storing it in OtherMetadata under the given key.
func (*Metadata) UnmarshalJSON ¶
type Orientation ¶
type Orientation string // Suggested orientation for the device when displaying the linked resource.
const ( OrientationAuto Orientation = "auto" OrientationLandscape Orientation = "landscape" OrientationPortrait Orientation = "portrait" )
type Overflow ¶
type Overflow string // Suggested method for handling overflow while displaying the linked resource.
type Page ¶
type Page string // Indicates how the linked resource should be displayed in a reading environment that displays synthetic spreads.
type Presentation ¶
type Presentation struct {
Clipped *bool `json:"clipped,omitempty"` // Specifies whether or not the parts of a linked resource that flow out of the viewport are clipped.
Continuous *bool `json:"continuous,omitempty"` // Indicates how the progression between resources from the [readingOrder] should be handled.
Fit *Fit `json:"fit,omitempty"` // Suggested method for constraining a resource inside the viewport.
Orientation *Orientation `json:"orientation,omitempty"` // Suggested orientation for the device when displaying the linked resource.
Overflow *Overflow `json:"overflow,omitempty"` // Suggested method for handling overflow while displaying the linked resource.
Spread *Spread `json:"spread,omitempty"` // Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
Layout *EPUBLayout `json:"layout,omitempty"` // Hints how the layout of the resource should be presented (EPUB extension).
}
*
- The Presentation Hints extension defines a number of hints for User Agents about the way content
- should be presented to the user. *
- https://readium.org/webpub-manifest/modules/presentation.html
- https://readium.org/webpub-manifest/schema/extensions/presentation/metadata.schema.json *
- These properties are nullable to avoid having default values when it doesn't make sense for a
- given [Publication]. If a navigator needs a default value when not specified,
- Presentation.DEFAULT_X and Presentation.X.DEFAULT can be used.
func NewPresentation ¶
func NewPresentation() *Presentation
func (Presentation) LayoutOf ¶
func (p Presentation) LayoutOf(link Link) EPUBLayout
Get the layout of the given resource in this publication. Falls back on REFLOWABLE.
func (Presentation) MarshalJSON ¶
func (p Presentation) MarshalJSON() ([]byte, error)
func (*Presentation) UnmarshalJSON ¶
func (p *Presentation) UnmarshalJSON(data []byte) error
type Properties ¶
type Properties map[string]interface{}
func PropertiesFromJSON ¶
func PropertiesFromJSON(rawJson interface{}) (Properties, error)
func (Properties) Clipped ¶
func (p Properties) Clipped() *bool
Specifies whether or not the parts of a linked resource that flow out of the viewport are clippped.
func (Properties) Contains ¶
func (p Properties) Contains() []string
func (Properties) Encryption ¶
func (p Properties) Encryption() *Encryption
func (Properties) Fit ¶
func (p Properties) Fit() Fit
Suggested method for constraining a resource inside the viewport.
func (*Properties) Get ¶
func (p *Properties) Get(key string) interface{}
func (Properties) GetBool ¶
func (p Properties) GetBool(key string) *bool
func (Properties) GetString ¶
func (p Properties) GetString(key string) string
func (Properties) Layout ¶
func (p Properties) Layout() EPUBLayout
Hints how the layout of the resource should be presented.
func (Properties) Orientation ¶
func (p Properties) Orientation() Orientation
Suggested orientation for the device when displaying the linked resource.
func (Properties) Overflow ¶
func (p Properties) Overflow() Overflow
Suggested method for handling overflow while displaying the linked resource.
func (Properties) Page ¶
func (p Properties) Page() Page
Indicates how the linked resource should be displayed in a reading environment that displays synthetic spreads.
func (Properties) Spread ¶
func (p Properties) Spread() Spread
Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
func (*Properties) UnmarshalJSON ¶
func (p *Properties) UnmarshalJSON(data []byte) error
type PublicationCollection ¶
type PublicationCollection struct {
Metadata map[string]interface{} `json:"metadata,omitempty"`
Links LinkList `json:"links,omitempty"`
Subcollections PublicationCollectionMap `json:"-"`
}
PublicationCollection can be used as extension point in the Readium Web Publication Manifest. https://readium.org/webpub-manifest/schema/subcollection.schema.json
func PublicationCollectionFromJSON ¶
func PublicationCollectionFromJSON(rawJson interface{}) (*PublicationCollection, error)
Parses a PublicationCollection from its RWPM JSON representation.
TODO log [warnings] ?
The [links]' href and their children's will be normalized recursively using the provided [normalizeHref] closure.
func (PublicationCollection) Copy ¶ added in v0.6.0
func (p PublicationCollection) Copy(transformer ManifestTransformer) PublicationCollection
func (PublicationCollection) MarshalJSON ¶
func (pc PublicationCollection) MarshalJSON() ([]byte, error)
func (*PublicationCollection) UnmarshalJSON ¶
func (pc *PublicationCollection) UnmarshalJSON(b []byte) error
type PublicationCollectionMap ¶
type PublicationCollectionMap map[string][]PublicationCollection
func PublicationCollectionsFromJSON ¶
func PublicationCollectionsFromJSON(rawJson map[string]interface{}) (PublicationCollectionMap, error)
Parses a map of PublicationCollection indexed by their roles from its RWPM JSON representation.
The [Links]' href and their children's will be normalized recursively using the provided [normalizeHref] closure.
func (PublicationCollectionMap) Copy ¶ added in v0.6.0
func (p PublicationCollectionMap) Copy(transformer ManifestTransformer) PublicationCollectionMap
func (PublicationCollectionMap) MarshalJSON ¶
func (pcm PublicationCollectionMap) MarshalJSON() ([]byte, error)
func (*PublicationCollectionMap) UnmarshalJSON ¶
func (pcm *PublicationCollectionMap) UnmarshalJSON(b []byte) error
type ReadingProgression ¶
type ReadingProgression string
ReadingProgression This is not a proper enum replacement! Use the validator to enforce the values
const ( Auto ReadingProgression = "auto" LTR ReadingProgression = "ltr" RTL ReadingProgression = "rtl" TTB ReadingProgression = "ttb" BTT ReadingProgression = "btt" )
type Spread ¶
type Spread string // Indicates the condition to be met for the linked resource to be rendered within a synthetic spread.
type Subject ¶
type Subject struct {
LocalizedName LocalizedString `json:"name" validate:"required"`
LocalizedSortAs *LocalizedString `json:"sortAs,omitempty"`
Scheme string `json:"scheme,omitempty"`
Code string `json:"code,omitempty"`
Links LinkList `json:"links,omitempty"`
}
Subject https://github.com/readium/webpub-manifest/tree/master/contexts/default#subjects https://github.com/readium/webpub-manifest/blob/master/schema/subject-object.schema.json
func SubjectFromJSON ¶
Parses a Subject from its RWPM JSON representation. A subject can be parsed from a single string, or a full-fledged object. The [links]' href and their children's will be normalized recursively using the provided [normalizeHref] closure.
func SubjectFromJSONArray ¶
Creates a list of Subject from its RWPM JSON representation. The [links]' href and their children's will be normalized recursively using the provided [normalizeHref] closure.
func (Subject) Copy ¶ added in v0.6.0
func (s Subject) Copy(transformer ManifestTransformer) Subject
func (Subject) MarshalJSON ¶
func (*Subject) UnmarshalJSON ¶
type Text ¶
type Text struct {
Before string `json:"before,omitempty"` // The text before the locator.
Highlight string `json:"highlight,omitempty"` // The text at the locator.
After string `json:"after,omitempty"` // The text after the locator.
}
Textual context of the locator. A Locator Text Object contains multiple text fragments, useful to give a context to the Locator or for highlights. https://github.com/readium/architecture/tree/master/models/locators#the-text-object