uEdition 0.9.0__py3-none-any.whl → 1.0.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.

Potentially problematic release.


This version of uEdition might be problematic. Click here for more details.

uedition/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## Dev
4
+
5
+ * **New**: Add a switch to turn off the TEI generation
6
+ * **Update**: Don't enable the language switcher when only one language is configured
7
+ * **Bugfix**: Fixed a bug in the TEI generation
8
+ * **Bugfix**: Fixed the builder output paths
9
+
3
10
  ## 0.9.0
4
11
 
5
12
  * **New**: Added TEI output
uedition/__about__.py CHANGED
@@ -2,4 +2,4 @@
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
4
  """About this package."""
5
- __version__ = "0.9.0"
5
+ __version__ = "1.0.0"
uedition/cli/build.py CHANGED
@@ -15,11 +15,11 @@ from uedition.settings import reload_settings, settings
15
15
 
16
16
  def landing_build() -> None:
17
17
  """Build the landing page."""
18
- if not path.exists(settings["output"]):
19
- makedirs(settings["output"], exist_ok=True)
20
- with open(path.join(settings["output"], "config.json"), "w") as out_f:
18
+ if not path.exists(settings["output"]["path"]):
19
+ makedirs(settings["output"]["path"], exist_ok=True)
20
+ with open(path.join(settings["output"]["path"], "config.json"), "w") as out_f:
21
21
  json.dump(settings, out_f)
