diff --git a/context.py b/context.py index 1a0a3ad17..11d9b727d 100644 --- a/context.py +++ b/context.py @@ -13,7 +13,8 @@ validContexts = ( "https://w3id.org/security/v1", "*/apschema/v1.9", "*/apschema/v1.21", - "*/litepub-0.1.jsonld" + "*/litepub-0.1.jsonld", + "https://litepub.social/litepub/context.jsonld" ) @@ -129,6 +130,33 @@ def getApschemaV1_21() -> {}: } +def getLitepubSocial() -> {}: + # https://litepub.social/litepub/context.jsonld + return { + '@context': [ + 'https://www.w3.org/ns/activitystreams', + 'https://w3id.org/security/v1', + { + 'Emoji': 'toot:Emoji', + 'Hashtag': 'as:Hashtag', + 'PropertyValue': 'schema:PropertyValue', + 'atomUri': 'ostatus:atomUri', + 'conversation': { + '@id': 'ostatus:conversation', + '@type': '@id' + }, + 'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers', + 'ostatus': 'http://ostatus.org#', + 'schema': 'http://schema.org', + 'sensitive': 'as:sensitive', + 'toot': 'http://joinmastodon.org/ns#', + 'totalItems': 'as:totalItems', + 'value': 'schema:value' + } + ] + } + + def getLitepubV0_1() -> {}: # https://domain/schemas/litepub-0.1.jsonld return { diff --git a/pyjsonld.py b/pyjsonld.py index 0ccffe504..36b44d0bb 100644 --- a/pyjsonld.py +++ b/pyjsonld.py @@ -40,6 +40,7 @@ from numbers import Integral, Real from context import getApschemaV1_9 from context import getApschemaV1_21 from context import getLitepubV0_1 +from context import getLitepubSocial from context import getV1Schema from context import getV1SecuritySchema from context import getActivitystreamsSchema @@ -420,6 +421,13 @@ def load_document(url): 'document': getLitepubV0_1() } return doc + elif url == 'https://litepub.social/litepub/context.jsonld': + doc = { + 'contextUrl': None, + 'documentUrl': url, + 'document': getLitepubSocial() + } + return doc return None except JsonLdError as e: raise e