crieur 1.4.0__tar.gz → 1.5.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crieur
3
- Version: 1.4.0
3
+ Version: 1.5.0
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
@@ -754,6 +754,7 @@ cog.out(f"```\n{help}\n```")
754
754
  [--extra-vars EXTRA_VARS] [--target-path TARGET_PATH]
755
755
  [--source-path SOURCE_PATH]
756
756
  [--templates-path TEMPLATES_PATH] [--without-statics]
757
+ [--feed-limit FEED_LIMIT]
757
758
 
758
759
  options:
759
760
  -h, --help show this help message and exit
@@ -768,6 +769,8 @@ options:
768
769
  /sources/).
769
770
  --templates-path TEMPLATES_PATH
770
771
  --without-statics Do not copy statics if True (default: False).
772
+ --feed-limit FEED_LIMIT
773
+ Number of max items in the feed (default: 10).
771
774
 
772
775
  ```
773
776
  <!-- [[[end]]] -->
@@ -49,6 +49,7 @@ cog.out(f"```\n{help}\n```")
49
49
  [--extra-vars EXTRA_VARS] [--target-path TARGET_PATH]
50
50
  [--source-path SOURCE_PATH]
51
51
  [--templates-path TEMPLATES_PATH] [--without-statics]
52
+ [--feed-limit FEED_LIMIT]
52
53
 
53
54
  options:
54
55
  -h, --help show this help message and exit
@@ -63,6 +64,8 @@ options:
63
64
  /sources/).
64
65
  --templates-path TEMPLATES_PATH
65
66
  --without-statics Do not copy statics if True (default: False).
67
+ --feed-limit FEED_LIMIT
68
+ Number of max items in the feed (default: 10).
66
69
 
67
70
  ```
68
71
  <!-- [[[end]]] -->
@@ -1,4 +1,4 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "1.4.0"
3
+ VERSION = "1.5.0"
4
4
  ROOT_DIR = Path(__file__).parent
@@ -29,6 +29,7 @@ def generate(
29
29
  source_path: Path = Path() / "sources",
30
30
  templates_path: Path = Path(__file__).parent / "templates",
31
31
  without_statics: bool = False,
32
+ feed_limit: int = 10,
32
33
  ):
33
34
  """Generate a new revue website.
34
35
 
@@ -39,6 +40,7 @@ def generate(
39
40
  :source_path: Path where stylo source were downloaded (default: /sources/).
40
41
  :template_path: Path where templates are located (default: @crieur/templates/).
41
42
  :without_statics: Do not copy statics if True (default: False).
43
+ :feed_limit: Number of max items in the feed (default: 10).
42
44
  """
43
45
  numeros = []
44
46
  for numero in each_folder_from(source_path):
@@ -58,9 +60,7 @@ def generate(
58
60
  target_path,
59
61
  templates_path,
60
62
  )
61
- generate_feed(
62
- title, base_url, numeros, extra_vars, target_path, number=10, lang="fr"
63
- )
63
+ generate_feed(title, base_url, numeros, extra_vars, target_path, number=feed_limit)
64
64
 
65
65
  if not without_statics:
66
66
  static_path_local = Path(__file__).parent / "statics"
@@ -87,9 +87,7 @@ def generate_html(
87
87
  (author_folder / "index.html").write_text(content)
88
88
 
89
89
 
90
- def generate_feed(
91
- title, base_url, numeros, extra_vars, target_path, number=10, lang="fr"
92
- ):
90
+ def generate_feed(title, base_url, numeros, extra_vars, target_path, number, lang="fr"):
93
91
  feed = FeedGenerator()
94
92
  feed.id(base_url)
95
93
  feed.title(title)
@@ -1,4 +1,5 @@
1
1
  from dataclasses import dataclass
2
+ from datetime import datetime
2
3
  from typing import Optional
3
4
 
4
5
  from dataclass_wizard import DatePattern, DumpMeta, YAMLWizard
@@ -40,6 +41,15 @@ class Numero(YAMLWizard):
40
41
  print(f"Metadata error in `{article['article']['title']}`:")
41
42
  print(e)
42
43
  exit(1)
44
+ if not loaded_article.date:
45
+ print(f"Article `{loaded_article.title}` skipped (no date).")
46
+ continue
47
+ if loaded_article.date > datetime.today().date():
48
+ print(
49
+ f"Article `{loaded_article.title}` skipped "
50
+ f"(future date: {loaded_article.date})."
51
+ )
52
+ continue
43
53
  if not loaded_article.id:
44
54
  loaded_article.id = article_slug
45
55
  loaded_article.content_md = (
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes