moodle-docs-theme 0.2.1__tar.gz → 0.3.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.
- {moodle_docs_theme-0.2.1/moodle_docs_theme.egg-info → moodle_docs_theme-0.3.0}/PKG-INFO +2 -1
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/README.md +1 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/__init__.py +1 -1
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/cli.py +137 -33
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/layout.html +41 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/static/css/base.css +50 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/static/js/theme.js +21 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/__pycache__/__init__.cpython-312.pyc +0 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/en/conf.py.tpl +42 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/en/configuration.rst.tpl +12 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/en/index.rst.tpl +23 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/en/installation.rst.tpl +29 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/en/usage.rst.tpl +14 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/index.html +38 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/pt-br/conf.py.tpl +42 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/pt-br/configuration.rst.tpl +12 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/pt-br/index.rst.tpl +23 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/pt-br/installation.rst.tpl +29 -0
- moodle_docs_theme-0.3.0/moodle_docs_theme/template/docs/pt-br/usage.rst.tpl +14 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/workflows/docs.yml +9 -1
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/theme.conf +1 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/theme.toml +1 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0/moodle_docs_theme.egg-info}/PKG-INFO +2 -1
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/SOURCES.txt +11 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/pyproject.toml +1 -1
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/setup.py +3 -2
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/tests/test_cli.py +51 -17
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/LICENSE +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/MANIFEST.in +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/__main__.py +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/breadcrumbs.html +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/page.html +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/searchbox.html +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/static/css/colors.css +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/__init__.py +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/conf.py.tpl +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/configuration.md.tpl +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/index.md.tpl +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/installation.md.tpl +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/requirements.txt +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/usage.md.tpl +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/dependency_links.txt +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/entry_points.txt +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/requires.txt +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/top_level.txt +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/setup.cfg +0 -0
- {moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.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.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -56,6 +56,7 @@ da sua organização.
|
|
|
56
56
|
- **Design inspirado no MoodleDocs**: cabeçalho claro com faixa de destaque laranja
|
|
57
57
|
(`#f98012`), títulos em roxo (`#6c336d`), links em azul (`#3366cc`) — a mesma
|
|
58
58
|
linguagem visual do docs.moodle.org.
|
|
59
|
+
- **Internacionalização bilíngue**: suporte nativo aos idiomas Inglês (`en`, default) e Português do Brasil (`pt-br`), com seletor de bandeiras (EUA e Brasil) no cabeçalho e roteador inteligente `index.html` na raiz.
|
|
59
60
|
- **Modo escuro**: alternância de tema claro/escuro com detecção de preferência do
|
|
60
61
|
sistema e persistência em `localStorage`.
|
|
61
62
|
- **Customização simples**: cores, logotipo, fontes e links de navegação configuráveis
|
|
@@ -20,6 +20,7 @@ da sua organização.
|
|
|
20
20
|
- **Design inspirado no MoodleDocs**: cabeçalho claro com faixa de destaque laranja
|
|
21
21
|
(`#f98012`), títulos em roxo (`#6c336d`), links em azul (`#3366cc`) — a mesma
|
|
22
22
|
linguagem visual do docs.moodle.org.
|
|
23
|
+
- **Internacionalização bilíngue**: suporte nativo aos idiomas Inglês (`en`, default) e Português do Brasil (`pt-br`), com seletor de bandeiras (EUA e Brasil) no cabeçalho e roteador inteligente `index.html` na raiz.
|
|
23
24
|
- **Modo escuro**: alternância de tema claro/escuro com detecção de preferência do
|
|
24
25
|
sistema e persistência em `localStorage`.
|
|
25
26
|
- **Customização simples**: cores, logotipo, fontes e links de navegação configuráveis
|
|
@@ -66,12 +66,18 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
66
66
|
plugin_path = args.plugin_path or inferred_path
|
|
67
67
|
plugin_dir_name = args.plugin_dir_name or inferred_dir
|
|
68
68
|
|
|
69
|
+
tagline_en = getattr(args, "tagline_en", None) or f"Official documentation for {project_name}"
|
|
70
|
+
tagline_pt = getattr(args, "tagline_pt", None) or tagline or f"Documentação oficial de {project_name}"
|
|
71
|
+
|
|
69
72
|
context: dict[str, str] = {
|
|
70
73
|
"project_name": project_name,
|
|
74
|
+
"project_underline": "=" * max(len(project_name), 10),
|
|
71
75
|
"repo_name": repo_name,
|
|
72
76
|
"github_url": github_url,
|
|
73
77
|
"github_repo": repo_name,
|
|
74
78
|
"tagline": tagline,
|
|
79
|
+
"tagline_en": tagline_en,
|
|
80
|
+
"tagline_pt": tagline_pt,
|
|
75
81
|
"version": version,
|
|
76
82
|
"year": year,
|
|
77
83
|
"plugin_path": plugin_path,
|
|
@@ -84,39 +90,89 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
84
90
|
|
|
85
91
|
target_docs_dir.mkdir(parents=True, exist_ok=True)
|
|
86
92
|
|
|
87
|
-
files_to_render = [
|
|
88
|
-
("conf.py.tpl", "conf.py"),
|
|
89
|
-
("index.md.tpl", "index.md"),
|
|
90
|
-
("installation.md.tpl", "installation.md"),
|
|
91
|
-
("configuration.md.tpl", "configuration.md"),
|
|
92
|
-
("usage.md.tpl", "usage.md"),
|
|
93
|
-
]
|
|
94
|
-
|
|
95
|
-
print(f"-> Inicializando template de documentação em: {target_path}")
|
|
96
|
-
|
|
97
93
|
created_files: list[str] = []
|
|
98
|
-
|
|
99
|
-
src_file = template_docs_dir / src_name
|
|
100
|
-
dst_file = target_docs_dir / dst_name
|
|
101
|
-
|
|
102
|
-
if dst_file.exists() and not args.force:
|
|
103
|
-
print(f" [IGNORADO] Arquivo já existe: {dst_file.relative_to(target_path)} (use --force para sobrescrever)")
|
|
104
|
-
continue
|
|
94
|
+
print(f"-> Inicializando template de documentação em: {target_path}")
|
|
105
95
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
single_lang = getattr(args, "single_lang", False)
|
|
97
|
+
|
|
98
|
+
if single_lang:
|
|
99
|
+
# Modo legado (monolíngue) na raiz de docs/
|
|
100
|
+
files_to_render = [
|
|
101
|
+
("conf.py.tpl", "conf.py"),
|
|
102
|
+
("index.md.tpl", "index.md"),
|
|
103
|
+
("installation.md.tpl", "installation.md"),
|
|
104
|
+
("configuration.md.tpl", "configuration.md"),
|
|
105
|
+
("usage.md.tpl", "usage.md"),
|
|
106
|
+
]
|
|
107
|
+
for src_name, dst_name in files_to_render:
|
|
108
|
+
src_file = template_docs_dir / src_name
|
|
109
|
+
dst_file = target_docs_dir / dst_name
|
|
110
|
+
|
|
111
|
+
if dst_file.exists() and not args.force:
|
|
112
|
+
print(f" [IGNORADO] Arquivo já existe: {dst_file.relative_to(target_path)} (use --force para sobrescrever)")
|
|
113
|
+
continue
|
|
114
|
+
|
|
115
|
+
rendered = _render_template(src_file, context)
|
|
116
|
+
dst_file.write_text(rendered, encoding="utf-8")
|
|
117
|
+
created_files.append(str(dst_file.relative_to(target_path)))
|
|
118
|
+
print(f" [CRIADO] {dst_file.relative_to(target_path)}")
|
|
119
|
+
else:
|
|
120
|
+
# Modo bilíngue padrão: docs/en e docs/pt-br com index.html na raiz
|
|
121
|
+
idx_src = template_docs_dir / "index.html"
|
|
122
|
+
idx_dst = target_docs_dir / "index.html"
|
|
123
|
+
if idx_src.exists():
|
|
124
|
+
if not idx_dst.exists() or args.force:
|
|
125
|
+
shutil.copy2(idx_src, idx_dst)
|
|
126
|
+
created_files.append(str(idx_dst.relative_to(target_path)))
|
|
127
|
+
print(f" [CRIADO] {idx_dst.relative_to(target_path)}")
|
|
128
|
+
else:
|
|
129
|
+
print(f" [IGNORADO] Arquivo já existe: {idx_dst.relative_to(target_path)}")
|
|
130
|
+
|
|
131
|
+
bilingual_specs = [
|
|
132
|
+
("en", [
|
|
133
|
+
("conf.py.tpl", "conf.py"),
|
|
134
|
+
("index.rst.tpl", "index.rst"),
|
|
135
|
+
("installation.rst.tpl", "installation.rst"),
|
|
136
|
+
("configuration.rst.tpl", "configuration.rst"),
|
|
137
|
+
("usage.rst.tpl", "usage.rst"),
|
|
138
|
+
]),
|
|
139
|
+
("pt-br", [
|
|
140
|
+
("conf.py.tpl", "conf.py"),
|
|
141
|
+
("index.rst.tpl", "index.rst"),
|
|
142
|
+
("installation.rst.tpl", "installation.rst"),
|
|
143
|
+
("configuration.rst.tpl", "configuration.rst"),
|
|
144
|
+
("usage.rst.tpl", "usage.rst"),
|
|
145
|
+
]),
|
|
146
|
+
]
|
|
147
|
+
|
|
148
|
+
for lang_folder, files in bilingual_specs:
|
|
149
|
+
lang_dir = target_docs_dir / lang_folder
|
|
150
|
+
lang_dir.mkdir(parents=True, exist_ok=True)
|
|
151
|
+
tpl_lang_dir = template_docs_dir / lang_folder
|
|
152
|
+
|
|
153
|
+
for src_name, dst_name in files:
|
|
154
|
+
src_file = tpl_lang_dir / src_name
|
|
155
|
+
dst_file = lang_dir / dst_name
|
|
156
|
+
|
|
157
|
+
if dst_file.exists() and not args.force:
|
|
158
|
+
print(f" [IGNORADO] Arquivo já existe: {dst_file.relative_to(target_path)} (use --force para sobrescrever)")
|
|
159
|
+
continue
|
|
160
|
+
|
|
161
|
+
rendered = _render_template(src_file, context)
|
|
162
|
+
dst_file.write_text(rendered, encoding="utf-8")
|
|
163
|
+
created_files.append(str(dst_file.relative_to(target_path)))
|
|
164
|
+
print(f" [CRIADO] {dst_file.relative_to(target_path)}")
|
|
110
165
|
|
|
111
166
|
# requirements.txt
|
|
112
167
|
req_src = template_docs_dir / "requirements.txt"
|
|
113
168
|
req_dst = target_docs_dir / "requirements.txt"
|
|
114
|
-
if
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
169
|
+
if req_src.exists():
|
|
170
|
+
if not req_dst.exists() or args.force:
|
|
171
|
+
shutil.copy2(req_src, req_dst)
|
|
172
|
+
created_files.append(str(req_dst.relative_to(target_path)))
|
|
173
|
+
print(f" [CRIADO] {req_dst.relative_to(target_path)}")
|
|
174
|
+
else:
|
|
175
|
+
print(f" [IGNORADO] Arquivo já existe: {req_dst.relative_to(target_path)}")
|
|
120
176
|
|
|
121
177
|
# Workflow do GitHub Actions
|
|
122
178
|
if not args.no_workflow:
|
|
@@ -139,7 +195,7 @@ def cmd_init(args: argparse.Namespace) -> int:
|
|
|
139
195
|
|
|
140
196
|
def cmd_build(args: argparse.Namespace) -> int:
|
|
141
197
|
"""
|
|
142
|
-
Compila a documentação usando Sphinx e moodle-docs-theme.
|
|
198
|
+
Compila a documentação usando Sphinx e moodle-docs-theme (suporta bilíngue en e pt-br).
|
|
143
199
|
"""
|
|
144
200
|
docs_dir = Path(args.docs_dir).resolve()
|
|
145
201
|
output_dir = Path(args.output_dir).resolve()
|
|
@@ -148,17 +204,52 @@ def cmd_build(args: argparse.Namespace) -> int:
|
|
|
148
204
|
print(f"Erro: Diretório de documentação não encontrado: '{docs_dir}'", file=sys.stderr)
|
|
149
205
|
return 1
|
|
150
206
|
|
|
151
|
-
conf_file = docs_dir / "conf.py"
|
|
152
|
-
if not conf_file.exists():
|
|
153
|
-
print(f"Erro: Arquivo 'conf.py' não encontrado em: '{docs_dir}'", file=sys.stderr)
|
|
154
|
-
return 1
|
|
155
|
-
|
|
156
207
|
if args.clean and output_dir.exists():
|
|
157
208
|
print(f"-> Limpando diretório de saída: '{output_dir}'")
|
|
158
209
|
shutil.rmtree(output_dir)
|
|
159
210
|
|
|
160
211
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
161
212
|
|
|
213
|
+
en_dir = docs_dir / "en"
|
|
214
|
+
pt_dir = docs_dir / "pt-br"
|
|
215
|
+
|
|
216
|
+
if en_dir.exists() and (en_dir / "conf.py").exists() and pt_dir.exists() and (pt_dir / "conf.py").exists():
|
|
217
|
+
print(f"-> Detectada documentação bilíngue em '{docs_dir}' (en e pt-br)")
|
|
218
|
+
# Compila EN
|
|
219
|
+
en_out = output_dir / "en"
|
|
220
|
+
en_out.mkdir(parents=True, exist_ok=True)
|
|
221
|
+
cmd_en = [sys.executable, "-m", "sphinx", "-b", args.builder]
|
|
222
|
+
if args.warnings_as_errors:
|
|
223
|
+
cmd_en.append("-W")
|
|
224
|
+
cmd_en.extend([str(en_dir), str(en_out)])
|
|
225
|
+
res_en = subprocess.run(cmd_en, check=False)
|
|
226
|
+
if res_en.returncode != 0:
|
|
227
|
+
return res_en.returncode
|
|
228
|
+
|
|
229
|
+
# Compila PT-BR
|
|
230
|
+
pt_out = output_dir / "pt-br"
|
|
231
|
+
pt_out.mkdir(parents=True, exist_ok=True)
|
|
232
|
+
cmd_pt = [sys.executable, "-m", "sphinx", "-b", args.builder]
|
|
233
|
+
if args.warnings_as_errors:
|
|
234
|
+
cmd_pt.append("-W")
|
|
235
|
+
cmd_pt.extend([str(pt_dir), str(pt_out)])
|
|
236
|
+
res_pt = subprocess.run(cmd_pt, check=False)
|
|
237
|
+
if res_pt.returncode != 0:
|
|
238
|
+
return res_pt.returncode
|
|
239
|
+
|
|
240
|
+
# Copia roteador index.html se existir
|
|
241
|
+
index_html = docs_dir / "index.html"
|
|
242
|
+
if index_html.exists():
|
|
243
|
+
shutil.copy2(index_html, output_dir / "index.html")
|
|
244
|
+
|
|
245
|
+
print(f"\nDocumentação bilíngue gerada com sucesso em: {output_dir}")
|
|
246
|
+
return 0
|
|
247
|
+
|
|
248
|
+
conf_file = docs_dir / "conf.py"
|
|
249
|
+
if not conf_file.exists():
|
|
250
|
+
print(f"Erro: Arquivo 'conf.py' não encontrado em: '{docs_dir}'", file=sys.stderr)
|
|
251
|
+
return 1
|
|
252
|
+
|
|
162
253
|
sphinx_cmd = [
|
|
163
254
|
sys.executable,
|
|
164
255
|
"-m",
|
|
@@ -244,6 +335,19 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
244
335
|
action="store_true",
|
|
245
336
|
help="Sobrescreve arquivos existentes caso já estejam presentes.",
|
|
246
337
|
)
|
|
338
|
+
init_parser.add_argument(
|
|
339
|
+
"--single-lang",
|
|
340
|
+
action="store_true",
|
|
341
|
+
help="Gera template em idioma único na raiz de docs/ (modo legado). Por padrão, gera estrutura bilíngue (en e pt-br).",
|
|
342
|
+
)
|
|
343
|
+
init_parser.add_argument(
|
|
344
|
+
"--tagline-en",
|
|
345
|
+
help="Tagline em inglês para a documentação.",
|
|
346
|
+
)
|
|
347
|
+
init_parser.add_argument(
|
|
348
|
+
"--tagline-pt",
|
|
349
|
+
help="Tagline em português para a documentação.",
|
|
350
|
+
)
|
|
247
351
|
init_parser.add_argument(
|
|
248
352
|
"--no-workflow",
|
|
249
353
|
action="store_true",
|
|
@@ -77,6 +77,47 @@
|
|
|
77
77
|
|
|
78
78
|
{# Right-side tools: Header Search & Dark Mode Toggle #}
|
|
79
79
|
<div class="moodle-header-tools">
|
|
80
|
+
{# Seletor de Idioma Bilíngue (Bandeiras EUA e Brasil) #}
|
|
81
|
+
{% if theme_enable_language_selector is not defined or theme_enable_language_selector|tobool %}
|
|
82
|
+
<div class="moodle-lang-selector" aria-label="Seletor de idioma / Language selector">
|
|
83
|
+
{% set current_l = language if language else 'en' %}
|
|
84
|
+
{% set is_en = current_l.lower().startswith('en') %}
|
|
85
|
+
{% set page_slug = pagename.split('/')[-1] %}
|
|
86
|
+
<a href="{% if is_en %}#{% else %}../en/{{ page_slug }}.html{% endif %}"
|
|
87
|
+
class="moodle-lang-btn {% if is_en %}active{% endif %}"
|
|
88
|
+
data-lang="en"
|
|
89
|
+
title="English"
|
|
90
|
+
aria-label="English">
|
|
91
|
+
<svg class="moodle-flag-icon" viewBox="0 0 24 16" width="22" height="15" aria-hidden="true">
|
|
92
|
+
<rect width="24" height="16" fill="#b22234" rx="2" />
|
|
93
|
+
<path d="M0 2.46h24M0 4.92h24M0 7.38h24M0 9.84h24M0 12.3h24M0 14.76h24" stroke="#fff" stroke-width="1.23" />
|
|
94
|
+
<rect width="10" height="8.62" fill="#3c3b6e" rx="1" />
|
|
95
|
+
<circle cx="2.5" cy="2.15" r="0.6" fill="#fff" />
|
|
96
|
+
<circle cx="5.0" cy="2.15" r="0.6" fill="#fff" />
|
|
97
|
+
<circle cx="7.5" cy="2.15" r="0.6" fill="#fff" />
|
|
98
|
+
<circle cx="3.75" cy="4.31" r="0.6" fill="#fff" />
|
|
99
|
+
<circle cx="6.25" cy="4.31" r="0.6" fill="#fff" />
|
|
100
|
+
<circle cx="2.5" cy="6.46" r="0.6" fill="#fff" />
|
|
101
|
+
<circle cx="5.0" cy="6.46" r="0.6" fill="#fff" />
|
|
102
|
+
<circle cx="7.5" cy="6.46" r="0.6" fill="#fff" />
|
|
103
|
+
</svg>
|
|
104
|
+
</a>
|
|
105
|
+
<span class="moodle-lang-divider">|</span>
|
|
106
|
+
<a href="{% if not is_en %}#{% else %}../pt-br/{{ page_slug }}.html{% endif %}"
|
|
107
|
+
class="moodle-lang-btn {% if not is_en %}active{% endif %}"
|
|
108
|
+
data-lang="pt-br"
|
|
109
|
+
title="Português (Brasil)"
|
|
110
|
+
aria-label="Português (Brasil)">
|
|
111
|
+
<svg class="moodle-flag-icon" viewBox="0 0 24 16" width="22" height="15" aria-hidden="true">
|
|
112
|
+
<rect width="24" height="16" fill="#009b3a" rx="2" />
|
|
113
|
+
<path d="M12 2.2L21.5 8 12 13.8 2.5 8z" fill="#fedf00" />
|
|
114
|
+
<circle cx="12" cy="8" r="3.4" fill="#002776" />
|
|
115
|
+
<path d="M8.8 8.4a3.4 3.4 0 0 1 6.2-.8" stroke="#fff" stroke-width="0.7" fill="none" />
|
|
116
|
+
</svg>
|
|
117
|
+
</a>
|
|
118
|
+
</div>
|
|
119
|
+
{% endif %}
|
|
120
|
+
|
|
80
121
|
<form action="{{ pathto('search') }}" method="get" class="moodle-header-search">
|
|
81
122
|
<input type="text" name="q" placeholder="Buscar..." aria-label="Buscar na documentação" required />
|
|
82
123
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
@@ -149,6 +149,56 @@ img {
|
|
|
149
149
|
font-size: 0.85rem;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/* Language Selector (Bandeiras Bilíngues) */
|
|
153
|
+
.moodle-lang-selector {
|
|
154
|
+
display: inline-flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: 0.35rem;
|
|
157
|
+
background-color: var(--moodle-search-btn-bg);
|
|
158
|
+
padding: 0.2rem 0.45rem;
|
|
159
|
+
border-radius: 6px;
|
|
160
|
+
border: 1px solid var(--moodle-border);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.moodle-lang-btn {
|
|
164
|
+
text-decoration: none;
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
padding: 0.15rem 0.25rem;
|
|
169
|
+
border-radius: 4px;
|
|
170
|
+
transition: all 0.2s ease;
|
|
171
|
+
line-height: 1;
|
|
172
|
+
opacity: 0.55;
|
|
173
|
+
border: 1px solid transparent;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.moodle-lang-btn:hover {
|
|
177
|
+
opacity: 1;
|
|
178
|
+
transform: scale(1.08);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.moodle-lang-btn.active {
|
|
182
|
+
opacity: 1;
|
|
183
|
+
background: var(--moodle-accent-soft);
|
|
184
|
+
border-color: var(--moodle-primary);
|
|
185
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.moodle-flag-icon {
|
|
189
|
+
display: block;
|
|
190
|
+
width: 22px;
|
|
191
|
+
height: 15px;
|
|
192
|
+
border-radius: 2px;
|
|
193
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.moodle-lang-divider {
|
|
197
|
+
color: var(--moodle-border);
|
|
198
|
+
font-size: 0.75rem;
|
|
199
|
+
user-select: none;
|
|
200
|
+
}
|
|
201
|
+
|
|
152
202
|
/* Theme Toggle Button */
|
|
153
203
|
.theme-toggle-btn {
|
|
154
204
|
background: var(--moodle-search-btn-bg);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
document.addEventListener('DOMContentLoaded', () => {
|
|
20
20
|
initDarkMode();
|
|
21
|
+
initLanguageSelector();
|
|
21
22
|
initMobileMenu();
|
|
22
23
|
initCopyCodeButtons();
|
|
23
24
|
initExternalLinks();
|
|
@@ -129,3 +130,23 @@ function initExternalLinks() {
|
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
132
|
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Initialize Language Selector behavior (persist preference)
|
|
136
|
+
*/
|
|
137
|
+
function initLanguageSelector() {
|
|
138
|
+
const langBtns = document.querySelectorAll('.moodle-lang-btn');
|
|
139
|
+
langBtns.forEach((btn) => {
|
|
140
|
+
btn.addEventListener('click', (e) => {
|
|
141
|
+
const targetLang = btn.getAttribute('data-lang');
|
|
142
|
+
if (targetLang) {
|
|
143
|
+
try {
|
|
144
|
+
localStorage.setItem('user_lang', targetLang);
|
|
145
|
+
} catch (err) {}
|
|
146
|
+
}
|
|
147
|
+
if (btn.classList.contains('active') || btn.getAttribute('href') === '#') {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sphinx configuration for {{ project_name }} (English).
|
|
3
|
+
Documentation generated with moodle-docs-theme.
|
|
4
|
+
"""
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import moodle_docs_theme
|
|
8
|
+
|
|
9
|
+
project = "{{ project_name }}"
|
|
10
|
+
copyright = "{{ year }}, KelsonCM contributions to Moodle community"
|
|
11
|
+
author = "KelsonCM"
|
|
12
|
+
release = "{{ version }}"
|
|
13
|
+
|
|
14
|
+
extensions = [
|
|
15
|
+
"sphinx.ext.githubpages",
|
|
16
|
+
"moodle_docs_theme",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
templates_path = []
|
|
20
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
21
|
+
|
|
22
|
+
language = "en"
|
|
23
|
+
|
|
24
|
+
html_theme = "moodle_docs_theme"
|
|
25
|
+
html_theme_path = [moodle_docs_theme.get_html_theme_path()]
|
|
26
|
+
|
|
27
|
+
html_theme_options = {
|
|
28
|
+
"primary_color": "#6c336d",
|
|
29
|
+
"secondary_color": "#f98012",
|
|
30
|
+
"project_name": "{{ project_name }}",
|
|
31
|
+
"tagline": "{{ tagline_en }}",
|
|
32
|
+
"github_url": "{{ github_url }}",
|
|
33
|
+
"github_repo": "{{ github_repo }}",
|
|
34
|
+
"github_version": "main",
|
|
35
|
+
"doc_path": "docs/en/",
|
|
36
|
+
"show_edit_on_github": True,
|
|
37
|
+
"enable_dark_mode": True,
|
|
38
|
+
"enable_language_selector": True,
|
|
39
|
+
"navigation_links": "Home|index, Installation|installation, Configuration|configuration, Usage|usage",
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
html_static_path = []
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Configuration
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
General Settings
|
|
5
|
+
----------------
|
|
6
|
+
|
|
7
|
+
Access the administration panel:
|
|
8
|
+
|
|
9
|
+
1. Go to **Site Administration** > **Plugins**.
|
|
10
|
+
2. Locate **{{ project_name }}**.
|
|
11
|
+
3. Adjust settings according to your institution needs.
|
|
12
|
+
4. Click **Save changes**.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{ project_name }}
|
|
2
|
+
{{ project_underline }}
|
|
3
|
+
|
|
4
|
+
{{ tagline_en }}
|
|
5
|
+
|
|
6
|
+
Overview
|
|
7
|
+
========
|
|
8
|
+
|
|
9
|
+
**{{ project_name }}** is an open-source Moodle plugin developed for the community.
|
|
10
|
+
|
|
11
|
+
Repository
|
|
12
|
+
----------
|
|
13
|
+
- GitHub: `{{ github_repo }} <{{ github_url }}>`_
|
|
14
|
+
|
|
15
|
+
Contents
|
|
16
|
+
========
|
|
17
|
+
|
|
18
|
+
.. toctree::
|
|
19
|
+
:maxdepth: 2
|
|
20
|
+
|
|
21
|
+
installation
|
|
22
|
+
configuration
|
|
23
|
+
usage
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Installation
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Requirements
|
|
5
|
+
------------
|
|
6
|
+
|
|
7
|
+
- Moodle 4.1, 4.2, 4.3, 4.4 or higher
|
|
8
|
+
- PHP 8.1 or higher
|
|
9
|
+
|
|
10
|
+
Installation via Git
|
|
11
|
+
--------------------
|
|
12
|
+
|
|
13
|
+
Clone this repository into your Moodle installation under ``{{ plugin_path }}/{{ plugin_dir_name }}``:
|
|
14
|
+
|
|
15
|
+
.. code-block:: bash
|
|
16
|
+
|
|
17
|
+
cd /path/to/moodle/{{ plugin_path }}
|
|
18
|
+
git clone {{ github_url }}.git {{ plugin_dir_name }}
|
|
19
|
+
|
|
20
|
+
Completing Installation
|
|
21
|
+
-----------------------
|
|
22
|
+
|
|
23
|
+
1. Access the Moodle admin interface as administrator.
|
|
24
|
+
2. Follow the on-screen instructions to complete the plugin database upgrade.
|
|
25
|
+
3. Or run the CLI upgrade script:
|
|
26
|
+
|
|
27
|
+
.. code-block:: bash
|
|
28
|
+
|
|
29
|
+
php admin/cli/upgrade.php
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Usage
|
|
2
|
+
=====
|
|
3
|
+
|
|
4
|
+
Getting Started
|
|
5
|
+
---------------
|
|
6
|
+
|
|
7
|
+
Once installed and configured, **{{ project_name }}** is ready for use within your courses and activities.
|
|
8
|
+
|
|
9
|
+
Support & Issues
|
|
10
|
+
----------------
|
|
11
|
+
|
|
12
|
+
Found a bug or need assistance? Open an issue on GitHub:
|
|
13
|
+
|
|
14
|
+
- `{{ github_repo }} Issues <{{ github_url }}/issues>`_
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Documentation — Redirecting</title>
|
|
7
|
+
<script>
|
|
8
|
+
(function() {
|
|
9
|
+
// 1. Verificar preferência salva previamente pelo usuário
|
|
10
|
+
var savedLang = null;
|
|
11
|
+
try {
|
|
12
|
+
savedLang = localStorage.getItem('user_lang');
|
|
13
|
+
} catch (e) {}
|
|
14
|
+
|
|
15
|
+
if (savedLang === 'pt-br' || savedLang === 'pt_BR' || savedLang === 'pt') {
|
|
16
|
+
window.location.replace('./pt-br/');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (savedLang === 'en') {
|
|
20
|
+
window.location.replace('./en/');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 2. Detecção automática baseada no navegador
|
|
25
|
+
var navLang = (navigator.language || navigator.userLanguage || '').toLowerCase();
|
|
26
|
+
if (navLang.startsWith('pt')) {
|
|
27
|
+
window.location.replace('./pt-br/');
|
|
28
|
+
} else {
|
|
29
|
+
// Fallback default: English
|
|
30
|
+
window.location.replace('./en/');
|
|
31
|
+
}
|
|
32
|
+
})();
|
|
33
|
+
</script>
|
|
34
|
+
</head>
|
|
35
|
+
<body>
|
|
36
|
+
<p>Redirecting to documentation... <a href="./en/">Click here if not redirected</a>.</p>
|
|
37
|
+
</body>
|
|
38
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Sphinx configuration for {{ project_name }} (Português do Brasil).
|
|
3
|
+
Documentação gerada com o template moodle-docs-theme.
|
|
4
|
+
"""
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import moodle_docs_theme
|
|
8
|
+
|
|
9
|
+
project = "{{ project_name }}"
|
|
10
|
+
copyright = "{{ year }}, Contribuições de KelsonCM à comunidade Moodle"
|
|
11
|
+
author = "KelsonCM"
|
|
12
|
+
release = "{{ version }}"
|
|
13
|
+
|
|
14
|
+
extensions = [
|
|
15
|
+
"sphinx.ext.githubpages",
|
|
16
|
+
"moodle_docs_theme",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
templates_path = []
|
|
20
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
21
|
+
|
|
22
|
+
language = "pt_BR"
|
|
23
|
+
|
|
24
|
+
html_theme = "moodle_docs_theme"
|
|
25
|
+
html_theme_path = [moodle_docs_theme.get_html_theme_path()]
|
|
26
|
+
|
|
27
|
+
html_theme_options = {
|
|
28
|
+
"primary_color": "#6c336d",
|
|
29
|
+
"secondary_color": "#f98012",
|
|
30
|
+
"project_name": "{{ project_name }}",
|
|
31
|
+
"tagline": "{{ tagline_pt }}",
|
|
32
|
+
"github_url": "{{ github_url }}",
|
|
33
|
+
"github_repo": "{{ github_repo }}",
|
|
34
|
+
"github_version": "main",
|
|
35
|
+
"doc_path": "docs/pt-br/",
|
|
36
|
+
"show_edit_on_github": True,
|
|
37
|
+
"enable_dark_mode": True,
|
|
38
|
+
"enable_language_selector": True,
|
|
39
|
+
"navigation_links": "Início|index, Instalação|installation, Configuração|configuration, Uso|usage",
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
html_static_path = []
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Configuração
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Configurações Gerais
|
|
5
|
+
--------------------
|
|
6
|
+
|
|
7
|
+
Acesse o painel de administração:
|
|
8
|
+
|
|
9
|
+
1. Vá em **Administração do Site** > **Plugins**.
|
|
10
|
+
2. Localize **{{ project_name }}**.
|
|
11
|
+
3. Ajuste os parâmetros conforme a necessidade de sua instituição.
|
|
12
|
+
4. Clique em **Salvar mudanças**.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{ project_name }}
|
|
2
|
+
{{ project_underline }}
|
|
3
|
+
|
|
4
|
+
{{ tagline_pt }}
|
|
5
|
+
|
|
6
|
+
Visão Geral
|
|
7
|
+
===========
|
|
8
|
+
|
|
9
|
+
O **{{ project_name }}** é um projeto de código aberto desenvolvido para a comunidade Moodle.
|
|
10
|
+
|
|
11
|
+
Repositório
|
|
12
|
+
-----------
|
|
13
|
+
- GitHub: `{{ github_repo }} <{{ github_url }}>`_
|
|
14
|
+
|
|
15
|
+
Sumário
|
|
16
|
+
=======
|
|
17
|
+
|
|
18
|
+
.. toctree::
|
|
19
|
+
:maxdepth: 2
|
|
20
|
+
|
|
21
|
+
installation
|
|
22
|
+
configuration
|
|
23
|
+
usage
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Instalação
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
Requisitos
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
- Moodle 4.1, 4.2, 4.3, 4.4 ou superior
|
|
8
|
+
- PHP 8.1 ou superior
|
|
9
|
+
|
|
10
|
+
Instalação via Git
|
|
11
|
+
------------------
|
|
12
|
+
|
|
13
|
+
Clone o repositório na sua instalação Moodle dentro do diretório ``{{ plugin_path }}/{{ plugin_dir_name }}``:
|
|
14
|
+
|
|
15
|
+
.. code-block:: bash
|
|
16
|
+
|
|
17
|
+
cd /path/to/moodle/{{ plugin_path }}
|
|
18
|
+
git clone {{ github_url }}.git {{ plugin_dir_name }}
|
|
19
|
+
|
|
20
|
+
Concluindo a Instalação
|
|
21
|
+
-----------------------
|
|
22
|
+
|
|
23
|
+
1. Acesse o Moodle com uma conta de administrador.
|
|
24
|
+
2. Siga as instruções na tela para concluir a atualização do banco de dados do plugin.
|
|
25
|
+
3. Ou execute o comando via terminal CLI:
|
|
26
|
+
|
|
27
|
+
.. code-block:: bash
|
|
28
|
+
|
|
29
|
+
php admin/cli/upgrade.php
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Uso
|
|
2
|
+
===
|
|
3
|
+
|
|
4
|
+
Primeiros Passos
|
|
5
|
+
----------------
|
|
6
|
+
|
|
7
|
+
Após instalado e configurado, o **{{ project_name }}** já está pronto para utilização em seus cursos e atividades.
|
|
8
|
+
|
|
9
|
+
Suporte e Problemas
|
|
10
|
+
-------------------
|
|
11
|
+
|
|
12
|
+
Encontrou algum problema ou precisa de suporte? Abra uma issue no GitHub:
|
|
13
|
+
|
|
14
|
+
- `{{ github_repo }} Issues <{{ github_url }}/issues>`_
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/workflows/docs.yml
RENAMED
|
@@ -37,7 +37,15 @@ jobs:
|
|
|
37
37
|
|
|
38
38
|
- name: Build Documentation with Sphinx
|
|
39
39
|
run: |
|
|
40
|
-
|
|
40
|
+
if [ -d "docs/en" ] && [ -d "docs/pt-br" ]; then
|
|
41
|
+
sphinx-build -W -b html docs/en docs/_build/html/en
|
|
42
|
+
sphinx-build -W -b html docs/pt-br docs/_build/html/pt-br
|
|
43
|
+
if [ -f "docs/index.html" ]; then
|
|
44
|
+
cp docs/index.html docs/_build/html/index.html
|
|
45
|
+
fi
|
|
46
|
+
else
|
|
47
|
+
sphinx-build -W -b html docs docs/_build/html
|
|
48
|
+
fi
|
|
41
49
|
|
|
42
50
|
- name: Upload Pages Artifact
|
|
43
51
|
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'pull_request'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: moodle-docs-theme
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -56,6 +56,7 @@ da sua organização.
|
|
|
56
56
|
- **Design inspirado no MoodleDocs**: cabeçalho claro com faixa de destaque laranja
|
|
57
57
|
(`#f98012`), títulos em roxo (`#6c336d`), links em azul (`#3366cc`) — a mesma
|
|
58
58
|
linguagem visual do docs.moodle.org.
|
|
59
|
+
- **Internacionalização bilíngue**: suporte nativo aos idiomas Inglês (`en`, default) e Português do Brasil (`pt-br`), com seletor de bandeiras (EUA e Brasil) no cabeçalho e roteador inteligente `index.html` na raiz.
|
|
59
60
|
- **Modo escuro**: alternância de tema claro/escuro com detecção de preferência do
|
|
60
61
|
sistema e persistência em `localStorage`.
|
|
61
62
|
- **Customização simples**: cores, logotipo, fontes e links de navegação configuráveis
|
|
@@ -25,10 +25,21 @@ moodle_docs_theme/template/__init__.py
|
|
|
25
25
|
moodle_docs_theme/template/__pycache__/__init__.cpython-312.pyc
|
|
26
26
|
moodle_docs_theme/template/docs/conf.py.tpl
|
|
27
27
|
moodle_docs_theme/template/docs/configuration.md.tpl
|
|
28
|
+
moodle_docs_theme/template/docs/index.html
|
|
28
29
|
moodle_docs_theme/template/docs/index.md.tpl
|
|
29
30
|
moodle_docs_theme/template/docs/installation.md.tpl
|
|
30
31
|
moodle_docs_theme/template/docs/requirements.txt
|
|
31
32
|
moodle_docs_theme/template/docs/usage.md.tpl
|
|
33
|
+
moodle_docs_theme/template/docs/en/conf.py.tpl
|
|
34
|
+
moodle_docs_theme/template/docs/en/configuration.rst.tpl
|
|
35
|
+
moodle_docs_theme/template/docs/en/index.rst.tpl
|
|
36
|
+
moodle_docs_theme/template/docs/en/installation.rst.tpl
|
|
37
|
+
moodle_docs_theme/template/docs/en/usage.rst.tpl
|
|
38
|
+
moodle_docs_theme/template/docs/pt-br/conf.py.tpl
|
|
39
|
+
moodle_docs_theme/template/docs/pt-br/configuration.rst.tpl
|
|
40
|
+
moodle_docs_theme/template/docs/pt-br/index.rst.tpl
|
|
41
|
+
moodle_docs_theme/template/docs/pt-br/installation.rst.tpl
|
|
42
|
+
moodle_docs_theme/template/docs/pt-br/usage.rst.tpl
|
|
32
43
|
moodle_docs_theme/template/workflows/docs.yml
|
|
33
44
|
tests/test_cli.py
|
|
34
45
|
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.
|
|
7
|
+
version = "0.3.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.
|
|
9
|
+
version="0.3.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)",
|
|
@@ -29,7 +29,8 @@ setup(
|
|
|
29
29
|
"moodle_docs_theme": [
|
|
30
30
|
"*.html", "theme.conf", "theme.toml",
|
|
31
31
|
"static/css/*.css", "static/js/*.js",
|
|
32
|
-
"template/docs/*", "template/
|
|
32
|
+
"template/docs/*", "template/docs/en/*", "template/docs/pt-br/*",
|
|
33
|
+
"template/workflows/*",
|
|
33
34
|
],
|
|
34
35
|
},
|
|
35
36
|
entry_points={
|
|
@@ -50,19 +50,47 @@ class TestMoodleDocsThemeCLI(unittest.TestCase):
|
|
|
50
50
|
self.assertEqual(exit_code, 0)
|
|
51
51
|
|
|
52
52
|
docs_dir = target_dir / "docs"
|
|
53
|
-
self.assertTrue((docs_dir / "
|
|
54
|
-
self.assertTrue((docs_dir / "index.md").exists())
|
|
55
|
-
self.assertTrue((docs_dir / "installation.md").exists())
|
|
56
|
-
self.assertTrue((docs_dir / "configuration.md").exists())
|
|
57
|
-
self.assertTrue((docs_dir / "usage.md").exists())
|
|
53
|
+
self.assertTrue((docs_dir / "index.html").exists())
|
|
58
54
|
self.assertTrue((docs_dir / "requirements.txt").exists())
|
|
59
55
|
self.assertTrue((target_dir / ".github" / "workflows" / "docs.yml").exists())
|
|
60
56
|
|
|
57
|
+
# Verifica pasta en
|
|
58
|
+
en_dir = docs_dir / "en"
|
|
59
|
+
self.assertTrue((en_dir / "conf.py").exists())
|
|
60
|
+
self.assertTrue((en_dir / "index.rst").exists())
|
|
61
|
+
self.assertTrue((en_dir / "installation.rst").exists())
|
|
62
|
+
self.assertTrue((en_dir / "configuration.rst").exists())
|
|
63
|
+
self.assertTrue((en_dir / "usage.rst").exists())
|
|
64
|
+
|
|
65
|
+
# Verifica pasta pt-br
|
|
66
|
+
pt_dir = docs_dir / "pt-br"
|
|
67
|
+
self.assertTrue((pt_dir / "conf.py").exists())
|
|
68
|
+
self.assertTrue((pt_dir / "index.rst").exists())
|
|
69
|
+
self.assertTrue((pt_dir / "installation.rst").exists())
|
|
70
|
+
self.assertTrue((pt_dir / "configuration.rst").exists())
|
|
71
|
+
self.assertTrue((pt_dir / "usage.rst").exists())
|
|
72
|
+
|
|
61
73
|
# Verifica conteúdo renderizado
|
|
62
|
-
|
|
63
|
-
self.assertIn('project = "tool_sample"',
|
|
64
|
-
self.assertIn('"github_repo": "moodle-by-kelsoncm/tool_sample"',
|
|
65
|
-
self.assertIn('"
|
|
74
|
+
conf_en = (en_dir / "conf.py").read_text(encoding="utf-8")
|
|
75
|
+
self.assertIn('project = "tool_sample"', conf_en)
|
|
76
|
+
self.assertIn('"github_repo": "moodle-by-kelsoncm/tool_sample"', conf_en)
|
|
77
|
+
self.assertIn('language = "en"', conf_en)
|
|
78
|
+
|
|
79
|
+
conf_pt = (pt_dir / "conf.py").read_text(encoding="utf-8")
|
|
80
|
+
self.assertIn('project = "tool_sample"', conf_pt)
|
|
81
|
+
self.assertIn('language = "pt_BR"', conf_pt)
|
|
82
|
+
|
|
83
|
+
def test_cli_init_single_lang(self):
|
|
84
|
+
target_dir = Path(self.test_dir) / "tool_single"
|
|
85
|
+
target_dir.mkdir()
|
|
86
|
+
|
|
87
|
+
exit_code = main(["init", str(target_dir), "--single-lang"])
|
|
88
|
+
self.assertEqual(exit_code, 0)
|
|
89
|
+
|
|
90
|
+
docs_dir = target_dir / "docs"
|
|
91
|
+
self.assertTrue((docs_dir / "conf.py").exists())
|
|
92
|
+
self.assertTrue((docs_dir / "index.md").exists())
|
|
93
|
+
self.assertTrue((docs_dir / "requirements.txt").exists())
|
|
66
94
|
|
|
67
95
|
def test_cli_init_custom_options(self):
|
|
68
96
|
target_dir = Path(self.test_dir) / "atto_custom"
|
|
@@ -74,16 +102,21 @@ class TestMoodleDocsThemeCLI(unittest.TestCase):
|
|
|
74
102
|
"--project-name", "moodle-atto_custom",
|
|
75
103
|
"--repo", "moodle-by-kelsoncm/atto_custom",
|
|
76
104
|
"--tagline", "Custom Atto plugin description",
|
|
105
|
+
"--tagline-en", "English description",
|
|
106
|
+
"--tagline-pt", "Descrição em português",
|
|
77
107
|
"--version-str", "2.1.0",
|
|
78
108
|
"--no-workflow",
|
|
79
109
|
])
|
|
80
110
|
self.assertEqual(exit_code, 0)
|
|
81
111
|
|
|
82
112
|
docs_dir = target_dir / "docs"
|
|
83
|
-
|
|
84
|
-
self.assertIn('project = "moodle-atto_custom"',
|
|
85
|
-
self.assertIn('release = "2.1.0"',
|
|
86
|
-
self.assertIn('
|
|
113
|
+
conf_en = (docs_dir / "en" / "conf.py").read_text(encoding="utf-8")
|
|
114
|
+
self.assertIn('project = "moodle-atto_custom"', conf_en)
|
|
115
|
+
self.assertIn('release = "2.1.0"', conf_en)
|
|
116
|
+
self.assertIn('English description', conf_en)
|
|
117
|
+
|
|
118
|
+
conf_pt = (docs_dir / "pt-br" / "conf.py").read_text(encoding="utf-8")
|
|
119
|
+
self.assertIn('Descrição em português', conf_pt)
|
|
87
120
|
|
|
88
121
|
# Sem workflow
|
|
89
122
|
self.assertFalse((target_dir / ".github" / "workflows" / "docs.yml").exists())
|
|
@@ -92,18 +125,19 @@ class TestMoodleDocsThemeCLI(unittest.TestCase):
|
|
|
92
125
|
target_dir = Path(self.test_dir) / "existing_repo"
|
|
93
126
|
target_dir.mkdir()
|
|
94
127
|
docs_dir = target_dir / "docs"
|
|
95
|
-
docs_dir
|
|
96
|
-
|
|
128
|
+
en_dir = docs_dir / "en"
|
|
129
|
+
en_dir.mkdir(parents=True)
|
|
130
|
+
(en_dir / "conf.py").write_text("existing content", encoding="utf-8")
|
|
97
131
|
|
|
98
132
|
exit_code = main(["init", str(target_dir)])
|
|
99
133
|
self.assertEqual(exit_code, 0)
|
|
100
134
|
|
|
101
|
-
self.assertEqual((
|
|
135
|
+
self.assertEqual((en_dir / "conf.py").read_text(encoding="utf-8"), "existing content")
|
|
102
136
|
|
|
103
137
|
# Com --force deve sobrescrever
|
|
104
138
|
exit_code = main(["init", str(target_dir), "--force"])
|
|
105
139
|
self.assertEqual(exit_code, 0)
|
|
106
|
-
self.assertIn("moodle_docs_theme", (
|
|
140
|
+
self.assertIn("moodle_docs_theme", (en_dir / "conf.py").read_text(encoding="utf-8"))
|
|
107
141
|
|
|
108
142
|
def test_cli_build_nonexistent_directory(self):
|
|
109
143
|
nonexistent = str(Path(self.test_dir) / "nao_existe")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/conf.py.tpl
RENAMED
|
File without changes
|
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/index.md.tpl
RENAMED
|
File without changes
|
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/requirements.txt
RENAMED
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme/template/docs/usage.md.tpl
RENAMED
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{moodle_docs_theme-0.2.1 → moodle_docs_theme-0.3.0}/moodle_docs_theme.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|