Repository: mgcth/mysgen

Issue:
Forward all posts dict to pages template
## Description

For more flexibility, forward all posts_dict to page template.

Discussion:

Patch:
diff --git a/pyproject.toml b/pyproject.toml
index fd5217a..7e57d98 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 [project]
 name = "mysgen"
-version = "0.4.0"
+version = "0.4.1"
 description = "My simple static site generator."
 license = { text = "MIT" }
 readme = "README.md"
diff --git a/src/mysgen/mysgen.py b/src/mysgen/mysgen.py
index a230943..de03e15 100644
--- a/src/mysgen/mysgen.py
+++ b/src/mysgen/mysgen.py
@@ -432,6 +432,7 @@ class MySGEN:
             )
             base["pages"] = self.pages
             base["articles"] = posts_metadata
+            base["all_posts"] = self.posts
         else:
             raise NotImplementedError(
                 "Item type {item_type} not implemented.".format(item_type=item_type)


Test patch:
diff --git a/tests/test_unit.py b/tests/test_unit.py
index a2d018d..9dccccd 100644
--- a/tests/test_unit.py
+++ b/tests/test_unit.py
@@ -261,7 +261,8 @@ class TestUnitMySGEN:
             mysgen.process(item_type)
             if data["page"].meta["status"] == "published":
                 data["page"].process.assert_called_once_with(
-                    {"pages": data, "articles": "posts_metadata"}, "template"
+                    {"pages": data, "articles": "posts_metadata", "all_posts": {}},
+                    "template",
                 )
             mock_sorted.assert_called_once()