Coverage for lode / helpers / links.py: 100%
10 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-22 15:54 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-11-22 15:54 +0000
1"""Where the things a page links to live: what a viewer cannot know by itself."""
2from typing import Optional
5class Links:
6 """Tell a viewer the addresses of resources, exports and the whole artefact.
8 The web service and the static site each know where these live (a query string, a relative
9 path); the viewer does not. This base class answers "nowhere": every method returns None, which
10 is what a library user without a site gets. A caller subclasses it and answers.
11 """
13 def resource(self, iri: str) -> Optional[str]:
14 """Return the address of the page of a resource of this documentation, or None when it has no page here: the viewer then links to the IRI itself."""
15 return None
17 def export(self, ext: str, iri: Optional[str] = None) -> Optional[str]:
18 """Return where to download the artefact, or the resource `iri`, in the format with extension `ext`."""
19 return None
21 def home(self) -> Optional[str]:
22 """Return the address of the page of the whole artefact, or None."""
23 return None
25 def visualize(self, iri: str) -> Optional[str]:
26 """Return the address that opens the documentation of another ontology, or None.
28 Only the service can do it (it reads and renders on request); a static site cannot.
29 """
30 return None