moodle-docs-theme 0.4.0__tar.gz → 0.5.0__tar.gz

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 (48) hide show
  1. {moodle_docs_theme-0.4.0/moodle_docs_theme.egg-info → moodle_docs_theme-0.5.0}/PKG-INFO +1 -1
  2. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/__init__.py +1 -1
  3. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/layout.html +9 -4
  4. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/static/css/base.css +20 -1
  5. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/__pycache__/__init__.cpython-314.pyc +0 -0
  6. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/theme.conf +1 -0
  7. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/theme.toml +1 -0
  8. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0/moodle_docs_theme.egg-info}/PKG-INFO +1 -1
  9. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme.egg-info/SOURCES.txt +1 -0
  10. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/pyproject.toml +1 -1
  11. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/setup.py +1 -1
  12. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/tests/test_cli.py +0 -1
  13. moodle_docs_theme-0.5.0/tests/test_header_logo.py +74 -0
  14. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/LICENSE +0 -0
  15. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/MANIFEST.in +0 -0
  16. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/README.md +0 -0
  17. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/__main__.py +0 -0
  18. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/breadcrumbs.html +0 -0
  19. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/cli.py +0 -0
  20. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/page.html +0 -0
  21. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/searchbox.html +0 -0
  22. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/static/css/colors.css +0 -0
  23. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/static/js/theme.js +0 -0
  24. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/__init__.py +0 -0
  25. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/conf.py.tpl +0 -0
  26. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/configuration.md.tpl +0 -0
  27. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/en/conf.py.tpl +0 -0
  28. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/en/configuration.rst.tpl +0 -0
  29. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/en/index.rst.tpl +0 -0
  30. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/en/installation.rst.tpl +0 -0
  31. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/en/usage.rst.tpl +0 -0
  32. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/index.html +0 -0
  33. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/index.md.tpl +0 -0
  34. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/installation.md.tpl +0 -0
  35. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/pt-br/conf.py.tpl +0 -0
  36. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/pt-br/configuration.rst.tpl +0 -0
  37. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/pt-br/index.rst.tpl +0 -0
  38. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/pt-br/installation.rst.tpl +0 -0
  39. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/pt-br/usage.rst.tpl +0 -0
  40. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/requirements.txt +0 -0
  41. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/docs/usage.md.tpl +0 -0
  42. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme/template/workflows/docs.yml +0 -0
  43. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme.egg-info/dependency_links.txt +0 -0
  44. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme.egg-info/entry_points.txt +0 -0
  45. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme.egg-info/requires.txt +0 -0
  46. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/moodle_docs_theme.egg-info/top_level.txt +0 -0
  47. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/setup.cfg +0 -0
  48. {moodle_docs_theme-0.4.0 → moodle_docs_theme-0.5.0}/tests/test_theme.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moodle-docs-theme
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Um tema Sphinx reutilizável inspirado visualmente na documentação oficial do Moodle (docs.moodle.org)
5
5
  Home-page: https://github.com/moodle-by-kelsoncm/moodle-docs-theme
6
6
  Author: KelsonCM
