dsgovbr-sphinx-theme 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. dsgovbr_sphinx_theme/__init__.py +71 -0
  2. dsgovbr_sphinx_theme/componentes.py +1109 -0
  3. dsgovbr_sphinx_theme/componentes_static/vendor/bootstrap/LICENSE +21 -0
  4. dsgovbr_sphinx_theme/componentes_static/vendor/bootstrap/bootstrap.bundle.min.js +7 -0
  5. dsgovbr_sphinx_theme/componentes_static/vendor/dsgovbr-bootstraped/LICENSE +21 -0
  6. dsgovbr_sphinx_theme/componentes_static/vendor/dsgovbr-bootstraped/dsgovbr-bootstraped.min.css +5 -0
  7. dsgovbr_sphinx_theme/dsgovbr-breadcrumb.html +22 -0
  8. dsgovbr_sphinx_theme/dsgovbr-menu.html +23 -0
  9. dsgovbr_sphinx_theme/layout.html +149 -0
  10. dsgovbr_sphinx_theme/static/css/dsgovbr-sphinx-theme.css +369 -0
  11. dsgovbr_sphinx_theme/static/css/rawline.css +68 -0
  12. dsgovbr_sphinx_theme/static/fonts/rawline/OFL.txt +95 -0
  13. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-300.woff2 +0 -0
  14. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-400.woff2 +0 -0
  15. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-400i.woff2 +0 -0
  16. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-500.woff2 +0 -0
  17. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-600.woff2 +0 -0
  18. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-600i.woff2 +0 -0
  19. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-700.woff2 +0 -0
  20. dsgovbr_sphinx_theme/static/fonts/rawline/rawline-700i.woff2 +0 -0
  21. dsgovbr_sphinx_theme/static/js/dsgovbr-sphinx-theme.js +127 -0
  22. dsgovbr_sphinx_theme/theme.toml +27 -0
  23. dsgovbr_sphinx_theme-0.1.0.dist-info/METADATA +102 -0
  24. dsgovbr_sphinx_theme-0.1.0.dist-info/RECORD +30 -0
  25. dsgovbr_sphinx_theme-0.1.0.dist-info/WHEEL +5 -0
  26. dsgovbr_sphinx_theme-0.1.0.dist-info/entry_points.txt +2 -0
  27. dsgovbr_sphinx_theme-0.1.0.dist-info/licenses/LICENSE +21 -0
  28. dsgovbr_sphinx_theme-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +36 -0
  29. dsgovbr_sphinx_theme-0.1.0.dist-info/licenses/src/dsgovbr_sphinx_theme/static/fonts/rawline/OFL.txt +95 -0
  30. dsgovbr_sphinx_theme-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,71 @@
1
+ """Tema Sphinx comunitário e não oficial inspirado no Design System GOV.BR (DSGovBR)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ try:
10
+ __version__ = version("dsgovbr-sphinx-theme")
11
+ except PackageNotFoundError: # pragma: no cover - execução a partir do código-fonte
12
+ __version__ = "0.0.0"
13
+
14
+ THEME_NAME = "dsgovbr_sphinx_theme"
15
+
16
+
17
+ def get_html_theme_path() -> str:
18
+ """Retorna o diretório do tema (o que contém ``theme.toml``).
19
+
20
+ Mantido para quem ainda usa ``html_theme_path``; com o pacote instalado o
21
+ Sphinx encontra o tema pelo *entry point* ``sphinx.html_themes``.
22
+ """
23
+ return str(Path(__file__).resolve().parent)
24
+
25
+
26
+ def _parse_links(raw: Any) -> list[tuple[str, str]]:
27
+ """Converte ``navigation_links`` em pares (título, destino).
28
+
29
+ Aceita lista de pares/dicionários ou a string ``"Título|destino, Outro|url"``.
30
+ """
31
+ if not raw:
32
+ return []
33
+ links: list[tuple[str, str]] = []
34
+ if isinstance(raw, str):
35
+ for item in raw.split(","):
36
+ if not item.strip():
37
+ continue
38
+ title, _, target = item.partition("|")
39
+ if not target.strip():
40
+ raise ValueError(
41
+ f"[{THEME_NAME}] navigation_links: item {item.strip()!r} sem destino; "
42
+ "use 'Título|destino'."
43
+ )
44
+ links.append((title.strip(), target.strip()))
45
+ return links
46
+ for item in raw:
47
+ if isinstance(item, dict):
48
+ links.append((str(item["title"]), str(item["url"])))
49
+ else:
50
+ title, target = item
51
+ links.append((str(title), str(target)))
52
+ return links
53
+
54
+
55
+ def _html_page_context(
56
+ app: Any, pagename: str, templatename: str, context: dict[str, Any], doctree: Any
57
+ ) -> None:
58
+ """Expõe ``dsgovbr_navigation_links`` já normalizado para os templates."""
59
+ options = context.get("theme_navigation_links")
60
+ context["dsgovbr_navigation_links"] = _parse_links(options)
61
+
62
+
63
+ def setup(app: Any) -> dict[str, Any]:
64
+ """Registra o tema no Sphinx."""
65
+ app.add_html_theme(THEME_NAME, get_html_theme_path())
66
+ app.connect("html-page-context", _html_page_context)
67
+ return {
68
+ "version": __version__,
69
+ "parallel_read_safe": True,
70
+ "parallel_write_safe": True,
71
+ }