crieur 1.2.0__py3-none-any.whl → 1.3.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 +1 -1
- crieur/cli.py +10 -2
- crieur/generator.py +9 -1
- crieur/models.py +51 -0
- crieur/templates/article.html +1 -0
- crieur/templates/author.html +17 -0
- crieur/templates/base.html +3 -0
- crieur/templates/homepage.html +29 -13
- {crieur-1.2.0.dist-info → crieur-1.3.1.dist-info}/METADATA +1 -1
- crieur-1.3.1.dist-info/RECORD +18 -0
- crieur-1.2.0.dist-info/RECORD +0 -17
- {crieur-1.2.0.dist-info → crieur-1.3.1.dist-info}/WHEEL +0 -0
- {crieur-1.2.0.dist-info → crieur-1.3.1.dist-info}/entry_points.txt +0 -0
- {crieur-1.2.0.dist-info → crieur-1.3.1.dist-info}/licenses/LICENSE +0 -0
crieur/__init__.py
CHANGED
crieur/cli.py
CHANGED
|
@@ -10,7 +10,7 @@ from minicli import cli, run
|
|
|
10
10
|
|
|
11
11
|
from . import VERSION
|
|
12
12
|
from .generator import generate_html
|
|
13
|
-
from .models import collect_keywords, configure_numero
|
|
13
|
+
from .models import collect_authors, collect_keywords, configure_numero
|
|
14
14
|
from .utils import each_file_from, each_folder_from
|
|
15
15
|
|
|
16
16
|
|
|
@@ -47,8 +47,16 @@ def generate(
|
|
|
47
47
|
numeros.append(numero)
|
|
48
48
|
|
|
49
49
|
keywords = collect_keywords(numeros)
|
|
50
|
+
authors = collect_authors(numeros)
|
|
50
51
|
generate_html(
|
|
51
|
-
title,
|
|
52
|
+
title,
|
|
53
|
+
base_url,
|
|
54
|
+
numeros,
|
|
55
|
+
keywords,
|
|
56
|
+
authors,
|
|
57
|
+
extra_vars,
|
|
58
|
+
target_path,
|
|
59
|
+
templates_path,
|
|
52
60
|
)
|
|
53
61
|
|
|
54
62
|
if not without_statics:
|
crieur/generator.py
CHANGED
|
@@ -23,7 +23,7 @@ def markdown(value):
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
def generate_html(
|
|
26
|
-
title, base_url, numeros, keywords, extra_vars, target_path, templates_path
|
|
26
|
+
title, base_url, numeros, keywords, authors, extra_vars, target_path, templates_path
|
|
27
27
|
):
|
|
28
28
|
environment = Env(loader=FileSystemLoader(str(templates_path)))
|
|
29
29
|
environment.filters["slugify"] = slugify_
|
|
@@ -36,6 +36,7 @@ def generate_html(
|
|
|
36
36
|
"base_url": base_url,
|
|
37
37
|
"numeros": numeros,
|
|
38
38
|
"keywords": keywords,
|
|
39
|
+
"authors": authors,
|
|
39
40
|
"crieur_version": VERSION,
|
|
40
41
|
**extra_vars,
|
|
41
42
|
}
|
|
@@ -75,3 +76,10 @@ def generate_html(
|
|
|
75
76
|
keyword_folder = target_path / "mot-clef" / keyword.slug
|
|
76
77
|
keyword_folder.mkdir(parents=True, exist_ok=True)
|
|
77
78
|
(keyword_folder / "index.html").write_text(content)
|
|
79
|
+
|
|
80
|
+
for slug, author in authors.items():
|
|
81
|
+
template_author = environment.get_template("author.html")
|
|
82
|
+
content = template_author.render(author=author, **common_params)
|
|
83
|
+
author_folder = target_path / "auteur" / author.slug
|
|
84
|
+
author_folder.mkdir(parents=True, exist_ok=True)
|
|
85
|
+
(author_folder / "index.html").write_text(content)
|
crieur/models.py
CHANGED
|
@@ -98,6 +98,29 @@ class Keyword:
|
|
|
98
98
|
return len_self < len_other
|
|
99
99
|
|
|
100
100
|
|
|
101
|
+
@dataclass
|
|
102
|
+
class Author:
|
|
103
|
+
slug: str
|
|
104
|
+
forname: str
|
|
105
|
+
surname: str
|
|
106
|
+
articles: list
|
|
107
|
+
|
|
108
|
+
def __str__(self):
|
|
109
|
+
return f"{self.forname} {self.surname}"
|
|
110
|
+
|
|
111
|
+
def __eq__(self, other):
|
|
112
|
+
return self.slug == other.slug
|
|
113
|
+
|
|
114
|
+
def __lt__(self, other: "Author"):
|
|
115
|
+
if not isinstance(other, Author):
|
|
116
|
+
return NotImplemented
|
|
117
|
+
len_self = len(self.articles)
|
|
118
|
+
len_other = len(other.articles)
|
|
119
|
+
if len_self == len_other:
|
|
120
|
+
return self.slug > other.slug
|
|
121
|
+
return len_self < len_other
|
|
122
|
+
|
|
123
|
+
|
|
101
124
|
def collect_keywords(numeros):
|
|
102
125
|
keywords = {}
|
|
103
126
|
for numero in numeros:
|
|
@@ -118,3 +141,31 @@ def collect_keywords(numeros):
|
|
|
118
141
|
article_keywords.append(kw)
|
|
119
142
|
article.keywords = article_keywords
|
|
120
143
|
return dict(sorted(keywords.items(), key=lambda item: item[1], reverse=True))
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def collect_authors(numeros):
|
|
147
|
+
authors = {}
|
|
148
|
+
for numero in numeros:
|
|
149
|
+
for article in numero.articles:
|
|
150
|
+
article_authors = []
|
|
151
|
+
if not article.authors:
|
|
152
|
+
continue
|
|
153
|
+
for athr in article.authors:
|
|
154
|
+
author_forname = athr["forname"]
|
|
155
|
+
author_surname = athr["surname"]
|
|
156
|
+
author_name = f"{author_forname} {author_surname}"
|
|
157
|
+
author_slug = slugify(author_name)
|
|
158
|
+
if author_slug in authors:
|
|
159
|
+
authors[author_slug].articles.append(article)
|
|
160
|
+
kw = authors[author_slug]
|
|
161
|
+
else:
|
|
162
|
+
kw = Author(
|
|
163
|
+
slug=author_slug,
|
|
164
|
+
forname=author_forname,
|
|
165
|
+
surname=author_surname,
|
|
166
|
+
articles=[article],
|
|
167
|
+
)
|
|
168
|
+
authors[author_slug] = kw
|
|
169
|
+
article_authors.append(kw)
|
|
170
|
+
article.authors = article_authors
|
|
171
|
+
return dict(sorted(authors.items(), key=lambda item: item[1], reverse=True))
|
crieur/templates/article.html
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<details>
|
|
15
15
|
<summary role="button"><em>{{ author.forname }} {{ author.surname }}</em></summary>
|
|
16
16
|
{{ author.biography|markdown }}
|
|
17
|
+
<a href="{{ base_url }}auteur/{{ author.slug }}/" role="button" class="secondary">Autres articles de l’auteur·ice →</a>
|
|
17
18
|
</details>
|
|
18
19
|
{% endfor %}
|
|
19
20
|
</div>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
|
|
3
|
+
{% block content %}
|
|
4
|
+
<article>
|
|
5
|
+
<header>
|
|
6
|
+
<h2>{{ author }} ({{ author.articles|length }})</h2>
|
|
7
|
+
</header>
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<ul>
|
|
11
|
+
{% for article in author.articles %}
|
|
12
|
+
<li><a href="{{ base_url }}numero/{{ article.numero.slug }}/article/{{ article.id }}/">{{ article.title_f }}</a></li>
|
|
13
|
+
{% endfor %}
|
|
14
|
+
</ul>
|
|
15
|
+
</div>
|
|
16
|
+
</article>
|
|
17
|
+
{% endblock content %}
|
crieur/templates/base.html
CHANGED
crieur/templates/homepage.html
CHANGED
|
@@ -57,19 +57,35 @@
|
|
|
57
57
|
{% endblock extra_head %}
|
|
58
58
|
|
|
59
59
|
{% block content %}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
<article>
|
|
61
|
+
<dl>
|
|
62
|
+
<dt>Mots-clefs :</dt>
|
|
63
|
+
<dd>
|
|
64
|
+
{% for slug, keyword in keywords.items() %}
|
|
65
|
+
{% if loop.index < 20 %}
|
|
66
|
+
<a href="{{ base_url }}mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
67
|
+
{% endif %}
|
|
68
|
+
{% endfor %}{% if keywords|length >= 20 %}…
|
|
69
|
+
<details>
|
|
70
|
+
<summary role="button">Voir plus de mot-clés :</summary>
|
|
71
|
+
{% for slug, keyword in keywords.items() %}
|
|
72
|
+
{% if loop.index >= 20 %}
|
|
73
|
+
<a href="{{ base_url }}mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
74
|
+
{% endif %}
|
|
75
|
+
{% endfor %}
|
|
76
|
+
</details>
|
|
77
|
+
{% endif %}
|
|
78
|
+
</dd>
|
|
79
|
+
<dt>Auteur·ices :</dt>
|
|
80
|
+
<dd>
|
|
81
|
+
{% for slug, author in authors.items() %}
|
|
82
|
+
{% if loop.index < 20 %}
|
|
83
|
+
<a href="{{ base_url }}auteur/{{ author.slug }}/">#{{ author }}</a>({{ author.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
84
|
+
{% endif %}
|
|
85
|
+
{% endfor %}
|
|
86
|
+
</dd>
|
|
87
|
+
</dl>
|
|
88
|
+
</article>
|
|
73
89
|
<div class="grid">
|
|
74
90
|
{% for numero in numeros %}
|
|
75
91
|
<article>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
crieur/__init__.py,sha256=yOEK782pE6JekTATU6_RAyoO2v5wdzTmwTwYjrsaqco,77
|
|
2
|
+
crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
3
|
+
crieur/cli.py,sha256=172Rac-Tjm6idS7Uh3OKdpAJNVieN0ntm9-KdzQA6ao,4984
|
|
4
|
+
crieur/generator.py,sha256=Vc0oOLsQMcKWQLkzHLrJf5f1W_qmoxwYsc_ktHFZjtg,3046
|
|
5
|
+
crieur/models.py,sha256=C3ixU19G-569qv88qJQzcZSuojJezCAjtBjcNn2ksr0,5537
|
|
6
|
+
crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
|
|
7
|
+
crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
|
|
8
|
+
crieur/templates/article.html,sha256=4Y1sjBR1nM_ff4yVGgiVlZU1tmnfBMXAjTTSAhqoiA4,1288
|
|
9
|
+
crieur/templates/author.html,sha256=1VHZi6Wld1gWYPfeW3cEJ2ULOKrp9xoCVRhDjPUDdHg,420
|
|
10
|
+
crieur/templates/base.html,sha256=6ih6RryTPXZxR6tqlbRHPpOFUNRu90SPvdfKNLHcRRM,1522
|
|
11
|
+
crieur/templates/homepage.html,sha256=IgYc3cyw-52U3HN1oada0drkzT0fPNyFcdiG6Pwcr9o,3027
|
|
12
|
+
crieur/templates/keyword.html,sha256=Hv3Ep3R6oN5pBw14gfQT-aeqEiuFiatmVZLWn5hR1e4,428
|
|
13
|
+
crieur/templates/numero.html,sha256=b9J6aW_h9ao7XlWA0Xc390ahOH5lHDI8A4iDq6tEZTo,1882
|
|
14
|
+
crieur-1.3.1.dist-info/METADATA,sha256=FjTCJtmcpzthN9ulp96DTnu68qduEQidXFQmmr7nb44,44848
|
|
15
|
+
crieur-1.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
crieur-1.3.1.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
|
|
17
|
+
crieur-1.3.1.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
|
|
18
|
+
crieur-1.3.1.dist-info/RECORD,,
|
crieur-1.2.0.dist-info/RECORD
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
crieur/__init__.py,sha256=vS-uRjCVYd831WrrAwgUW3Tc3G_4y9BRca8t751Zuyg,77
|
|
2
|
-
crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
3
|
-
crieur/cli.py,sha256=UZSfoKYQFmrWxZjbLJcGAcXZ6nW_B3FCZxbno4OwQ6A,4862
|
|
4
|
-
crieur/generator.py,sha256=8SZ3A1p3DFQoIg8qbKHF3sfvClI2_QhMAfBclNj0QTs,2651
|
|
5
|
-
crieur/models.py,sha256=5HHA9_e4ijdLTOrx8oKEKG1W8nYq5hnp64qrd8s2hC8,3899
|
|
6
|
-
crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
|
|
7
|
-
crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
|
|
8
|
-
crieur/templates/article.html,sha256=BzTXmRxg3_SDSDzPIA_eOKGMa1o1wBAXzLvt3hWbv8w,1149
|
|
9
|
-
crieur/templates/base.html,sha256=PQcEuobOFH-WVJKoiZ97UxSqhkgt-Ey7lO44Z778R_U,1480
|
|
10
|
-
crieur/templates/homepage.html,sha256=NqKCwVcBesl43FKQWkKT4OV-vEnln_pWNVvi2nJD9fU,2458
|
|
11
|
-
crieur/templates/keyword.html,sha256=Hv3Ep3R6oN5pBw14gfQT-aeqEiuFiatmVZLWn5hR1e4,428
|
|
12
|
-
crieur/templates/numero.html,sha256=b9J6aW_h9ao7XlWA0Xc390ahOH5lHDI8A4iDq6tEZTo,1882
|
|
13
|
-
crieur-1.2.0.dist-info/METADATA,sha256=f16Cd73x1hf00qi4pUGbfE0JqE8zpJ0-heyzPR6OYYM,44848
|
|
14
|
-
crieur-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
-
crieur-1.2.0.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
|
|
16
|
-
crieur-1.2.0.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
|
|
17
|
-
crieur-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|