From 5fd65f8c64d95e46a9f8897bb0d33a0da80e07f6 Mon Sep 17 00:00:00 2001 From: lasconic Date: Thu, 4 Feb 2021 22:11:41 +0100 Subject: [PATCH] =?UTF-8?q?fix=20#672:=20support=20doute=20parameter=20in?= =?UTF-8?q?=20'si=C3=A8cle'=20template.=20Support=20'litote'=20template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wikidict/lang/fr/__init__.py | 1 + wikidict/lang/fr/template_handlers.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wikidict/lang/fr/__init__.py b/wikidict/lang/fr/__init__.py index 2891dbc3e..4bef539c6 100644 --- a/wikidict/lang/fr/__init__.py +++ b/wikidict/lang/fr/__init__.py @@ -321,6 +321,7 @@ "jurisprudence": "Droit", "just": "Justice", "ling": "Linguistique", + "litote": "Par litote", "litt": "Littéraire", "locutions latines": "Latinisme", "logi": "Logique", diff --git a/wikidict/lang/fr/template_handlers.py b/wikidict/lang/fr/template_handlers.py index 43b0eb2aa..d090a640f 100644 --- a/wikidict/lang/fr/template_handlers.py +++ b/wikidict/lang/fr/template_handlers.py @@ -596,8 +596,10 @@ def render_siecle(tpl: str, parts: List[str], data: Dict[str, str]) -> str: '(1957)' >>> render_siecle("siècle", ["Vers le XI av. J.-C."], defaultdict(str)) '(Vers le XIe siècle av. J.-C.)' + >>> render_siecle("siècle", ["XVIII"], defaultdict(str, {"doute":"oui"})) + '(XVIIIe siècle ?)' """ - parts = [part for part in parts if part.strip() and part not in ("lang=fr", "?")] + parts = [part for part in parts if part.strip() and part != "?"] if not parts: return term("Siècle à préciser") parts = [ @@ -606,7 +608,7 @@ def render_siecle(tpl: str, parts: List[str], data: Dict[str, str]) -> str: ).strip() for part in parts ] - return term(" – ".join(parts)) + return term(" – ".join(parts) + (" ?" if data["doute"] else "")) def render_siecle2(tpl: str, parts: List[str], data: Dict[str, str]) -> str: