from core.util.webpub_manifest_parser.core.registry import (
CollectionRole,
LinkRelation,
MediaType,
Registry,
)
[docs]class RWPMCollectionRolesRegistry(Registry):
"""Registry containing collection roles defined in the RWPM spec."""
READING_ORDER = CollectionRole(key="readingOrder", compact=True, required=True)
RESOURCES = CollectionRole(key="resources", compact=True, required=False)
TOC = CollectionRole(key="toc", compact=True, required=False)
GUIDED = CollectionRole(key="guided", compact=True, required=False)
LANDMARKS = CollectionRole(key="landmarks", compact=True, required=False)
LOA = CollectionRole(key="loa", compact=True, required=False)
LOI = CollectionRole(key="loi", compact=True, required=False)
LOT = CollectionRole(key="lot", compact=True, required=False)
LOV = CollectionRole(key="lov", compact=True, required=False)
PAGE_LIST = CollectionRole(key="pageList", compact=True, required=False)
CORE_ROLES = [READING_ORDER, RESOURCES, TOC]
EXTENSIONS = [GUIDED, LANDMARKS, LOA, LOI, LOT, LOV, PAGE_LIST]
def __init__(self):
"""Initialize a new instance of RWPMCollectionRolesRegistry class."""
super(RWPMCollectionRolesRegistry, self).__init__(
self.CORE_ROLES + self.EXTENSIONS
)
[docs]class RWPMLinkRelationsRegistry(Registry):
"""Registry containing link relations mentioned in the RWPM spec."""
ALTERNATE = LinkRelation(key="alternate")
CONTENTS = LinkRelation(key="contents")
COVER = LinkRelation(key="cover")
MANIFEST = LinkRelation(key="manifest")
SEARCH = LinkRelation(key="search")
SELF = LinkRelation(key="self")
CORE_LINK_RELATIONS = [ALTERNATE, CONTENTS, COVER, MANIFEST, SEARCH, SELF]
def __init__(self):
"""Initialize a new instance of RWPMLinkRelationsRegistry class."""
super(RWPMLinkRelationsRegistry, self).__init__(self.CORE_LINK_RELATIONS)