Litepub social context

merge-requests/17/head
Bob Mottram 2021-02-08 14:13:49 +00:00
parent c22c6cc91a
commit 98a1d70565
2 changed files with 37 additions and 1 deletions

View File

@ -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 {

View File

@ -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