Template the index.html with a JSON file, and add sources for the zero-day
Signed-off-by: Emmy D'Anello <ynerant@emy.lu>
This commit is contained in:
parent
29f33b82ee
commit
cae46e21a8
|
@ -0,0 +1 @@
|
|||
output/
|
|
@ -0,0 +1,11 @@
|
|||
generate:
|
||||
python3 generate.py
|
||||
cp static/* output/
|
||||
|
||||
clean:
|
||||
rm output/*
|
||||
|
||||
install:
|
||||
rsync -arvP --delete-after output/ proxy.adm.ynerant.fr:/var/www/apaisement/
|
||||
|
||||
all: clean generate install
|
|
@ -0,0 +1,81 @@
|
|||
[
|
||||
{
|
||||
"index": 0,
|
||||
"subtitle": "Allocution présidentielle",
|
||||
"events": [
|
||||
{
|
||||
"description": "Emmanuel Macron s'exprime à 20h devant les Français⋅es. Il fixe un cap de 100 jours pour appaiser le pays.",
|
||||
"media": [
|
||||
{
|
||||
"type": "youtube",
|
||||
"code": "AJCXYPNkqX8"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "Emmanuel Macron chante des chants pyrénéens avec une association d'extrême droite à Paris. Cette association avait été financée à hauteur de 40 000 € par le Ministère de la Culture.",
|
||||
"media": [
|
||||
{
|
||||
"type": "video",
|
||||
"link": "https://video.twimg.com/ext_tw_video/1648244643618750465/pu/vid/1280x720/zbBImqSU23HYIdXy.mp4",
|
||||
"source_text": "Twitter, @NicolasBoutin11",
|
||||
"source_url": "https://twitter.com/NicolasBoutin11/status/1648245356042256384"
|
||||
},
|
||||
{
|
||||
"type": "link",
|
||||
"link": "https://www.liberation.fr/checknews/emmanuel-macron-a-t-il-chante-dans-la-rue-avec-une-asso-proche-de-lultradroite-apres-son-allocution-televisee-20230418_TPTXITMBIJE23ANEFEQCSCVLAM/",
|
||||
"text": "CheckNews : Emmanuel Macron a-t-il chanté dans la rue avec une asso proche de l’ultradroite après son allocution télévisée ?"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"index": 1,
|
||||
"subtitle": "La faute aux Maghrébin⋅es",
|
||||
"events": [
|
||||
{
|
||||
"description": "Bruno Le Maire affirme que l'argent de l'État part au Maghreb.",
|
||||
"url": null,
|
||||
"image": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"index": 2,
|
||||
"subtitle": "L'Alsace se rebèle",
|
||||
"events": [
|
||||
{
|
||||
"description": "Macron hué à Muttersholtz et à Sélestat.",
|
||||
"url": null,
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"description": "Le député LFI Emmanuel Fernandes baîlloné par le 49§3 devant Macron.",
|
||||
"url": null,
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"description": "La nouvelle devise du pays selon Véran : « Travail, <s>Famille, Patrie</s> Ordre, Progrès",
|
||||
"url": null,
|
||||
"image": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"index": 3,
|
||||
"subtitle": "Les casseroles classifiées comme armes",
|
||||
"events": [
|
||||
{
|
||||
"description": "La préfecture de l'Hérault interdit le port d'objets sonores portatifs.",
|
||||
"url": null,
|
||||
"image": null
|
||||
},
|
||||
{
|
||||
"description": "Le député LFI Sébastien Rome remet à Macron un livre sur la Résistance dans la région",
|
||||
"image": null,
|
||||
"url": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from datetime import date, timedelta
|
||||
import json
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
|
||||
BASE_DATE = date(2023, 4, 17)
|
||||
|
||||
def to_date(offset: int, date_format="%d/%m/%Y"):
|
||||
return (BASE_DATE + timedelta(days=offset)).strftime(date_format)
|
||||
|
||||
|
||||
def generate():
|
||||
with open('data.json') as f:
|
||||
data = json.load(f)
|
||||
|
||||
env = Environment(loader=FileSystemLoader("templates/"))
|
||||
env.filters['to_date'] = to_date
|
||||
template = env.get_template("template.html.j2")
|
||||
|
||||
with open('output/index.html', 'w') as f:
|
||||
f.write(template.render(data=data))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
generate()
|
83
index.html
83
index.html
|
@ -1,83 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Le pays est-il apaisé ?</title>
|
||||
<meta name="description" content="Documentation de l'apaisement du pays en 100 jours comme promis par Emmanuel Macron">
|
||||
|
||||
<!-- TODO Replace with local assets -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Le pays est-il apaisé ? <span class="text-danger fw-bold">NON</span></h1>
|
||||
|
||||
<div class="progress" role="progressbar" aria-label="Progression de l'apaisement" aria-valuenow="3" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" style="width: 3%"></div>
|
||||
</div>
|
||||
|
||||
Jour 3/100
|
||||
|
||||
<div class="alert alert-warning">
|
||||
Cette page est en construction, et a vocation à documenter l'ensemble des étapes de l'apaisement.
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="accordionSteps">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse0" aria-expanded="false" aria-controls="collapse0">
|
||||
Jour 0 : 17/04/2023
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse0" class="accordion-collapse collapse" data-bs-parent="#accordionSteps">
|
||||
<div class="accordion-body">
|
||||
Emmanuel Macron chante des chants pyrénéens avec des personnes d'extrême droite dans Paris.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse1" aria-expanded="false" aria-controls="collapse1">
|
||||
Jour 1 : 18/04/2023
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse1" class="accordion-collapse collapse" data-bs-parent="#accordionSteps">
|
||||
<div class="accordion-body">
|
||||
Bruno Le Maire dit que l'argent de l'État part au Maghreb.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse2" aria-expanded="false" aria-controls="collapse2">
|
||||
Jour 2 : 19/04/2023
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse2" class="accordion-collapse collapse" data-bs-parent="#accordionSteps">
|
||||
<div class="accordion-body">
|
||||
Emmanuel Macron hué comme jamais à Muttersholtz et à Sélestat, en Alsace. Emmanuel Fernandes baîlloné par le 49§3. La CGT coupe le courant. Communication désastreuse.<br>
|
||||
Olivier Véran dévoile la nouvelle devise du pays : « Travail, <s>Famille, Patrie</s> Ordre, Progrès »
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse3" aria-expanded="false" aria-controls="collapse3">
|
||||
Jour 3 : 20/04/2023
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse3" class="accordion-collapse collapse" data-bs-parent="#accordionSteps">
|
||||
<div class="accordion-body">
|
||||
Casseroles interdites au rassemblement à Ganges, dans l'Hérault.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script src="theme.js"></script>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
Jinja2~=3.1.2
|
|
@ -0,0 +1,76 @@
|
|||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Le pays est-il apaisé ?</title>
|
||||
<meta name="description" content="Documentation de l'apaisement du pays en 100 jours comme promis par Emmanuel Macron">
|
||||
|
||||
<!-- TODO Replace with local assets -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="container">
|
||||
<h1>Le pays est-il apaisé ? <span class="text-danger fw-bold">NON</span></h1>
|
||||
|
||||
<div class="progress" role="progressbar" aria-label="Progression de l'apaisement" aria-valuenow="3" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated bg-danger" style="width: 3%"></div>
|
||||
</div>
|
||||
|
||||
Jour 3/100
|
||||
|
||||
<div class="alert alert-warning">
|
||||
Cette page est en construction, et a vocation à documenter l'ensemble des étapes de l'apaisement.
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="accordionSteps">
|
||||
{% for day in data %}
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ day.index }}" aria-expanded="false" aria-controls="collapse{{ day.index }}">
|
||||
Jour {{ day.index }} : {{ day.index | to_date }} — {{ day.subtitle }}
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse{{ day.index }}" class="accordion-collapse collapse" data-bs-parent="#accordionSteps">
|
||||
<div class="accordion-body">
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for event in day.events %}
|
||||
<li class="list-group-item">
|
||||
<h5>{{ event.description }}</h5>
|
||||
{% for medium in event.media %}
|
||||
<div>
|
||||
{% if medium.type == "link" %}
|
||||
<p>
|
||||
<a href="{{ medium.text }}">{{ medium.text }}</a>
|
||||
</p>
|
||||
{% elif medium.type == "youtube" %}
|
||||
<div class="text-center">
|
||||
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/{{ medium.code }}" title="Allocution du président de la République du 17 avril 2023" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
|
||||
</div>
|
||||
{% elif medium.type == "video" %}
|
||||
<div class="text-center">
|
||||
<div>
|
||||
<video controls width="560" height="315">
|
||||
<source src="{{ medium.link }}">
|
||||
</video>
|
||||
</div>
|
||||
<p>
|
||||
<i>Source : <a href="{{ medium.source_url }}">{{ medium.source_text }}</a></i>
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</main>
|
||||
</body>
|
||||
|
||||
<script src="theme.js"></script>
|
||||
</html>
|
Loading…
Reference in New Issue