mise en forme des définitions dans index.php

This commit is contained in:
2025-05-08 12:19:10 +02:00
parent a42f8a5f18
commit 74beb1388a
3 changed files with 23 additions and 12 deletions

View File

@@ -326,7 +326,7 @@ BAHUT Boîte de pions@Bernard Philippet
BAI Couleur de la robe d'un cheval
BAIE A plus d'eau que de jus@Lionel Leteur
BAIL Temps qui paraît long@Marc Aussitot
BAINDESIEGE Avec lui, la lune est dans l'eau (3 mots)@Max Favalelli
BAIN DE SIEGE Avec lui, la lune est dans l'eau@Max Favalelli
BAL Pour l'ouvrir, il faut tourner@Lucien Lacau Ne s'ouvre pas tout seul@Jean-Paul Vanden Branden
BANLIEUE Avant-centre@Michel Laclos
BANQUIER Homme respectable, surtout sil vous prête@Léon Bloy Il te prête un parapluie par beau temps et te le reprend lorsqu'il commence à pleuvoir@Mark Twain. Personne qui serait d'accord pour vous consentir un prêt à la condition que vous lui apportiez la preuve que vous n'en avez pas besoin
Can't render this file because it contains an unexpected character in line 120 and column 201.

View File

@@ -26,20 +26,13 @@ function dico($longueur_max) {
$mot = $ligne[0];
$definitions = array_slice($ligne, 1);
foreach ($definitions as $i => $definition) {
if (strpos($definition, "@") !== false) {
[$definition, $auteur] = explode("@", $definition);
$definitions[$i] = "$definition <small><em>$auteur</em></small>";
}
}
$mot = str_replace("-", CASE_NOIRE, $mot);
$mot = $transliterator->transliterate($mot);
if (strpos($mot, CASE_NOIRE) !== false) {
$mots = explode(CASE_NOIRE, $mot);
$nb_mots = count($mots);
$mot = implode("", $mots);
$definition .= " <small>($nb_mots mots)</small>";
$definition .= "#$nb_mots";
}
$dico[strlen($mot)][$mot] = $definitions;

View File

@@ -50,7 +50,16 @@ if ($grille_valide) {
foreach ($grille->lignes[$y] as $mot) {
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_horizontales[$y][] = $definitions[mt_rand(0, count($definitions) - 1)];
$definition = $definitions[mt_rand(0, count($definitions) - 1)];
if (strpos($definition, "#") !== false) {
[$definition, $nb_mots] = explode("#", $definition);
$definition .= " <small>($nb_mots mots)</small>";
}
if (strpos($definition, "@") !== false) {
[$definition, $auteur] = explode("@", $definition);
$definition .= " <small><em>$auteur</em></small>";
}
$definitions_horizontales[$y][] = $definition;
}
}
}
@@ -60,7 +69,16 @@ if ($grille_valide) {
foreach ($grille->colonnes[$x] as $mot) {
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_verticales[$x][] = $definitions[mt_rand(0, count($definitions) - 1)];
$definition = $definitions[mt_rand(0, count($definitions) - 1)];
if (strpos($definition, "#") !== false) {
[$definition, $nb_mots] = explode("#", $definition);
$definition .= " <small>($nb_mots mots)</small>";
}
if (strpos($definition, "@") !== false) {
[$definition, $auteur] = explode("@", $definition);
$definition .= " <small><em>$auteur</em></small>";
}
$definitions_verticales[$x][] = $definition;
}
}
}