crieur 1.0.5__tar.gz → 1.1.0__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.5 → crieur-1.1.0}/PKG-INFO +1 -1
- {crieur-1.0.5 → crieur-1.1.0}/crieur/__init__.py +1 -1
- {crieur-1.0.5 → crieur-1.1.0}/crieur/cli.py +7 -3
- {crieur-1.0.5 → crieur-1.1.0}/crieur/generator.py +12 -9
- {crieur-1.0.5 → crieur-1.1.0}/crieur/models.py +1 -1
- {crieur-1.0.5 → crieur-1.1.0}/crieur/templates/article.html +1 -1
- {crieur-1.0.5 → crieur-1.1.0}/crieur/templates/base.html +1 -0
- {crieur-1.0.5 → crieur-1.1.0}/.gitignore +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/LICENSE +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/README.md +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/__main__.py +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/statics/pico.css +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/templates/homepage.html +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/templates/keyword.html +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/templates/numero.html +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/crieur/utils.py +0 -0
- {crieur-1.0.5 → crieur-1.1.0}/pyproject.toml +0 -0
|
@@ -22,10 +22,12 @@ def version():
|
|
|
22
22
|
|
|
23
23
|
@cli
|
|
24
24
|
def generate(
|
|
25
|
-
title="Crieur",
|
|
26
|
-
base_url="/",
|
|
25
|
+
title: str = "Crieur",
|
|
26
|
+
base_url: str = "/",
|
|
27
|
+
extra_vars: str = "",
|
|
27
28
|
target_path: Path = Path() / "public",
|
|
28
29
|
source_path: Path = Path() / "sources",
|
|
30
|
+
templates_path: Path = Path(__file__).parent / "templates",
|
|
29
31
|
):
|
|
30
32
|
"""Generate a new revue website.
|
|
31
33
|
|
|
@@ -41,7 +43,9 @@ def generate(
|
|
|
41
43
|
numeros.append(numero)
|
|
42
44
|
|
|
43
45
|
keywords = collect_keywords(numeros)
|
|
44
|
-
generate_html(
|
|
46
|
+
generate_html(
|
|
47
|
+
title, base_url, numeros, keywords, extra_vars, target_path, templates_path
|
|
48
|
+
)
|
|
45
49
|
|
|
46
50
|
static_path_local = Path(__file__).parent / "statics"
|
|
47
51
|
shutil.copytree(static_path_local, target_path / "statics", dirs_exist_ok=True)
|
|
@@ -1,40 +1,43 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import locale
|
|
2
3
|
import shutil
|
|
3
|
-
from pathlib import Path
|
|
4
4
|
|
|
5
5
|
import mistune
|
|
6
6
|
from jinja2 import Environment as Env
|
|
7
7
|
from jinja2 import FileSystemLoader
|
|
8
8
|
from slugify import slugify
|
|
9
9
|
|
|
10
|
+
from . import VERSION
|
|
10
11
|
from .utils import neighborhood
|
|
11
12
|
|
|
12
13
|
locale.setlocale(locale.LC_ALL, "")
|
|
13
|
-
|
|
14
|
+
md = mistune.create_markdown(plugins=["footnotes", "superscript"])
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def slugify_(value):
|
|
17
18
|
return slugify(value)
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
environment.filters["slugify"] = slugify_
|
|
21
|
-
|
|
22
|
-
md = mistune.create_markdown(plugins=["footnotes", "superscript"])
|
|
23
|
-
|
|
24
|
-
|
|
25
21
|
def markdown(value):
|
|
26
22
|
return md(value) if value else ""
|
|
27
23
|
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
def generate_html(
|
|
26
|
+
title, base_url, numeros, keywords, extra_vars, target_path, templates_path
|
|
27
|
+
):
|
|
28
|
+
environment = Env(loader=FileSystemLoader(str(templates_path)))
|
|
29
|
+
environment.filters["slugify"] = slugify_
|
|
30
|
+
environment.filters["markdown"] = markdown
|
|
30
31
|
|
|
32
|
+
extra_vars = json.loads(extra_vars) if extra_vars else {}
|
|
31
33
|
|
|
32
|
-
def generate_html(title, base_url, numeros, keywords, target_path):
|
|
33
34
|
common_params = {
|
|
34
35
|
"title": title,
|
|
35
36
|
"base_url": base_url,
|
|
36
37
|
"numeros": numeros,
|
|
37
38
|
"keywords": keywords,
|
|
39
|
+
"crieur_version": VERSION,
|
|
40
|
+
**extra_vars,
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
template_homepage = environment.get_template("homepage.html")
|
|
@@ -50,11 +50,11 @@ class Numero(YAMLWizard):
|
|
|
50
50
|
class Article(YAMLWizard):
|
|
51
51
|
title: str
|
|
52
52
|
title_f: str
|
|
53
|
-
date: Optional[DatePattern["%Y/%m/%d"]] # noqa: F722
|
|
54
53
|
id: str = ""
|
|
55
54
|
subtitle: str = ""
|
|
56
55
|
subtitle_f: str = ""
|
|
57
56
|
content_md: str = ""
|
|
57
|
+
date: Optional[DatePattern["%Y/%m/%d"]] = None # noqa: F722
|
|
58
58
|
authors: list = None
|
|
59
59
|
abstract: list = None
|
|
60
60
|
keywords: list = None
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<!-- Has to be within the first 1024 bytes, hence before the <title>
|
|
5
5
|
See: https://www.w3.org/TR/2012/CR-html5-20121217/document-metadata.html#charset -->
|
|
6
6
|
<meta charset="utf-8" />
|
|
7
|
+
<meta name="generator" content="Crieur {{ crieur_version }}">
|
|
7
8
|
<!-- Why no `X-UA-Compatible` meta: https://stackoverflow.com/a/6771584 -->
|
|
8
9
|
<!-- The viewport meta is quite crowded and we are responsible for that.
|
|
9
10
|
See: https://codepen.io/tigt/post/meta-viewport-for-2015 -->
|
|
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
|