crieur 1.8.1__py3-none-any.whl → 1.9.1__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 crieur might be problematic. Click here for more details.

crieur/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "1.8.1"
3
+ VERSION = "1.9.1"
4
4
  ROOT_DIR = Path(__file__).parent
crieur/generator.py CHANGED
@@ -15,7 +15,8 @@ from .typography import typographie
15
15
  from .utils import neighborhood
16
16
 
17
17
  locale.setlocale(locale.LC_ALL, "")
18
- md = mistune.create_markdown(plugins=["footnotes", "superscript"])
18
+ mistune_plugins = ["footnotes", "superscript", "table"]
19
+ md = mistune.create_markdown(plugins=mistune_plugins, escape=False)
19
20
 
20
21
 
21
22
  def slugify_(value):
crieur/models.py CHANGED
@@ -10,6 +10,7 @@ from PIL import Image, UnidentifiedImageError
10
10
  from slugify import slugify
11
11
  from yaml.composer import ComposerError
12
12
 
13
+ from .generator import mistune_plugins
13
14
  from .typography import typographie
14
15
 
15
16
 
@@ -35,7 +36,7 @@ class ImgsWithSizesRenderer(FrenchTypographyRenderer):
35
36
  base_url=None,
36
37
  article=None,
37
38
  ):
38
- super().__init__()
39
+ super().__init__(escape, allow_harmful_protocols)
39
40
  self._base_url = base_url
40
41
  self._article = article
41
42
 
@@ -45,7 +46,7 @@ class ImgsWithSizesRenderer(FrenchTypographyRenderer):
45
46
  return text
46
47
  return super().paragraph(text)
47
48
 
48
- def image(self, alt, url):
49
+ def image(self, text, url, title=None):
49
50
  if self._article.images_path is None:
50
51
  print(f"Image with URL `{url}` is discarded.")
51
52
  return ""
@@ -56,7 +57,7 @@ class ImgsWithSizesRenderer(FrenchTypographyRenderer):
56
57
  print(f"`{full_path}` is not a valid image.")
57
58
  return ""
58
59
  width, height = image.size
59
- caption = f"<figcaption>{alt}</figcaption>" if alt else ""
60
+ caption = f"<figcaption>{text}</figcaption>" if text else ""
60
61
  full_url = f"{self._base_url}{self._article.url}{url}"
61
62
  return dedent(
62
63
  f"""\
@@ -68,7 +69,7 @@ class ImgsWithSizesRenderer(FrenchTypographyRenderer):
68
69
  width="{width}" height="{height}"
69
70
  loading="lazy"
70
71
  decoding="async"
71
- alt="{alt}">
72
+ alt="{text}">
72
73
  </a>
73
74
  {caption}
74
75
  </figure>
@@ -135,7 +136,8 @@ class Numero(YAMLWizard):
135
136
  base_url=base_url,
136
137
  article=loaded_article,
137
138
  ),
138
- plugins=["footnotes", "superscript"],
139
+ plugins=mistune_plugins,
140
+ escape=False,
139
141
  )
140
142
  loaded_article.content_html = md(loaded_article.content_md)
141
143
  loaded_articles.append(loaded_article)
@@ -256,9 +258,11 @@ def collect_authors(numeros):
256
258
  if not article.authors:
257
259
  continue
258
260
  for athr in article.authors:
259
- author_forname = athr["forname"]
260
- author_surname = athr["surname"]
261
- author_name = f"{author_forname} {author_surname}"
261
+ author_forname = athr.get("forname", "")
262
+ author_surname = athr.get("surname", "")
263
+ author_name = f"{author_forname} {author_surname}".strip()
264
+ if not author_name:
265
+ continue
262
266
  author_slug = slugify(author_name)
263
267
  if author_slug in authors:
264
268
  authors[author_slug].articles.append(article)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crieur
3
- Version: 1.8.1
3
+ Version: 1.9.1
4
4
  Summary: A Static Revue Generator.
5
5
  Project-URL: Homepage, https://gitlab.huma-num.fr/ecrinum/crieur
6
6
  Project-URL: Issues, https://gitlab.huma-num.fr/ecrinum/crieur/-/issues
@@ -1,8 +1,8 @@
1
- crieur/__init__.py,sha256=O8R0eSSNMbXSylnPd6kYLTSZhVo0917hSfC31AX71f0,77
1
+ crieur/__init__.py,sha256=puCj4_kji3yq03piHwqm8C6Xfe3FDO-v0-pfv95slI8,77
2
2
  crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
3
3
  crieur/cli.py,sha256=trYYSwcYsyPoWluZSVLoSA-8w86uQy3Wnw_w6724g8k,5809
4
- crieur/generator.py,sha256=5vryuODzvfvVQv7eUrMzIsjPWBAY3ZOFplFn6VW6SE8,4688
5
- crieur/models.py,sha256=I9lOLvNxCyQq-Yot69TkWsZGRAUYdv68i-qzjQ8nevk,9136
4
+ crieur/generator.py,sha256=druWYkgrSzdWnRJDQkLT-EuabdMib_nw1tdIS1fGLPM,4745
5
+ crieur/models.py,sha256=gBQx-3OFAsksfxH-OHI8Tm1J5YAwxyvfkQfoQkl5TP8,9328
6
6
  crieur/typography.py,sha256=zZHJLZ8aUslMuiNX6z4buKNDZuj7gcrUxcIGACWmIHw,2759
7
7
  crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
8
8
  crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
@@ -12,8 +12,8 @@ crieur/templates/base.html,sha256=4ZOLAnmle0_m8Y3lWT6wcH8f-_7SymxEDeIUzDQNnks,16
12
12
  crieur/templates/homepage.html,sha256=7YG7kA4AFuyrSuqWeFAVj09ogwsybE7w0-NKMLWms5s,2994
13
13
  crieur/templates/keyword.html,sha256=Hv3Ep3R6oN5pBw14gfQT-aeqEiuFiatmVZLWn5hR1e4,428
14
14
  crieur/templates/numero.html,sha256=F7hCaAHJ1WRWxD_zfhJzyLaiwXblJWJF7DUTy41Mnu8,1849
15
- crieur-1.8.1.dist-info/METADATA,sha256=HORg94MhKI8ug2soyYvj9RtLYaJD9ZUGuk3ITxx4A5c,45269
16
- crieur-1.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- crieur-1.8.1.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
18
- crieur-1.8.1.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
19
- crieur-1.8.1.dist-info/RECORD,,
15
+ crieur-1.9.1.dist-info/METADATA,sha256=WJJ2fhQNWspEhZkozJpbk48Er0USIMDXCCVkohn-Q4Q,45269
16
+ crieur-1.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ crieur-1.9.1.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
18
+ crieur-1.9.1.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
19
+ crieur-1.9.1.dist-info/RECORD,,
File without changes