@@ -5,7 +5,7 @@ moodle_docs_theme - A reusable Sphinx HTML theme inspired by docs.moodle.org (Mo
5
5
  import os
6
6
  from typing import Dict, Any
7
7
 
8
- __version__ = "0.4.0"
8
+ __version__ = "0.5.0"
9
9
 
10
10
 
11
11
  def get_html_theme_path() -> str:
@@ -59,15 +59,20 @@
59
59
  <div class="moodle-brand-group">
60
60
  <a href="{{ pathto(master_doc) }}" class="moodle-brand">
61
61
  {% if theme_logo %}
62
- <img src="{{ pathto('_static/' ~ theme_logo, 1) }}" alt="{{ project }}" class="moodle-brand-logo" style="{% if theme_logo_height %}height: {{ theme_logo_height }};{% endif %}" />
62
+ <img src="{{ pathto('_static/' ~ theme_logo, 1) }}" alt="" class="moodle-brand-logo" style="{% if theme_logo_height %}height: {{ theme_logo_height }};{% endif %}" />
63
63
  {% elif logo_url %}
64
- <img src="{{ logo_url }}" alt="{{ project }}" class="moodle-brand-logo" />
64
+ <img src="{{ logo_url }}" alt="" class="moodle-brand-logo" style="{% if theme_logo_height %}height: {{ theme_logo_height }};{% endif %}" />
65
65
  {% elif logo %}
66
- <img src="{{ pathto('_static/' ~ logo, 1) }}" alt="{{ project }}" class="moodle-brand-logo" />
67
- {% else %}
66
+ <img src="{{ pathto('_static/' ~ logo, 1) }}" alt="" class="moodle-brand-logo" style="{% if theme_logo_height %}height: {{ theme_logo_height }};{% endif %}" />
67
+ {% endif %}
68
+ {% set _has_logo = theme_logo or logo_url or logo %}
69
+ {% set _logo_only = theme_logo_only and theme_logo_only|string|lower not in ('false', '0', 'no', '') %}
70
+ {% if not (_has_logo and _logo_only) %}
68
71
  <span class="moodle-brand-title">
69
72
  {% if theme_project_name %}{{ theme_project_name }}{% else %}{{ project }}{% endif %}
70
73
  </span>
74
+ {% elif _has_logo %}
75
+ <span class="visually-hidden">{% if theme_project_name %}{{ theme_project_name }}{% else %}{{ project }}{% endif %}</span>
71
76
  {% endif %}
72
77
  </a>
73
78
  <span class="moodle-tagline">
@@ -70,7 +70,7 @@ img {
70
70
 
71
71
  .moodle-brand-group {
72
72
  display: flex;
73
- align-items: baseline;
73
+ align-items: center;
74
74
  gap: 1rem;
75
75
  }
76
76
 
@@ -83,11 +83,17 @@ img {
83
83
  }
84
84
 
85
85
  .moodle-brand-logo {
86
+ display: block;
86
87
  height: 32px;
87
88
  width: auto;
89
+ flex-shrink: 0;
88
90
  object-fit: contain;
89
91
  }
90
92
 
93
+ .moodle-brand-title {
94
+ line-height: 1.2;
95
+ }
96
+
91
97
  .moodle-brand-title {
92
98
  font-size: 1.65rem;
93
99
  font-weight: 700;
@@ -867,3 +873,16 @@ div.highlight pre {
867
873
  font-size: 1.15rem;
868
874
  }
869
875
  }
876
+
877
+ /* Texto só para leitores de tela (nome do projeto quando logo_only = True). */
878
+ .visually-hidden {
879
+ position: absolute !important;
880
+ width: 1px;
881
+ height: 1px;
882
+ padding: 0;
883
+ margin: -1px;
884
+ overflow: hidden;
885
+ clip: rect(0, 0, 0, 0);
886
+ white-space: nowrap;
887
+ border: 0;
888
+ }
@@ -18,6 +18,7 @@ nav_text_color = #355a83
18
18
 
19
19
  logo =
20
20
  logo_height = 32px
21
+ logo_only = False
21
22
  project_name =
22
23
  tagline = Documentação inspirada no MoodleDocs
23
24
  github_url =
@@ -19,6 +19,7 @@ sidebar_bg = "#fafafa"
19
19
  nav_text_color = "#355a83"
20
20
  logo = ""
21
21
  logo_height = "32px"
22
+ logo_only = false
22
23
  project_name = ""
23
24
  tagline = "Documentação inspirada no MoodleDocs"
24
25
  github_url = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moodle-docs-theme
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Um tema Sphinx reutilizável inspirado visualmente na documentação oficial do Moodle (docs.moodle.org)
5
5
  Home-page: https://github.com/moodle-by-kelsoncm/moodle-docs-theme
6
6
  Author: KelsonCM
@@ -42,4 +42,5 @@ moodle_docs_theme/template/docs/pt-br/installation.rst.tpl
42
42
  moodle_docs_theme/template/docs/pt-br/usage.rst.tpl
43
43
  moodle_docs_theme/template/workflows/docs.yml
44
44
  tests/test_cli.py
45
+ tests/test_header_logo.py
45
46
  tests/test_theme.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "moodle-docs-theme"
7
- version = "0.4.0"
7
+ version = "0.5.0"
8
8
  description = "Um tema Sphinx reutilizável inspirado visualmente na documentação oficial do Moodle (docs.moodle.org)"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
6
6
 
7
7
  setup(
8
8
  name="moodle-docs-theme",
9
- version="0.4.0",
9
+ version="0.5.0",
10
10
  author="KelsonCM",
11
11
  author_email="kelsoncm@gmail.com",
12
12
  description="Um tema Sphinx reutilizável inspirado visualmente na documentação oficial do Moodle (docs.moodle.org)",
@@ -27,7 +27,6 @@ class TestMoodleDocsThemeCLI(unittest.TestCase):
27
27
  def test_infer_plugin_info(self):
28
28
  self.assertEqual(_infer_plugin_info("atto_justify"), ("lib/editor/atto/plugins", "justify"))
29
29
  self.assertEqual(_infer_plugin_info("tiny_fontfamily"), ("lib/editor/tiny/plugins", "fontfamily"))
30
- self.assertEqual(_infer_plugin_info("tool_ribbons"), ("admin/tool", "ribbons"))
31
30
  self.assertEqual(_infer_plugin_info("block_recommendation"), ("blocks", "recommendation"))
32
31
  self.assertEqual(_infer_plugin_info("mod_imagemap"), ("mod", "imagemap"))
33
32
  self.assertEqual(_infer_plugin_info("local_tinytoolbar"), ("local", "tinytoolbar"))
@@ -0,0 +1,74 @@
1
+ """
2
+ Testes do cabeçalho: logo e nome do projeto lado a lado (issue #13).
3
+ """
4
+ import os
5
+ import tempfile
6
+ import unittest
7
+
8
+ from sphinx.application import Sphinx
9
+
10
+ import moodle_docs_theme
11
+
12
+ SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8"><rect width="8" height="8"/></svg>'
13
+
14
+
15
+ def build_header(extra_conf: str) -> str:
16
+ """Compila um projeto mínimo e devolve o trecho do cabeçalho do index.html."""
17
+ with tempfile.TemporaryDirectory() as tmp:
18
+ src = os.path.join(tmp, "src")
19
+ os.makedirs(src)
20
+ with open(os.path.join(src, "logo.svg"), "w", encoding="utf-8") as f:
21
+ f.write(SVG)
22
+ with open(os.path.join(src, "index.rst"), "w", encoding="utf-8") as f:
23
+ f.write("Teste\n=====\n")
24
+ with open(os.path.join(src, "conf.py"), "w", encoding="utf-8") as f:
25
+ f.write(
26
+ 'project = "Projeto Teste"\n'
27
+ 'extensions = ["sphinx.ext.githubpages", "moodle_docs_theme"]\n'
28
+ 'html_theme = "moodle_docs_theme"\n'
29
+ f"html_theme_path = [{moodle_docs_theme.get_html_theme_path()!r}]\n"
30
+ + extra_conf
31
+ )
32
+ out = os.path.join(tmp, "out")
33
+ app = Sphinx(src, src, out, os.path.join(tmp, "doctrees"), "html",
34
+ status=None, warning=None, freshenv=True)
35
+ app.build()
36
+ with open(os.path.join(out, "index.html"), encoding="utf-8") as f:
37
+ html = f.read()
38
+ start = html.index('class="moodle-brand"')
39
+ return html[start:html.index("</a>", start)]
40
+
41
+
42
+ class TestHeaderLogo(unittest.TestCase):
43
+
44
+ def test_logo_and_title_side_by_side(self):
45
+ header = build_header('html_logo = "logo.svg"\n')
46
+ self.assertIn('class="moodle-brand-logo"', header)
47
+ self.assertIn('class="moodle-brand-title"', header)
48
+ self.assertIn("Projeto Teste", header)
49
+
50
+ def test_title_without_logo(self):
51
+ header = build_header("")
52
+ self.assertNotIn('class="moodle-brand-logo"', header)
53
+ self.assertIn('class="moodle-brand-title"', header)
54
+
55
+ def test_logo_only_hides_visible_title(self):
56
+ header = build_header('html_logo = "logo.svg"\nhtml_theme_options = {"logo_only": True}\n')
57
+ self.assertIn('class="moodle-brand-logo"', header)
58
+ self.assertNotIn('class="moodle-brand-title"', header)
59
+ self.assertIn('class="visually-hidden"', header)
60
+
61
+
62
+ class TestHeaderCss(unittest.TestCase):
63
+
64
+ def test_brand_group_is_vertically_centered(self):
65
+ css_path = os.path.join(moodle_docs_theme.get_html_theme_path(), "static", "css", "base.css")
66
+ with open(css_path, encoding="utf-8") as f:
67
+ css = f.read()
68
+ block = css[css.index(".moodle-brand-group {"):]
69
+ block = block[:block.index("}")]
70
+ self.assertIn("align-items: center", block)
71
+
72
+
73
+ if __name__ == "__main__":
74
+ unittest.main()