a8s

package module
v0.0.0-...-0f341a9 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 17 Imported by: 0

README

builds.sr.ht status

a8s

A library to parse/validate W3C audiobooks.

Documentation

Index

Constants

View Source
const (

	// AudiobookProfile is the W3C Audiobooks profile
	AudiobookProfile = "https://www.w3.org/TR/audiobooks/"
	// PublicationManifestProfile is the W3C Publication Manifest profile
	PublicationManifestProfile = "https://www.w3.org/TR/pub-manifest/"
)

Variables

This section is empty.

Functions

func GetDocAndTOC

func GetDocAndTOC(path *url.URL, m *Manifest, cm map[string]interface{}) (*html.Node, map[string]interface{})

GetDocAndTOC looks for a table of contents in the manifest and, if found, returns the html.Node and TOC entries.

Types

type Manifest

type Manifest struct {
	Text     []byte
	URI      string
	Type     manifestType
	Document *htmlDocument
}

Manifest wraps publication manifest text, URI, type and, optionally, the HTML document that contains the publication manifest.

func GetManifestFromURI

func GetManifestFromURI(uri *url.URL) (*Manifest, error)

GetManifestFromURI parses and validates publication manifest based on the URI scheme.

func (*Manifest) ProcessManifest

func (m *Manifest) ProcessManifest() (map[string]interface{}, []error)

ProcessManifest parses and validates the publication manifest and returns any errors that were found during validation.

type ManifestError

type ManifestError struct {
	Severity Severity
	// contains filtered or unexported fields
}

ManifestError corresponds to errors returned while parsing and validating the W3C publication manifest.

func NewFatalError

func NewFatalError(message string) *ManifestError

NewFatalError returns a ManifestError with fatal severity.

func NewValidationError

func NewValidationError(message string) *ManifestError

NewValidationError returns a ManifestError with validation severity.

func (*ManifestError) Error

func (m *ManifestError) Error() string

type Severity

type Severity int

Severity indicates the level of severity of publication manifest validation errors.

const (
	// Validation level severity is recoverable.
	Validation Severity = iota
	// Fatal level severity is not recoverable - the manifest is invalid and
	// all processing should stop.
	Fatal
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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