From f5392cf1687678007c1fdc70528b065c6142b6a8 Mon Sep 17 00:00:00 2001
From: Emmanuel Godard <emmanuel.godard@lis-lab.fr>
Date: Thu, 23 Jan 2025 22:37:47 +0100
Subject: [PATCH] meilleure gestion des dates

---
 templates/article.html  |  6 ++++--
 templates/category.html | 36 ++++++++++++++----------------------
 templates/index.html    | 29 +++++++++++++----------------
 3 files changed, 31 insertions(+), 40 deletions(-)

diff --git a/templates/article.html b/templates/article.html
index 5f792bd..921def0 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -15,14 +15,16 @@
     <article>
       <h1>{{ article.title }}</h1>
       {% if article.author %}
-      <h2>{{ article.author }}</h2>
+      <h2>{{ article.author }} ({% if article.institution %}{{ article.institution }}{% else %}{{ DEFAULT_INSTITUTION }}{% endif %})</h2>
       {% endif %}
         {% import 'translations.html' as translations with context %}
         {{ translations.translations_for(article) }}
         <aside>
             <ul>
                 <li>
-                    <time datetime="{{ article.date }}">{{ article.date|strftime('%b %d, %Y') }}</time>
+                  <time datetime="{{ article.date }}">{{ article.date|strftime('%b %d, %Y') }},
+		  {% if article.time %}{{ article.time }}{% else %}{{ DEFAULT_TIME }}{% endif %}</time>
+		  {% if article.location %}{{ article.location }}{% else %}{{ DEFAULT_LOCATION }}{% endif %}
                 </li>
                 {% if article.modified %}
                 <li>
diff --git a/templates/category.html b/templates/category.html
index 2082ab2..6736c88 100644
--- a/templates/category.html
+++ b/templates/category.html
@@ -7,28 +7,20 @@
         <section id="list">
             <h2>{{ category }}</h2>
             <ul>
-                {% set new = namespace(p=0) %}
-                {% for article in articles_page.object_list %}
-                    {% set period = article.date | strftime('%Y') %}
-                    {% if period != new.p %}
-                        <h3>{{ period }}</h3>
-                        <li>
-                          <a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}
-      {% if article.author %}
-      -- {{ article.author }}
-      {% endif %}
-
-			  </a>
-                            <time>{{ article.date|strftime('%b %Y') }}</time>
-                        </li>
-                        {% set new.p = article.date | strftime('%Y') %}
-                    {% elif period == new.p %}
-                        <li>
-                            <a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a>
-                            <time>{{ article.date|strftime('%b %Y') }}</time>
-                        </li>
-                    {% endif %}
-                {% endfor %}
+              {% set current = 0 %}
+              {% for article in articles_page.object_list %}
+              {% set period = article.date | strftime('%Y') %}
+              {% if period != current %}
+              <h3>{{ period }}</h3>
+	      {% set current = period %}
+	      {% endif %}
+              <li>
+                <time>{{ article.date|strftime('%d %b %Y') }}</time><span>&nbsp;&nbsp;</span>
+		<a href="{{ SITEURL }}/{{ article.url }}"><strong>{{ article.title }}</strong>
+		  {{ article.author }}
+		</a>
+              </li>
+              {% endfor %}
             </ul>
         </section>
         {% if articles_page.has_other_pages() %}
diff --git a/templates/index.html b/templates/index.html
index 215be3e..6e51690 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -4,22 +4,19 @@
       {% if INDEX %}<section>{{ INDEX }}</section>{% endif %}
       <section id="home">
             <ul>
-                {% for article in articles_page.object_list %}
-                <li>
-		  {% if article.date.isocalendar() >= article.date.today().isocalendar() %}
-		  <h1><time datetime="{{ article.date }}">{{ article.date|strftime('%b %d, %Y') }}</time></h1>
-                        <h2><a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark"
-                               title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2>
-      {% if article.author %}
-      <h3>{{ article.author }}</h3>
-      {% endif %}
-                        <p>
-                            {{ article.summary }}
-                            <a href="{{ SITEURL }}/{{ article.url }}"><em>Read more...</em></a>
-                        </p>
-                </li>
-		  {% endif %}
-                {% endfor %}
+              {% for article in articles_page.object_list %}
+              <li>
+		{% if NOT_FUTURE_ONLY or article.date.isocalendar() >= article.date.today().isocalendar() %}
+		<h2>
+		  <time datetime="{{ article.date }}">{{ article.date|strftime('%d %b %Y') }}</time>
+                  <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark"
+                     title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a>
+		</h2>
+		<h3>{{ article.author }} ({% if article.institution %}{{ article.institution }}{% else %}{{ DEFAULT_INSTITUTION }}{% endif %})
+		</h3>
+		{% endif %}
+              </li>
+              {% endfor %}
             </ul>
             {% if articles_page.has_other_pages() %}
                 {% include 'pagination.html' %}
-- 
GitLab