refactor: update jean-web to new api
This commit is contained in:
parent
622983f18a
commit
d8fb7e3eff
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 204 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
---
|
---
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
site.py
8
site.py
|
|
@ -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')
|
||||||
|
|
|
||||||
|
|
@ -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 | load | write }}"
|
||||||
src="{{ game.meta.picture.as_path() | output }}"
|
alt="{{ game.meta.picture_alt }}"
|
||||||
alt="{{ game.meta.picture_alt }}"
|
>
|
||||||
>
|
</img>
|
||||||
</img>
|
|
||||||
</div>
|
|
||||||
<div class="game--description">
|
|
||||||
{{ game.html }}
|
|
||||||
<a class="game--more-button" href="{{ game.meta.website }}">Learn More</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
<div class="game--description">
|
||||||
{% endwith %}
|
{{ game }}
|
||||||
|
<a class="game--more-button" href="{{ game.meta.website }}">Learn More</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,18 @@
|
||||||
{% 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>
|
{% with creation_date = news | git_creation_date %}
|
||||||
{% with creation_date = news | git_creation_date %}
|
<div class="news--date">{{ creation_date.strftime('%d/%m/%Y') }}</div>
|
||||||
<div class="news--date">{{ creation_date.strftime('%d/%m/%Y') }}</div>
|
{% endwith %}
|
||||||
{% endwith %}
|
</div>
|
||||||
</div>
|
<div class="news--content">
|
||||||
<div class="news--content">
|
{{ news }}
|
||||||
{{ news.html }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
</div>
|
||||||
{% endwith %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
|
|
@ -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 %}
|
|
||||||
|
|
||||||
<h3>{{ gettext('Members') }}</h3>
|
|
||||||
<div class="members">
|
|
||||||
{% for member in content.load("members.yaml") %}
|
|
||||||
<div class="member">
|
|
||||||
<img class="member--avatar" src="{{ member.avatar.as_path() | output }}"></img>
|
|
||||||
<h4 class="member--name">{{ member.name }}</h4>
|
|
||||||
<div class="member--description">{{ member.description }}</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
|
<h3>{{ gettext('Members') }}</h3>
|
||||||
|
<div class="members">
|
||||||
|
{% for member in load("presentation/members.yaml") | yaml %}
|
||||||
|
<div class="member">
|
||||||
|
<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>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue