Skip to content

Commit

Permalink
Revert "rename engine metadata to template_engine (#29)"
Browse files Browse the repository at this point in the history
This reverts commit 44ab2ed.
  • Loading branch information
ClmntBcqt authored Jul 8, 2024
1 parent 0748417 commit ba9b763
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion content/pages/a_page.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title Page1
slug page1
template_engine jinja2
engine jinja2
---
{

Expand Down
2 changes: 1 addition & 1 deletion content/pages/another_page.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title Another page
slug page2
template_engine jinja2
engine jinja2
---
{

Expand Down
3 changes: 1 addition & 2 deletions galae-content/pages/en-index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
--- METADATA (first) ---

title galae - ethical and free pay-per-use e-mail
slug en-index
description galae est un service e-mail éthique et libre facturé à l'usage. Toutes nos offres incluent des boîtes emails et domaines illimités hébergés en France.
language French
lang en
template_engine jinja2
engine jinja2

page_header_h1 galae - the free, ethical, pay-per-use e-mail service
page_header_h2 Standard, interoperable e-mails and a service entirely based on self-hosting ready technologies
Expand Down
2 changes: 1 addition & 1 deletion galae-content/pages/fr-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ slug fr-index
description galae est un service e-mail éthique et libre facturé à l'usage. Toutes nos offres incluent des boîtes emails et domaines illimités hébergés en France.
language French
lang fr
template_engine jinja2
engine jinja2

page_header_h1 le service e-mail éthique et libre facturé à l'usage
page_header_h2 pour des e-mails standards et interopérables et un service intégralement basé sur des technologies auto-hébergeables
Expand Down
2 changes: 1 addition & 1 deletion galae-content/pages/generateur-enregistrements-dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description galae est un service e-mail éthique et libre facturé à l'usag
slug generateur-enregistrements-dns
language French
lang fr
template_engine jinja2
engine jinja2

page_header_h1 Générez les enregistrements DNS de vos domaines

Expand Down
2 changes: 1 addition & 1 deletion galae-content/pages/temoignages-clients.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title Temoignages clients
slug temoignages-clients
lang fr
template_engine jinja2
engine jinja2

page_header_h1 Nos clients témoignent ...
---
Expand Down
23 changes: 11 additions & 12 deletions jssg/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,17 @@ def content(self) -> str:
# extras=["fenced-code-blocks", "tables"],
# )


if "template_engine" in self.metadata.keys() and self.metadata["template_engine"] == "django" :
return Template(self.content).render(
if "engine" in self.metadata.keys() and self.metadata["engine"] == "jinja2" :
return engines["jinja2"].from_string(self.body).render(
{
"posts": sorted(
Post.load_glob(), key=lambda p: p.timestamp, reverse=True
),
"data":self.data
}
)
else :
return Template(self.body).render(
Context(
{
"posts": sorted(
Expand All @@ -100,15 +108,6 @@ def content(self) -> str:
}
)
)
else :
return engines["jinja2"].from_string(self.content).render(
{
"posts": sorted(
Post.load_glob(), key=lambda p: p.timestamp, reverse=True
),
"data":self.data
}
)

@classmethod
def load(cls, path: Path) -> "Document":
Expand Down

0 comments on commit ba9b763

Please sign in to comment.