22
- with open(path.join(settings["output"], "index.html"), "w") as out_f:
22
+ with open(path.join(settings["output"]["path"], "index.html"), "w") as out_f:
23
23
  out_f.write(
24
24
  """\
25
25
  <!DOCTYPE html>
@@ -151,37 +151,39 @@ def full_build(lang: dict) -> None:
151
151
  "build",
152
152
  "--all",
153
153
  "--path-output",
154
- path.join("_build", lang["code"]),
154
+ path.join("_build", lang["path"]),
155
155
  lang["path"],
156
156
  ],
157
157
  check=False,
158
158
  )
159
- subprocess.run(
160
- [ # noqa: S603, S607
161
- "jupyter-book",
162
- "build",
163
- "--all",
164
- "--path-output",
165
- path.join("_build", lang["code"]),
166
- "--builder",
167
- "custom",
168
- "--custom-builder",
169
- "tei",
170
- lang["path"],
171
- ],
172
- check=False,
173
- )
174
- copytree(
175
- path.join("_build", lang["code"], "_build", "html"),
176
- path.join(settings["output"], lang["code"]),
177
- dirs_exist_ok=True,
178
- )
159
+ if settings["output"]["tei"]:
160
+ subprocess.run(
161
+ [ # noqa: S603, S607
162
+ "jupyter-book",
163
+ "build",
164
+ "--all",
165
+ "--path-output",
166
+ path.join("_build", lang["path"]),
167
+ "--builder",
168
+ "custom",
169
+ "--custom-builder",
170
+ "tei",
171
+ lang["path"],
172
+ ],
173
+ check=False,
174
+ )
179
175
  copytree(
180
- path.join("_build", lang["code"], "_build", "tei"),
181
- path.join(settings["output"], lang["code"]),
182
- ignore=ignore_patterns("_sphinx_design_static"),
176
+ path.join("_build", lang["path"], "_build", "html"),
177
+ path.join(settings["output"]["path"], lang["path"]),
183
178
  dirs_exist_ok=True,
184
179
  )
180
+ if settings["output"]["tei"]:
181
+ copytree(
182
+ path.join("_build", lang["path"], "_build", "tei"),
183
+ path.join(settings["output"]["path"], lang["path"]),
184
+ ignore=ignore_patterns("_sphinx_design_static"),
185
+ dirs_exist_ok=True,
186
+ )
185
187
 
186
188
 
187
189
  def partial_build(lang: dict) -> None:
@@ -192,41 +194,43 @@ def partial_build(lang: dict) -> None:
192
194
  "jupyter-book",
193
195
  "build",
194
196
  "--path-output",
195
- path.join("_build", lang["code"]),
197
+ path.join("_build", lang["path"]),
196
198
  lang["path"],
197
199
  ],
198
200
  check=False,
199
201
  )
200
- subprocess.run(
201
- [ # noqa: S603, S607
202
- "jupyter-book",
203
- "build",
204
- "--path-output",
205
- path.join("_build", lang["code"]),
206
- "--builder",
207
- "custom",
208
- "--custom-builder",
209
- "tei",
210
- lang["path"],
211
- ],
212
- check=False,
213
- )
214
- copytree(
215
- path.join("_build", lang["code"], "_build", "html"),
216
- path.join(settings["output"], lang["code"]),
217
- dirs_exist_ok=True,
218
- )
202
+ if settings["output"]["tei"]:
203
+ subprocess.run(
204
+ [ # noqa: S603, S607
205
+ "jupyter-book",
206
+ "build",
207
+ "--path-output",
208
+ path.join("_build", lang["path"]),
209
+ "--builder",
210
+ "custom",
211
+ "--custom-builder",
212
+ "tei",
213
+ lang["path"],
214
+ ],
215
+ check=False,
216
+ )
219
217
  copytree(
220
- path.join("_build", lang["code"], "_build", "tei"),
221
- path.join(settings["output"], lang["code"]),
222
- ignore=ignore_patterns("_sphinx_design_static"),
218
+ path.join("_build", lang["path"], "_build", "html"),
219
+ path.join(settings["output"]["path"], lang["path"]),
223
220
  dirs_exist_ok=True,
224
221
  )
222
+ if settings["output"]["tei"]:
223
+ copytree(
224
+ path.join("_build", lang["path"], "_build", "tei"),
225
+ path.join(settings["output"]["path"], lang["path"]),
226
+ ignore=ignore_patterns("_sphinx_design_static"),
227
+ dirs_exist_ok=True,
228
+ )
225
229
 
226
230
 
227
231
  def run() -> None:
228
232
  """Build the full uEdition."""
229
- if path.exists(settings["output"]):
230
- rmtree(settings["output"])
233
+ if path.exists(settings["output"]["path"]):
234
+ rmtree(settings["output"]["path"])
231
235
  for lang in settings["languages"]:
232
236
  full_build(lang)
uedition/cli/serve.py CHANGED
@@ -39,4 +39,4 @@ def run() -> None:
39
39
  server.watch(path.join("static", "**", "*.*"), full_cmd)
40
40
  server.watch(path.join(lang["path"], "**", "*.*"), partial_cmd)
41
41
  server.watch("uEdition.*", lambda: [cmd() for cmd in full_rebuilds])
42
- server.serve(root="site", port=8000)
42
+ server.serve(root=settings["output"]["path"], port=8000)
@@ -1,4 +1,4 @@
1
- (function() {
1
+ (function () {
2
2
  async function setup() {
3
3
  try {
4
4
  let buttonContainer = document.querySelector('.article-header-buttons');
@@ -39,7 +39,7 @@
39
39
  link.classList.add('fw-bold');
40
40
  }
41
41
  link.innerHTML = langConfig.label;
42
- link.setAttribute('href', DOCUMENTATION_OPTIONS.URL_ROOT + '../' + langConfig.path + '/' + DOCUMENTATION_OPTIONS.pagename + DOCUMENTATION_OPTIONS.LINK_SUFFIX);
42
+ link.setAttribute('href', document.querySelector("html").getAttribute("data-content_root") + '../' + langConfig.path + '/' + DOCUMENTATION_OPTIONS.pagename + DOCUMENTATION_OPTIONS.LINK_SUFFIX);
43
43
 
44
44
  item.append(link);
45
45
  menu.append(item);
@@ -50,7 +50,7 @@
50
50
  container.append(button);
51
51
  container.append(menu);
52
52
  buttonContainer.prepend(container);
53
- } catch(e) {
53
+ } catch (e) {
54
54
  console.error(e);
55
55
  }
56
56
  }
@@ -32,5 +32,6 @@ def copy_custom_files(app: Sphinx, exc: bool) -> None: # noqa: FBT001
32
32
 
33
33
  def setup(app: Sphinx) -> None:
34
34
  """Set up the Language switcher extension."""
35
- app.connect("builder-inited", add_language_switcher)
36
- app.connect("build-finished", copy_custom_files)
35
+ if len(settings["languages"]) > 1:
36
+ app.connect("builder-inited", add_language_switcher)
37
+ app.connect("build-finished", copy_custom_files)
@@ -7,6 +7,7 @@ from sphinx.application import Sphinx
7
7
  from sphinx.util.fileutil import copy_asset_file
8
8
 
9
9
  from uedition.ext.tei import parser
10
+ from uedition.settings import settings
10
11
 
11
12
 
12
13
  def add_language_switcher(app: Sphinx) -> None:
@@ -26,5 +27,6 @@ def copy_custom_files(app: Sphinx, exc: bool) -> None: # noqa: FBT001
26
27
  def setup(app: Sphinx) -> None:
27
28
  """Set up the TEI Sphinx extension."""
28
29
  parser.setup(app)
29
- app.connect("builder-inited", add_language_switcher)
30
- app.connect("build-finished", copy_custom_files)
30
+ if settings["output"]["tei"]:
31
+ app.connect("builder-inited", add_language_switcher)
32
+ app.connect("build-finished", copy_custom_files)
@@ -56,6 +56,8 @@ MAPPINGS = [
56
56
  },
57
57
  {"cls": nodes.inline, "tagname": "hi", "type": "inline"},
58
58
  {"cls": nodes.literal, "tagname": "hi", "type": "inline"},
59
+ {"cls": nodes.strong, "tagname": "hi", "type": "inline", "attrs": [{"target": "rend", "value": "bold"}]},
60
+ {"cls": nodes.emphasis, "tagname": "hi", "type": "inline", "attrs": [{"target": "rend", "value": "italic"}]},
59
61
  {"cls": nodes.label, "tagname": "label", "type": "inline"},
60
62
  {
61
63
  "cls": nodes.reference,
@@ -139,7 +141,7 @@ class TEITranslator(nodes.GenericNodeVisitor):
139
141
  for attr in node.attlist():
140
142
  if "source" in attr_rule and attr[0] == attr_rule["source"]:
141
143
  output_attrs[attr_rule["target"]] = attr[1]
142
- if isinstance(output_attrs[attr_rule["target"]], list):
144
+ if attr_rule["target"] in output_attrs and isinstance(output_attrs[attr_rule["target"]], list):
143
145
  joiner = attr_rule["join"] if "join" in attr_rule else " "
144
146
  if "format" in attr_rule:
145
147
  output_attrs[attr_rule["target"]] = joiner.join(
uedition/settings.py CHANGED
@@ -6,10 +6,11 @@
6
6
  All application settings are accessed via the `settings` dictionary.
7
7
  """
8
8
  import os
9
- from typing import Any, Dict, Tuple, Type
9
+ from typing import Annotated, Any, Dict, Tuple, Type
10
10
 
11
11
  from pydantic import BaseModel
12
12
  from pydantic.fields import FieldInfo
13
+ from pydantic.functional_validators import BeforeValidator
13
14
  from pydantic_settings import BaseSettings, PydanticBaseSettingsSource
14
15
  from yaml import safe_load
15
16
 
@@ -87,6 +88,22 @@ class AuthorSettings(BaseModel):
87
88
  """The author's contact e-mail."""
88
89
 
89
90
 
91
+ class OuputSettings(BaseModel):
92
+ """Settings for the output configuration."""
93
+
94
+ path: str = "docs"
95
+ """The output path."""
96
+ tei: bool = True
97
+ """Whether to generate TEI output."""
98
+
99
+
100
+ def convert_output_str_to_dict(value: str | dict) -> dict:
101
+ """Convert the simple output directory string to a dictionary."""
102
+ if isinstance(value, str):
103
+ return {"path": value}
104
+ return value
105
+
106
+
90
107
  class Settings(BaseSettings):
91
108
  """Application settings."""
92
109
 
@@ -96,7 +113,7 @@ class Settings(BaseSettings):
96
113
  """The author settings."""
97
114
  languages: list[LanguageSetting] = []
98
115
  """The configured languages."""
99
- output: str = "docs"
116
+ output: Annotated[OuputSettings, BeforeValidator(convert_output_str_to_dict)] = OuputSettings()
100
117
  """The output directory."""
101
118
  repository: RepositorySettings = RepositorySettings()
102
119
  """The repository settings."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: uEdition
3
- Version: 0.9.0
3
+ Version: 1.0.0
4
4
  Project-URL: Documentation, https://github.com/uEdition/uEdition#readme
5
5
  Project-URL: Issues, https://github.com/uEdition/uEdition/issues
6
6
  Project-URL: Source, https://github.com/uEdition/uEdition
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
15
15
  Classifier: Programming Language :: Python :: Implementation :: PyPy
16
16
  Requires-Python: >=3.10
17
17
  Requires-Dist: copier<10.0.0,>=9.0.0
18
- Requires-Dist: jupyter-book<1.0.0,>=0.15.1
18
+ Requires-Dist: jupyter-book<2.0.0,>=1.0.0
19
19
  Requires-Dist: livereload
20
20
  Requires-Dist: lxml<6.0.0,>=4.9.2
21
21
  Requires-Dist: pydantic-settings<3.0.0,>=2.0.0
@@ -48,6 +48,16 @@ The recommended installation for use is via `pipx`:
48
48
  pipx install uedition
49
49
  ```
50
50
 
51
+ All commands can then be run via
52
+
53
+ ```console
54
+ uEdition {command}
55
+ ```
56
+
57
+ ## Documentation
58
+
59
+ Full documentation is available at [https://uedition.readthedocs.io](https://uedition.readthedocs.io).
60
+
51
61
  ## License
52
62
 
53
- `uedition` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
63
+ The μEdition is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -1,26 +1,26 @@
1
- uedition/CHANGELOG.md,sha256=eSZyYdHoT9USgeFYA03WOY7oeP5DKUs950aNqWH36wk,1113
2
- uedition/__about__.py,sha256=u6v6FEOeXiiuiYNL8syWcS4Nmw0xQkPZ_d75sw7eDX4,157
1
+ uedition/CHANGELOG.md,sha256=NTTpW1nGpmwqXkLHEoLTHrmyGBXZINKch2Kj_cYZnZY,1356
2
+ uedition/__about__.py,sha256=rLZ6J6d8BZjSI-Yq5EyJrB0Diw4iKah6vRHCOmIswZw,157
3
3
  uedition/__init__.py,sha256=xDDK2i5l1NLhxq6_LJH5g7UJDrFEjIJNmT2tcg7xNWI,301
4
4
  uedition/__main__.py,sha256=Pg_yGV-ndR2iiImDC3f017llSX6pSYMslIwZlw8vEpQ,189
5
- uedition/settings.py,sha256=s8o8u3USTtAgYY3E9IbG09kakJseuZqRbFTiLTFLnpA,4222
5
+ uedition/settings.py,sha256=4jWfjD1KmYTwzeD6DhP9taWS-zFp9XHxo1QqUqsSlrA,4774
6
6
  uedition/cli/__init__.py,sha256=h3N4ZwgRC72IlkCsTbke4PLTFv-_pn1-npXXPC7S78U,1642
7
- uedition/cli/build.py,sha256=NMAZjDOu-N3wveESJjDKElVZmbixFZ2x8gMoxJKL-vE,7361
7
+ uedition/cli/build.py,sha256=oeRvkHdLGm5Wb7-UuvjHTMQiuReb9GKYvkDv-W-uV0g,7741
8
8
  uedition/cli/check.py,sha256=Jlkyw6mgcz3HM-wJpmzCtKv054MFolCe7m6bSUDtsZA,7005
9
9
  uedition/cli/create.py,sha256=Q-SvDq9VtmUP4DQhuuvt1eZ_72sX8_tcFOj2Bt_T6J8,371
10
10
  uedition/cli/language.py,sha256=IqSJrZbrQzU-7TJqnCBeC2HUs1N01EAa7jFMvfXTsoA,1943
11
- uedition/cli/serve.py,sha256=tHAReyO7GpZeDK6Bb9DTi7YpaUJyzH6Dgz390ZgiQnI,1371
11
+ uedition/cli/serve.py,sha256=UfVsY26OW9yAz7rnjjatz1gEDGIi1kaTYlkUAiVCuRw,1391
12
12
  uedition/cli/update.py,sha256=XKHnvorHqizsB5zP-8ifMrgnQuq6zRk6Tb03dBz_MI4,377
13
13
  uedition/ext/__init__.py,sha256=hAK3MB5il4tAkfWnZNVxIJhfJ5vN0Fdmmtz0ZAYsvo4,406
14
14
  uedition/ext/config.py,sha256=wmy3sW0g4yha00LRvuHlYc1OnVEpit75U6uD8mPPu_U,5738
15
15
  uedition/ext/language_switcher.css,sha256=y4LzkCgCm6E_nHt15I4Ku5QzBNpjwda9bt9FsqD1ybM,132
16
- uedition/ext/language_switcher.js,sha256=5CL1Es5T_s0qXcbYtpycvh0tMNdn97MHWCoGECe5w0w,2661
17
- uedition/ext/language_switcher.py,sha256=Lry03GVXsYek0aFX46U-hS3NSjPywxOtfOGBOQqTdPU,1378
18
- uedition/ext/tei/__init__.py,sha256=UPJcnNobzqTTGpWD8LyRosI6TW9HQ6GZjpuRtVu7WdA,993
19
- uedition/ext/tei/builder.py,sha256=aHCTvBupOXWGoJs0LUsa7u6YHtbPsqrSZaMf-dOMacU,11479
16
+ uedition/ext/language_switcher.js,sha256=HIgQiLg0WGS_G_VjpfEpTDLqb1HwHxcL3r6mdoSUix4,2697
17
+ uedition/ext/language_switcher.py,sha256=tHpf4HsvMtatVn5dQ3EFlrk5urFaMzsZZY755cvgCu8,1425
18
+ uedition/ext/tei/__init__.py,sha256=8KgVi31bz8nI65m6u4EdT_f1qNCP45HrU0V7MSGlZxA,1074
19
+ uedition/ext/tei/builder.py,sha256=XLFM11Gnt_4G4H-2gaJyjOgko_aMmvgZnKftMsSk8qw,11743
20
20
  uedition/ext/tei/parser.py,sha256=PVc-rhNTmFRSsz7HhlYVQrQCdZ-aEGX4z16-g_vFTE4,11286
21
21
  uedition/ext/tei/tei_download.js,sha256=5_IPCuamZGPXWriPPPz5wA-zo0Y0Oy1858S6ltxSdQ8,2151
22
- uedition-0.9.0.dist-info/METADATA,sha256=ZGCOAqbtu-KZ0XyICuPB9Ur9NBUZ7yyxV2ylEl11c0A,2017
23
- uedition-0.9.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
24
- uedition-0.9.0.dist-info/entry_points.txt,sha256=cDOOVBb1SZ072ZkY1hW4Y7I_WKKGCtCJtDY1XST1Hr4,96
25
- uedition-0.9.0.dist-info/licenses/LICENSE.txt,sha256=MhLJl8GE8mnuO5i_pvKaobpIGnhiAEdkY-a6LKiuwCE,1101
26
- uedition-0.9.0.dist-info/RECORD,,
22
+ uedition-1.0.0.dist-info/METADATA,sha256=Xo9beHSFPrUMMC-DiGQNOLIL_Uq5salbOiMi7hXB8z8,2210
23
+ uedition-1.0.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
24
+ uedition-1.0.0.dist-info/entry_points.txt,sha256=cDOOVBb1SZ072ZkY1hW4Y7I_WKKGCtCJtDY1XST1Hr4,96
25
+ uedition-1.0.0.dist-info/licenses/LICENSE.txt,sha256=MhLJl8GE8mnuO5i_pvKaobpIGnhiAEdkY-a6LKiuwCE,1101
26
+ uedition-1.0.0.dist-info/RECORD,,