crieur 1.0.3__tar.gz → 1.0.5__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.0.3 → crieur-1.0.5}/PKG-INFO +4 -3
- {crieur-1.0.3 → crieur-1.0.5}/README.md +3 -2
- {crieur-1.0.3 → crieur-1.0.5}/crieur/__init__.py +1 -1
- {crieur-1.0.3 → crieur-1.0.5}/crieur/cli.py +3 -1
- {crieur-1.0.3 → crieur-1.0.5}/crieur/generator.py +3 -2
- {crieur-1.0.3 → crieur-1.0.5}/crieur/models.py +7 -5
- {crieur-1.0.3 → crieur-1.0.5}/crieur/templates/article.html +2 -2
- {crieur-1.0.3 → crieur-1.0.5}/crieur/templates/base.html +2 -2
- {crieur-1.0.3 → crieur-1.0.5}/crieur/templates/homepage.html +4 -4
- {crieur-1.0.3 → crieur-1.0.5}/crieur/templates/keyword.html +1 -1
- {crieur-1.0.3 → crieur-1.0.5}/crieur/templates/numero.html +1 -1
- {crieur-1.0.3 → crieur-1.0.5}/.gitignore +0 -0
- {crieur-1.0.3 → crieur-1.0.5}/LICENSE +0 -0
- {crieur-1.0.3 → crieur-1.0.5}/crieur/__main__.py +0 -0
- {crieur-1.0.3 → crieur-1.0.5}/crieur/statics/pico.css +0 -0
- {crieur-1.0.3 → crieur-1.0.5}/crieur/utils.py +0 -0
- {crieur-1.0.3 → crieur-1.0.5}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crieur
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
|
@@ -730,7 +730,7 @@ options:
|
|
|
730
730
|
-h, --help Show this help message and exit
|
|
731
731
|
|
|
732
732
|
Available commands:
|
|
733
|
-
|
|
733
|
+
|
|
734
734
|
version Return the current version.
|
|
735
735
|
generate Generate a new revue website.
|
|
736
736
|
stylo Initialize a new revue to current directory from Stylo.
|
|
@@ -750,11 +750,12 @@ help = output.decode().split("\n", 1)[1] # Remove Pandoc version.
|
|
|
750
750
|
cog.out(f"```\n{help}\n```")
|
|
751
751
|
]]] -->
|
|
752
752
|
```
|
|
753
|
-
[--source-path SOURCE_PATH]
|
|
753
|
+
[--target-path TARGET_PATH] [--source-path SOURCE_PATH]
|
|
754
754
|
|
|
755
755
|
options:
|
|
756
756
|
-h, --help show this help message and exit
|
|
757
757
|
--title, -t TITLE Title of the website (default: Crieur).
|
|
758
|
+
--base-url BASE_URL Base URL of the website, ending with / (default: /).
|
|
758
759
|
--target-path TARGET_PATH
|
|
759
760
|
Path where site is built (default: /public/).
|
|
760
761
|
--source-path SOURCE_PATH
|
|
@@ -26,7 +26,7 @@ options:
|
|
|
26
26
|
-h, --help Show this help message and exit
|
|
27
27
|
|
|
28
28
|
Available commands:
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
version Return the current version.
|
|
31
31
|
generate Generate a new revue website.
|
|
32
32
|
stylo Initialize a new revue to current directory from Stylo.
|
|
@@ -46,11 +46,12 @@ help = output.decode().split("\n", 1)[1] # Remove Pandoc version.
|
|
|
46
46
|
cog.out(f"```\n{help}\n```")
|
|
47
47
|
]]] -->
|
|
48
48
|
```
|
|
49
|
-
[--source-path SOURCE_PATH]
|
|
49
|
+
[--target-path TARGET_PATH] [--source-path SOURCE_PATH]
|
|
50
50
|
|
|
51
51
|
options:
|
|
52
52
|
-h, --help show this help message and exit
|
|
53
53
|
--title, -t TITLE Title of the website (default: Crieur).
|
|
54
|
+
--base-url BASE_URL Base URL of the website, ending with / (default: /).
|
|
54
55
|
--target-path TARGET_PATH
|
|
55
56
|
Path where site is built (default: /public/).
|
|
56
57
|
--source-path SOURCE_PATH
|
|
@@ -23,12 +23,14 @@ def version():
|
|
|
23
23
|
@cli
|
|
24
24
|
def generate(
|
|
25
25
|
title="Crieur",
|
|
26
|
+
base_url="/",
|
|
26
27
|
target_path: Path = Path() / "public",
|
|
27
28
|
source_path: Path = Path() / "sources",
|
|
28
29
|
):
|
|
29
30
|
"""Generate a new revue website.
|
|
30
31
|
|
|
31
32
|
:title: Title of the website (default: Crieur).
|
|
33
|
+
:base_url: Base URL of the website, ending with / (default: /).
|
|
32
34
|
:target_path: Path where site is built (default: /public/).
|
|
33
35
|
:source_path: Path where stylo source were downloaded (default: /sources/).
|
|
34
36
|
"""
|
|
@@ -39,7 +41,7 @@ def generate(
|
|
|
39
41
|
numeros.append(numero)
|
|
40
42
|
|
|
41
43
|
keywords = collect_keywords(numeros)
|
|
42
|
-
generate_html(title, numeros, keywords, target_path)
|
|
44
|
+
generate_html(title, base_url, numeros, keywords, target_path)
|
|
43
45
|
|
|
44
46
|
static_path_local = Path(__file__).parent / "statics"
|
|
45
47
|
shutil.copytree(static_path_local, target_path / "statics", dirs_exist_ok=True)
|
|
@@ -29,11 +29,12 @@ def markdown(value):
|
|
|
29
29
|
environment.filters["markdown"] = markdown
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def generate_html(title, numeros, keywords, target_path):
|
|
32
|
+
def generate_html(title, base_url, numeros, keywords, target_path):
|
|
33
33
|
common_params = {
|
|
34
|
+
"title": title,
|
|
35
|
+
"base_url": base_url,
|
|
34
36
|
"numeros": numeros,
|
|
35
37
|
"keywords": keywords,
|
|
36
|
-
"title": title,
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
template_homepage = environment.get_template("homepage.html")
|
|
@@ -20,19 +20,21 @@ class Numero(YAMLWizard):
|
|
|
20
20
|
|
|
21
21
|
loaded_articles = []
|
|
22
22
|
for article in self.articles:
|
|
23
|
+
article_slug = slugify(article["article"]["title"])
|
|
23
24
|
article_folder = (
|
|
24
|
-
yaml_path.parent
|
|
25
|
-
/ f"{article['article']['title']}-{article['article']['_id']}"
|
|
25
|
+
yaml_path.parent / f"{article_slug}-{article['article']['_id']}"
|
|
26
26
|
)
|
|
27
|
-
article_yaml_path = article_folder / f"{
|
|
27
|
+
article_yaml_path = article_folder / f"{article_slug}.yaml"
|
|
28
28
|
try:
|
|
29
29
|
loaded_article = Article.from_yaml_file(article_yaml_path)
|
|
30
30
|
except ComposerError:
|
|
31
31
|
loaded_article = Article.from_yaml(
|
|
32
32
|
article_yaml_path.read_text().split("---")[1]
|
|
33
33
|
)
|
|
34
|
+
if not loaded_article.id:
|
|
35
|
+
loaded_article.id = article_slug
|
|
34
36
|
loaded_article.content_md = (
|
|
35
|
-
article_folder / f"{
|
|
37
|
+
article_folder / f"{article_slug}.md"
|
|
36
38
|
).read_text()
|
|
37
39
|
loaded_article.images_path = (
|
|
38
40
|
article_folder / "images"
|
|
@@ -46,10 +48,10 @@ class Numero(YAMLWizard):
|
|
|
46
48
|
|
|
47
49
|
@dataclass
|
|
48
50
|
class Article(YAMLWizard):
|
|
49
|
-
id: str
|
|
50
51
|
title: str
|
|
51
52
|
title_f: str
|
|
52
53
|
date: Optional[DatePattern["%Y/%m/%d"]] # noqa: F722
|
|
54
|
+
id: str = ""
|
|
53
55
|
subtitle: str = ""
|
|
54
56
|
subtitle_f: str = ""
|
|
55
57
|
content_md: str = ""
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% extends "base.html" %}
|
|
2
2
|
|
|
3
3
|
{% block content %}
|
|
4
|
-
<h2><a href="
|
|
4
|
+
<h2><a href="{{ base_url }}numeros/{{ numero.name }}">{{ numero.name }}</a></h2>
|
|
5
5
|
|
|
6
6
|
<article>
|
|
7
7
|
<header>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{% endif %}
|
|
21
21
|
|
|
22
22
|
{% for keyword in article.keywords %}
|
|
23
|
-
<a href="
|
|
23
|
+
<a href="{{ base_url }}mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
24
24
|
{% endfor %}
|
|
25
25
|
</header>
|
|
26
26
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<!-- Lightest blank gif, avoids an extra query to the server. -->
|
|
16
16
|
<link rel="icon" href="data:;base64,iVBORw0KGgo=" />
|
|
17
17
|
<link rel="stylesheet"
|
|
18
|
-
href="
|
|
18
|
+
href="{{ base_url }}statics/pico.css" />
|
|
19
19
|
<style>
|
|
20
20
|
h1 {
|
|
21
21
|
text-align: center;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<body>
|
|
28
28
|
<main class="container">
|
|
29
29
|
<div class="content">
|
|
30
|
-
<h1><a href="
|
|
30
|
+
<h1><a href="{{ base_url }}">{{ title }}</a></h1>
|
|
31
31
|
{% block content %}
|
|
32
32
|
{% endblock content %}
|
|
33
33
|
</div>
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
{% block content %}
|
|
60
60
|
{% for slug, keyword in keywords.items() %}
|
|
61
61
|
{% if loop.index < 20 %}
|
|
62
|
-
<a href="
|
|
62
|
+
<a href="{{ base_url }}mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
63
63
|
{% endif %}
|
|
64
64
|
{% endfor %}…
|
|
65
65
|
<details>
|
|
66
66
|
<summary role="button">Voir plus de mot-clés :</summary>
|
|
67
67
|
{% for slug, keyword in keywords.items() %}
|
|
68
68
|
{% if loop.index >= 20 %}
|
|
69
|
-
<a href="
|
|
69
|
+
<a href="{{ base_url }}mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
|
|
70
70
|
{% endif %}
|
|
71
71
|
{% endfor %}
|
|
72
72
|
</details>
|
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
<article>
|
|
76
76
|
<header>
|
|
77
77
|
<hgroup>
|
|
78
|
-
<h2><a href="
|
|
78
|
+
<h2><a href="{{ base_url }}numero/{{ numero.name }}/">{{ numero.name }}</a></h2>
|
|
79
79
|
<p>Le {{ numero.articles.0.date.strftime('%d %B %Y') }}</p>
|
|
80
80
|
</hgroup>
|
|
81
81
|
</header>
|
|
82
82
|
<ul>
|
|
83
83
|
{% for article in numero.articles %}
|
|
84
|
-
<li><a href="
|
|
84
|
+
<li><a href="{{ base_url }}numero/{{ numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></li>
|
|
85
85
|
{% endfor %}
|
|
86
86
|
</ul>
|
|
87
87
|
</article>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<div>
|
|
10
10
|
<ul>
|
|
11
11
|
{% for article in keyword.articles %}
|
|
12
|
-
<li><a href="
|
|
12
|
+
<li><a href="{{ base_url }}numero/{{ article.numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></li>
|
|
13
13
|
{% endfor %}
|
|
14
14
|
</ul>
|
|
15
15
|
</div>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
{% for article in numero.articles %}
|
|
60
60
|
<article>
|
|
61
61
|
<header>
|
|
62
|
-
<h3><a href="
|
|
62
|
+
<h3><a href="{{ base_url }}numero/{{ numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></h3>
|
|
63
63
|
</header>
|
|
64
64
|
{{ article.subtitle_f|markdown }}
|
|
65
65
|
{% if article.authors %}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|