78 lines
1.9 KiB
Python
78 lines
1.9 KiB
Python
"""Schémas et règles structurelles communs aux scripts de fiches."""
|
|
|
|
import re
|
|
|
|
SECTION_ALIASES = {
|
|
"article": "articles",
|
|
"articles": "articles",
|
|
"grammaire": "grammaire",
|
|
"signe": "signes",
|
|
"signes": "signes",
|
|
"texte": "textes",
|
|
"textes": "textes",
|
|
"vocabulaire": "vocabulaire",
|
|
}
|
|
|
|
VOCABULARY_FIELDS = {
|
|
"nom": ("meaning", "logograms", "gender", "bound", "plural"),
|
|
"adjectif": (
|
|
"meaning",
|
|
"logograms",
|
|
"bound",
|
|
"feminine",
|
|
"masculine_plural",
|
|
"feminine_plural",
|
|
"predicative",
|
|
),
|
|
"verbe": (
|
|
"meaning",
|
|
"logograms",
|
|
"root",
|
|
"stem",
|
|
"verb_class",
|
|
"vowel_class",
|
|
"preterite",
|
|
"durative",
|
|
"perfect",
|
|
"imperative",
|
|
"participle",
|
|
"verbal_adjective",
|
|
),
|
|
"pronom": (
|
|
"meaning",
|
|
"logograms",
|
|
"pronoun_type",
|
|
"person",
|
|
"gender",
|
|
"number",
|
|
),
|
|
"préposition": ("meaning", "logograms", "governs"),
|
|
"adverbe": ("meaning", "logograms", "function"),
|
|
"conjonction": ("meaning", "logograms", "function"),
|
|
"particule": ("meaning", "logograms", "function"),
|
|
"numéral": (
|
|
"meaning",
|
|
"logograms",
|
|
"numeral_type",
|
|
"value",
|
|
"gender",
|
|
"feminine",
|
|
),
|
|
}
|
|
|
|
SECTION_FIELDS = {
|
|
"articles": {"extra": ("banner", "banner_alt", "banner_credit")},
|
|
"grammaire": {"taxonomies": ("themes",)},
|
|
"signes": {
|
|
"extra": ("sign", "mzl"),
|
|
"taxonomies": ("lectures",),
|
|
},
|
|
"textes": {"taxonomies": ("genres",)},
|
|
}
|
|
|
|
LIST_FIELDS = frozenset({"logograms", "lectures", "themes", "genres"})
|
|
URL_TERM_FIELDS = frozenset({"themes", "genres"})
|
|
|
|
CONTENT_SECTIONS = frozenset(SECTION_FIELDS) | {"vocabulaire"}
|
|
UPDATED_LINE_RE = re.compile(r"(?m)^(?:#\s*)?updated\s*=.*?(?=\r?$)")
|