Source code for betty.extension.maps
"""Integrate Betty with `Leaflet.js <https://leafletjs.com/>`_."""
from __future__ import annotations
from collections.abc import Sequence
from pathlib import Path
from betty.app.extension import Extension, UserFacingExtension
from betty.extension.webpack import Webpack, WebpackEntrypointProvider
from betty.locale import Str
[docs]
class Maps(UserFacingExtension, WebpackEntrypointProvider):
[docs]
@classmethod
def name(cls) -> str:
return "betty.extension.Maps"
[docs]
@classmethod
def depends_on(cls) -> set[type[Extension]]:
return {Webpack}
[docs]
@classmethod
def assets_directory_path(cls) -> Path:
return Path(__file__).parent / "assets"
[docs]
@classmethod
def webpack_entrypoint_directory_path(cls) -> Path:
return Path(__file__).parent / "webpack"
[docs]
def webpack_entrypoint_cache_keys(self) -> Sequence[str]:
return ()
[docs]
@classmethod
def label(cls) -> Str:
return Str._("Maps")
[docs]
@classmethod
def description(cls) -> Str:
return Str._(
'Display lists of places as interactive maps using <a href="https://leafletjs.com/">Leaflet</a>.'
)