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 ### 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 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 loaded from the 'content' folder to generate static pages. Content can be
markdown document with metadata, or json files. 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 picture_alt: in-game screenshot of a cow-boy riding in wilderness
website: https://the-guild.frog-collective.org 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 thrilling adventure, you step into the boots of a rugged prospector, venturing
into uncharted territories to uncover precious resources for a greedy guild into uncharted territories to uncover precious resources for a greedy guild
hungry for wealth and power. 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 - name: Aurel
description: Art description: Art
avatar: ./aurel.png avatar: presentation/aurel.png
- name: Adrien - name: Adrien
description: Dev 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 picture_alt: Image de jeux avec un cowboy
website: https://the-guild.frog-collective.org website: https://the-guild.frog-collective.org
--- ---

View File

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

View File

@ -1,6 +1,12 @@
from os import environ from os import environ
site.load_extensions(
"jweb.extensions.yaml",
"jweb.extensions.git",
"jweb.extensions.markdown"
)
if "FROG_LOCALE_DIR" in environ: 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') site.render('pages/index.html', 'index.html')

View File

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

View File

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

View File

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