crieur 1.0.3__py3-none-any.whl → 1.0.5__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.0.3"
3
+ VERSION = "1.0.5"
4
4
  ROOT_DIR = Path(__file__).parent
crieur/cli.py CHANGED
@@ -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)
crieur/generator.py CHANGED
@@ -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")
crieur/models.py CHANGED
@@ -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"{article['article']['title']}.yaml"
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"{article['article']['title']}.md"
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="../..">{{ numero.name }}</a></h2>
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="/mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
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="/statics/pico.css" />
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="/">{{ title }}</a></h1>
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="/mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
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="/mot-clef/{{ keyword.slug }}/">#{{ keyword.name }}</a>({{ keyword.articles|length }}){%- if not loop.last -%}, {% endif %}
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="/numero/{{ numero.name }}/">{{ numero.name }}</a></h2>
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="/numero/{{ numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></li>
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="/numero/{{ article.numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></li>
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="/numero/{{ numero.name }}/article/{{ article.id }}/">{{ article.title_f }}</a></h3>
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 %}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crieur
3
- Version: 1.0.3
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
@@ -0,0 +1,17 @@
1
+ crieur/__init__.py,sha256=_Cm28IL8svdeNFJUhC5K6KyLSaWia9_WoEXOK-4lBRM,77
2
+ crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
3
+ crieur/cli.py,sha256=-H9yMG0vT5pJXAL5GP7zf5qisi3KzoIhjG1LUXz9p10,4423
4
+ crieur/generator.py,sha256=LHFR93DYogcvfEoudnXn5BI7LiQ7M71VXE-Q4uWshOY,2501
5
+ crieur/models.py,sha256=8xEJvP-G81PY4rEPR7fAgahIqu2phzJPELiB8jiKP8A,3753
6
+ crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
7
+ crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
8
+ crieur/templates/article.html,sha256=9-5wfVvwyu-IRDB33TUjO2dwNDDTOdxr_Qw3RpwghvM,1149
9
+ crieur/templates/base.html,sha256=T1VALdpGLtG-tVYDcziLHQQbYWFvAs4FDRBL_olO2mc,1416
10
+ crieur/templates/homepage.html,sha256=Z6ODT-FVLUT0BjpVNaIOqGp-8rrJYeKbJE37wsGapUU,2458
11
+ crieur/templates/keyword.html,sha256=dNcq8fxRG9tDIoTJnKfzlaukyr25gHBRDXauAe2qlI8,428
12
+ crieur/templates/numero.html,sha256=R_lBPiXMeSLGWCvy-4U4X1tJuNQHpK-dVVe3DaVtQ9o,1882
13
+ crieur-1.0.5.dist-info/METADATA,sha256=AEEy78TNm8a2iFLE-CHBJ2ghuRrALJqoT_GXl2OtdCU,44515
14
+ crieur-1.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ crieur-1.0.5.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
16
+ crieur-1.0.5.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
17
+ crieur-1.0.5.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- crieur/__init__.py,sha256=q9aHaAl8dfTUattWUoIFE6JfFZoLBTXYhI6ANrPB3lY,77
2
- crieur/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
3
- crieur/cli.py,sha256=6hdYn48ASf5sPEPzWw2UUXpH48yD5IgU731mH714LRQ,4327
4
- crieur/generator.py,sha256=5VEwrDoMkYLM_pv5D-vBAjEYtIOgQXEtkLCLfazKZOE,2461
5
- crieur/models.py,sha256=C-eqCa5Ce1hNGv89Ta3ZhSixT06h0am_MG-mO7FNjjo,3658
6
- crieur/utils.py,sha256=kIdxpd5LgVv13Lx2aEXzjQttBDtcppRlwNsH0vwX8f0,1566
7
- crieur/statics/pico.css,sha256=VdrimW9PLcEIzqJ__s062OrwBj_Jb6jZIwbtdqOtM-w,93407
8
- crieur/templates/article.html,sha256=70lTPtK5JRSqEIw5cIrqQjZ4VfiagLBijUeKqRA8muk,1102
9
- crieur/templates/base.html,sha256=8rIb5CqfVLsY5lSCJe1kUb65k306QiQxlbxYAFgjJMc,1390
10
- crieur/templates/homepage.html,sha256=1MURsQucBzUd2WCSGoKnx50rRUofFxFcioljgj84rnE,2406
11
- crieur/templates/keyword.html,sha256=G-q2Hq3td0pSGfrVbOY3I85QVenwlczr5xBlSYjV-Fs,415
12
- crieur/templates/numero.html,sha256=U0rKS6Zl34-O8-IMi27pWtGyN7wZVtTEQMgsdx6RREM,1869
13
- crieur-1.0.3.dist-info/METADATA,sha256=4cJs2_JtEAJV4xBCxJAYC51VbSNtVKxMkNbGRSXGfRc,44408
14
- crieur-1.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- crieur-1.0.3.dist-info/entry_points.txt,sha256=edmbmPxs9QXyvSMpPJBDPGw3vZOJEKqXJhysYNx3QSM,43
16
- crieur-1.0.3.dist-info/licenses/LICENSE,sha256=F5acw9_laHeyi4wPmQyf_ttyz81VqCIwScwO8C1FhXU,34519
17
- crieur-1.0.3.dist-info/RECORD,,
File without changes