Documentation ¶
Index ¶
- func ElementToMap(e Element) map[string]interface{}
- type Attribute
- type AttributeKey
- type AttributesHolder
- type AudioElement
- type Body
- type Element
- type EmbeddedElement
- type Footnote
- type Heading
- type ImageElement
- type Quote
- type TextElement
- type TextRole
- type TextSegment
- type TextualElement
- type VideoElement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElementToMap ¶
Types ¶
type Attribute ¶
type Attribute[T any] struct { Key AttributeKey Value T }
An attribute is an arbitrary key-value metadata pair.
func NewAttribute ¶
func NewAttribute(key AttributeKey, value any) Attribute[any]
type AttributeKey ¶
type AttributeKey string
const AcessibilityLabelAttributeKey AttributeKey = "accessibilityLabel"
const LanguageAttributeKey AttributeKey = "language"
type AttributesHolder ¶
type AttributesHolder struct {
// contains filtered or unexported fields
}
An object associated with a list of attributes.
func NewAttributesHolder ¶
func NewAttributesHolder(attributes []Attribute[any]) AttributesHolder
func (AttributesHolder) AccessibilityLabel ¶
func (ah AttributesHolder) AccessibilityLabel() string
func (AttributesHolder) Attributes ¶
func (ah AttributesHolder) Attributes() AttributesHolder
func (AttributesHolder) Get ¶
func (ah AttributesHolder) Get(key AttributeKey) AttributesHolder
Gets all the attributes with the given [key].
func (AttributesHolder) GetFirst ¶
func (ah AttributesHolder) GetFirst(key AttributeKey) *Attribute[any]
Gets the first attribute with the given [key].
func (AttributesHolder) Language ¶
func (ah AttributesHolder) Language() string
type AudioElement ¶
type AudioElement struct { AttributesHolder // contains filtered or unexported fields }
An audio clip.
func NewAudioElement ¶
func (AudioElement) EmbeddedLink ¶
func (e AudioElement) EmbeddedLink() manifest.Link
Implements EmbeddedElement
func (AudioElement) MarshalJSON ¶
func (e AudioElement) MarshalJSON() ([]byte, error)
type Element ¶
type Element interface { // AttributesHolder Language() string AccessibilityLabel() string Attributes() AttributesHolder Locator() manifest.Locator // Locator targeting this element in the Publication. }
Represents a single semantic content element part of a publication.
type EmbeddedElement ¶
type EmbeddedElement interface { // AttributesHolder Language() string AccessibilityLabel() string Attributes() AttributesHolder // Element Locator() manifest.Locator // Locator targeting this element in the Publication. EmbeddedLink() manifest.Link // Referenced resource in the publication. }
An element referencing an embedded external resource.
type Heading ¶
type Heading struct {
Level int // Heading importance, 1 being the highest.
}
Title of a section.
type ImageElement ¶
type ImageElement struct { AttributesHolder // contains filtered or unexported fields }
A bitmap image. The caption is a short piece of text associated with the image.
func NewImageElement ¶
func (ImageElement) EmbeddedLink ¶
func (e ImageElement) EmbeddedLink() manifest.Link
Implements EmbeddedElement
func (ImageElement) MarshalJSON ¶
func (e ImageElement) MarshalJSON() ([]byte, error)
type Quote ¶
type TextElement ¶
type TextElement struct { AttributesHolder // contains filtered or unexported fields }
A text element.
func NewTextElement ¶
func NewTextElement(locator manifest.Locator, role TextRole, segments []TextSegment, attributes []Attribute[any]) TextElement
func (TextElement) MarshalJSON ¶
func (e TextElement) MarshalJSON() ([]byte, error)
func (TextElement) Role ¶
func (e TextElement) Role() TextRole
type TextRole ¶
type TextRole interface {
Role() string
}
Represents a purpose of an element in the broader context of the document.
type TextSegment ¶
type TextSegment struct { AttributesHolder // Attributes associated with this segment, e.g. language. Locator manifest.Locator // Locator to the segment of text. Text string // Text in the segment. }
Ranged portion of text with associated attributes.
type TextualElement ¶
type TextualElement interface { // AttributesHolder Language() string AccessibilityLabel() string Attributes() AttributesHolder // Element Locator() manifest.Locator // Locator targeting this element in the Publication. Text() string // Human-readable text representation for this element. }
An element which can be represented as human-readable text.
type VideoElement ¶
type VideoElement struct { AttributesHolder // contains filtered or unexported fields }
A video clip.
func NewVideoElement ¶
func (VideoElement) EmbeddedLink ¶
func (e VideoElement) EmbeddedLink() manifest.Link
Implements EmbeddedElement
func (VideoElement) MarshalJSON ¶
func (e VideoElement) MarshalJSON() ([]byte, error)