Petites corrections

This commit is contained in:
julien
2026-08-07 19:06:45 +02:00
parent 80769f283a
commit 7e09d12345
3 changed files with 2 additions and 15 deletions
+1 -1
View File
@@ -447,7 +447,7 @@ Pour les autres sections, il vérifie :
- `sign`, `mzl` et `lectures` pour les signes ; - `sign`, `mzl` et `lectures` pour les signes ;
- `genres` pour les textes. - `genres` pour les textes.
Dans `themes` et `genres`, les espaces sont refusés : un terme composé doit utiliser des tirets. Par convention, les termes composés de `themes` et `genres` utilisent des tirets. Cette convention relève de la rédaction et nest pas contrôlée par le validateur.
Le validateur accepte les chaînes et tableaux vides. Il ne contrôle pas : Le validateur accepte les chaînes et tableaux vides. Il ne contrôle pas :
-1
View File
@@ -71,7 +71,6 @@ SECTION_FIELDS = {
} }
LIST_FIELDS = frozenset({"logograms", "lectures", "themes", "genres"}) LIST_FIELDS = frozenset({"logograms", "lectures", "themes", "genres"})
URL_TERM_FIELDS = frozenset({"themes", "genres"})
CONTENT_SECTIONS = frozenset(SECTION_FIELDS) | {"vocabulaire"} CONTENT_SECTIONS = frozenset(SECTION_FIELDS) | {"vocabulaire"}
UPDATED_LINE_RE = re.compile(r"(?m)^(?:#\s*)?updated\s*=.*?(?=\r?$)") UPDATED_LINE_RE = re.compile(r"(?m)^(?:#\s*)?updated\s*=.*?(?=\r?$)")
+1 -13
View File
@@ -12,7 +12,6 @@ from _schema import (
LIST_FIELDS, LIST_FIELDS,
SECTION_FIELDS, SECTION_FIELDS,
UPDATED_LINE_RE, UPDATED_LINE_RE,
URL_TERM_FIELDS,
VOCABULARY_FIELDS, VOCABULARY_FIELDS,
) )
@@ -118,18 +117,7 @@ def check_fields(
label = f"{table_name}.{field}" label = f"{table_name}.{field}"
if field in LIST_FIELDS: if field in LIST_FIELDS:
if check_string_list(table[field], label, path, validator) and field in URL_TERM_FIELDS: check_string_list(table[field], label, path, validator)
spaced_terms = [
term
for term in table[field]
if any(char.isspace() for char in term)
]
if spaced_terms:
validator.error(
path,
f"{label} doit utiliser des tirets à la place des espaces : "
+ ", ".join(repr(term) for term in spaced_terms),
)
else: else:
check_type(table[field], str, label, path, validator) check_type(table[field], str, label, path, validator)