From 66dc9e1f4796679a3c3eada6e4e0ca135e7dba4f Mon Sep 17 00:00:00 2001 From: Valentin Le Moign Date: Wed, 10 Jun 2026 18:40:56 +0200 Subject: [PATCH] =?UTF-8?q?Newsletter=20:=20ouvrages=20en=20ann=C3=A9e=20s?= =?UTF-8?q?eule=20+=20filets=20pleins=20sous=20les=20titres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Catégorie ouvrages (15) : la date n'affiche plus que l'année (format Y), comme l'affichage des cartes côté front. format_raw_date() accepte un paramètre de format, sans changement pour les autres catégories. - Titres de section : remplacement du dégradé (linear-gradient, non supporté par Outlook et certains clients mail) par un filet de couleur unie via le pattern table + bgcolor déjà utilisé pour la barre d'accent. Co-Authored-By: Claude Opus 4.8 --- includes/class-html-exporter.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/includes/class-html-exporter.php b/includes/class-html-exporter.php index ffd8a86..df8fd78 100644 --- a/includes/class-html-exporter.php +++ b/includes/class-html-exporter.php @@ -200,7 +200,7 @@ body { margin: 0 !important; padding: 0 !important; } - +
@@ -211,7 +211,13 @@ body { margin: 0 !important; padding: 0 !important; }
-
+ + + + + +
 
@@ -536,11 +542,14 @@ body { margin: 0 !important; padding: 0 !important; } private function format_date_for_category(int $post_id, int $cat_id): string { $window = Thalim_NL_Post_Query::get_window_type($cat_id); + // Ouvrages : année seule, comme l'affichage des cartes côté front. + $date_format = ($cat_id === THALIM_NL_CAT_OUVRAGES) ? 'Y' : 'j F Y'; + if ($window === 'debut_minus35_to_fin') { $raw_debut = get_post_meta($post_id, 'date_de_debut', true) ?: ''; $raw_fin = get_post_meta($post_id, 'date_de_fin', true) ?: ''; - $debut_str = $this->format_raw_date($raw_debut); - $fin_str = $this->format_raw_date($raw_fin); + $debut_str = $this->format_raw_date($raw_debut, $date_format); + $fin_str = $this->format_raw_date($raw_fin, $date_format); if ($debut_str && $fin_str && $debut_str !== $fin_str) { return $debut_str . '–' . $fin_str; } @@ -549,18 +558,18 @@ body { margin: 0 !important; padding: 0 !important; } $raw_dt = get_post_meta($post_id, 'datetime', true) ?: ''; if ($raw_dt && !str_starts_with($raw_dt, '0000-00-00')) { - return $this->format_raw_date($raw_dt); + return $this->format_raw_date($raw_dt, $date_format); } $post = get_post($post_id); - return $post ? $this->format_raw_date($post->post_date) : ''; + return $post ? $this->format_raw_date($post->post_date, $date_format) : ''; } - private function format_raw_date(string $raw): string { + private function format_raw_date(string $raw, string $format = 'j F Y'): string { if (!$raw || str_starts_with($raw, '0000-00-00')) { return ''; } $ts = strtotime($raw); - return $ts ? date_i18n('j F Y', $ts) : ''; + return $ts ? date_i18n($format, $ts) : ''; } // ── Rich-text processor (intro / conclusion) ──────────────────────────────