diff --git a/src/byteb4rb1e/sphinxcontrib/theme/seaharvest/__init__.py b/src/byteb4rb1e/sphinxcontrib/theme/seaharvest/__init__.py index c8a5de2..b0c1807 100644 --- a/src/byteb4rb1e/sphinxcontrib/theme/seaharvest/__init__.py +++ b/src/byteb4rb1e/sphinxcontrib/theme/seaharvest/__init__.py @@ -2,22 +2,79 @@ Tiara's Sphinx theme reference implementation. """ +from datclasses import dataclass from pathlib import Path +import pkg_resources from sys import version_info as python_version +import os.path +from typing import Optional from sphinx import version_info as sphinx_version +from sphinx import application from sphinx.locale import _ from sphinx.util.logging import getLogger +from hashlib import sha256 + +digest = sha256() + +zbuf = zlib.decompressobj() + + +re.sub('-*-', '-', re.sub('[^A-Za-z0-9_-]', '-', __name__)) + + +with pkg_resources.open_binary( + __name__, + '_vendor/html-theme-seaharvest-1.0.0.tar.gz' +) as fh: + + while True: + buf = fh.read(8096) + if not buf: break + digest.update(buf) + zbuf.decompress(buf) + +digest.update() + + + + +@dataclass +class StaticFilesZip(): + """ + """ + basename: str + sha256: str + +static_files_archive = StaticFilesArchive( + path=, + sha256='1234567', +) + + + logger = getLogger(__name__) -def setup(app): +def setup(app: application.Sphinx): """ """ - app.require_sphinx('8.0') + app.require_sphinx('5.0') - app.add_html_theme('sphinx-theme-ref', Path(__file__).resolve().parent) + rootdir = (Path(__file__) / ('../' * 6)) + archive = (rootdir / 'vendor/{static_archive_basename}').resolve() - app.add_js_file('assets/script/theme.js') + + app.add_html_theme(__name__.split('.')[-1], Path(__file__).parent) + + app.add_config_value( + 'html_static_archive_path', + [str(archive)], + True + ) + + app.add_js_file('_static/script/seaharvest.js') + + print(app.config['html_static_archive_path']) return {'parallel_read_safe': True, 'parallel_write_safe': True}