refactor: update jean-web to new api

This commit is contained in:
Corentin 2024-05-22 00:49:00 +02:00
parent 622983f18a
commit d8fb7e3eff
16 changed files with 55 additions and 54 deletions

View File

@ -43,7 +43,7 @@ Date used for the news is the date the file was created in git.
### HTML generation
We use https://git.collectivit.org/collectivit/jean-website to generate the
We use https://git.collectivit.org/collectivit/jean-web to generate the
website. Jinja2 templates are stored in the src directory, and use the content
loaded from the 'content' folder to generate static pages. Content can be
markdown document with metadata, or json files.

View File

@ -1,5 +1,5 @@
---
picture: the-guild.png
picture: games/the-guild.png
picture_alt: in-game screenshot of a cow-boy riding in wilderness
website: https://the-guild.frog-collective.org
---
@ -11,3 +11,4 @@ dusty trails of the Old West lead to riches beyond your wildest dreams. In this
thrilling adventure, you step into the boots of a rugged prospector, venturing
into uncharted territories to uncover precious resources for a greedy guild
hungry for wealth and power.

View File

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -1,6 +1,6 @@
- name: Aurel
description: Art
avatar: ./aurel.png
avatar: presentation/aurel.png
- name: Adrien
description: Dev
avatar: ./adrien.png
avatar: presentation/adrien.png

View File

@ -1,5 +1,5 @@
---
picture: ../games/the-guild.png
picture: games/the-guild.png
picture_alt: Image de jeux avec un cowboy
website: https://the-guild.frog-collective.org
---

View File

@ -25,7 +25,7 @@ def build(session: Session) -> None:
"""Run unit tests."""
session.install(
"nodeenv",
"git+https://git.collectivit.org/collectivit/jean-website",
"git+https://git.collectivit.org/collectivit/jean-web",
"babel",
"jinja2"
)
@ -54,7 +54,7 @@ def build(session: Session) -> None:
session.log("Building website...")
session.run(
"jwebsite", "build",
"jweb", "build",
env={
'FROG_LOCALE_DIR': str(locale_dir)
}

View File

@ -1,6 +1,12 @@
from os import environ
site.load_extensions(
"jweb.extensions.yaml",
"jweb.extensions.git",
"jweb.extensions.markdown"
)
if "FROG_LOCALE_DIR" in environ:
site.set_translations("site", environ["FROG_LOCALE_DIR"], languages=["fr"])
site.load_translations("site", environ["FROG_LOCALE_DIR"], "fr")
site.render('pages/index.html', 'index.html')

View File

@ -4,23 +4,21 @@
{% extends "lib/section.html.j2" %}
{% block content %}
{% with content = site.content.load("games") %}
{% for game in content.glob("*.md") %}
{% for game in glob("games/*.md") | map('markdown') %}
<div class="game">
<div class="game--picture-wrapper">
<img
class="game--picture"
src="{{ game.meta.picture.as_path() | output }}"
src="{{ game.meta.picture | load | write }}"
alt="{{ game.meta.picture_alt }}"
>
</img>
</div>
<div class="game--description">
{{ game.html }}
{{ game }}
<a class="game--more-button" href="{{ game.meta.website }}">Learn More</a>
</div>
</div>
{% endfor %}
{% endwith %}
{% endblock %}

View File

@ -4,8 +4,7 @@
{% extends "lib/section.html.j2" %}
{% block content %}
{% with content = site.content.load("news") %}
{% for news in content.glob("*.md") %}
{% for news in glob("news/*.md") | map('markdown') %}
<div class="news">
<div class="news--title">
<h3>{{ news.meta.title }}</h3>
@ -14,10 +13,9 @@
{% endwith %}
</div>
<div class="news--content">
{{ news.html }}
{{ news }}
</div>
</div>
</div>
{% endfor %}
{% endwith %}
{% endblock %}

View File

@ -5,20 +5,18 @@
{% extends "lib/section.html.j2" %}
{% block content %}
{% with content = site.content.load("presentation") %}
{% with presentation = content.load("presentation.md") %}
{{ presentation.html }}
{% with presentation = load("presentation/presentation.md") | markdown %}
{{ presentation }}
{% endwith %}
<h3>{{ gettext('Members') }}</h3>
<div class="members">
{% for member in content.load("members.yaml") %}
{% for member in load("presentation/members.yaml") | yaml %}
<div class="member">
<img class="member--avatar" src="{{ member.avatar.as_path() | output }}"></img>
<img class="member--avatar" src="{{ member.avatar | load | write }}"></img>
<h4 class="member--name">{{ member.name }}</h4>
<div class="member--description">{{ member.description }}</div>
</div>
{% endfor %}
</div>
{% endwith %}
{% endblock %}