crieur 1.3.0__tar.gz → 1.3.2__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.
Potentially problematic release.
This version of crieur might be problematic. Click here for more details.
- {crieur-1.3.0 → crieur-1.3.2}/PKG-INFO +1 -1
- {crieur-1.3.0 → crieur-1.3.2}/crieur/__init__.py +1 -1
- {crieur-1.3.0 → crieur-1.3.2}/crieur/cli.py +14 -1
- {crieur-1.3.0 → crieur-1.3.2}/crieur/models.py +22 -6
- {crieur-1.3.0 → crieur-1.3.2}/.gitignore +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/LICENSE +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/README.md +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/__main__.py +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/generator.py +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/statics/pico.css +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/article.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/author.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/base.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/homepage.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/keyword.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/templates/numero.html +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/crieur/utils.py +0 -0
- {crieur-1.3.0 → crieur-1.3.2}/pyproject.toml +0 -0
|
@@ -101,14 +101,27 @@ def stylo(
|
|
|
101
101
|
with httpx.stream("GET", url, timeout=None) as r:
|
|
102
102
|
for data in r.iter_bytes():
|
|
103
103
|
fd.write(data)
|
|
104
|
+
else:
|
|
105
|
+
print(
|
|
106
|
+
f"Source already exists: `{zip_path}` (no download). "
|
|
107
|
+
"Use the `--force` option to download it again"
|
|
108
|
+
)
|
|
104
109
|
|
|
105
110
|
target_path = sources_path / f"{i + 1}-{stylo_id}"
|
|
106
111
|
try:
|
|
107
112
|
with zipfile.ZipFile(zip_path, "r") as zip_ref:
|
|
108
113
|
zip_ref.extractall(target_path)
|
|
109
|
-
print(f"Data
|
|
114
|
+
print(f"Data extracted to {target_path}")
|
|
110
115
|
except zipfile.BadZipFile:
|
|
116
|
+
zip_problematic_path = Path() / f"problematic-export-{i + 1}-{stylo_id}.zip"
|
|
117
|
+
zip_path.rename(zip_problematic_path)
|
|
111
118
|
print(f"Unable to find corpus with id {stylo_id}!")
|
|
119
|
+
print(
|
|
120
|
+
f"Check out the content of {zip_problematic_path} to try to understand."
|
|
121
|
+
)
|
|
122
|
+
print(
|
|
123
|
+
"Either you use a wrong corpus id or there is an issue with the export."
|
|
124
|
+
)
|
|
112
125
|
return
|
|
113
126
|
|
|
114
127
|
|
|
@@ -2,6 +2,7 @@ from dataclasses import dataclass
|
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
4
|
from dataclass_wizard import DatePattern, DumpMeta, YAMLWizard
|
|
5
|
+
from dataclass_wizard import errors as dw_errors
|
|
5
6
|
from slugify import slugify
|
|
6
7
|
from yaml.composer import ComposerError
|
|
7
8
|
|
|
@@ -29,11 +30,16 @@ class Numero(YAMLWizard):
|
|
|
29
30
|
)
|
|
30
31
|
article_yaml_path = article_folder / f"{article_slug}.yaml"
|
|
31
32
|
try:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
try:
|
|
34
|
+
loaded_article = Article.from_yaml_file(article_yaml_path)
|
|
35
|
+
except ComposerError:
|
|
36
|
+
loaded_article = Article.from_yaml(
|
|
37
|
+
article_yaml_path.read_text().split("---")[1]
|
|
38
|
+
)
|
|
39
|
+
except dw_errors.ParseError as e:
|
|
40
|
+
print(f"Metadata error in `{article['article']['title']}`:")
|
|
41
|
+
print(e)
|
|
42
|
+
exit(1)
|
|
37
43
|
if not loaded_article.id:
|
|
38
44
|
loaded_article.id = article_slug
|
|
39
45
|
loaded_article.content_md = (
|
|
@@ -46,7 +52,7 @@ class Numero(YAMLWizard):
|
|
|
46
52
|
)
|
|
47
53
|
loaded_article.numero = self
|
|
48
54
|
loaded_articles.append(loaded_article)
|
|
49
|
-
self.articles = loaded_articles
|
|
55
|
+
self.articles = sorted(loaded_articles, reverse=True)
|
|
50
56
|
|
|
51
57
|
|
|
52
58
|
@dataclass
|
|
@@ -65,6 +71,14 @@ class Article(YAMLWizard):
|
|
|
65
71
|
def __post_init__(self):
|
|
66
72
|
self.slug = slugify(self.title)
|
|
67
73
|
|
|
74
|
+
def __eq__(self, other):
|
|
75
|
+
return self.id == other.id
|
|
76
|
+
|
|
77
|
+
def __lt__(self, other: "Article"):
|
|
78
|
+
if not isinstance(other, Article):
|
|
79
|
+
return NotImplemented
|
|
80
|
+
return self.date < other.date
|
|
81
|
+
|
|
68
82
|
|
|
69
83
|
def configure_numero(yaml_path):
|
|
70
84
|
# Preserves abstract_fr key (vs. abstract-fr) when converting to_yaml()
|
|
@@ -148,6 +162,8 @@ def collect_authors(numeros):
|
|
|
148
162
|
for numero in numeros:
|
|
149
163
|
for article in numero.articles:
|
|
150
164
|
article_authors = []
|
|
165
|
+
if not article.authors:
|
|
166
|
+
continue
|
|
151
167
|
for athr in article.authors:
|
|
152
168
|
author_forname = athr["forname"]
|
|
153
169
|
author_surname = athr["surname"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|