Skip to content

Commit

Permalink
fix BoboTiG#672: support doute parameter in 'siècle' template. Suppor…
Browse files Browse the repository at this point in the history
…t 'litote' template
  • Loading branch information
lasconic committed Feb 4, 2021
1 parent afacfeb commit 5fd65f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions wikidict/lang/fr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
"jurisprudence": "Droit",
"just": "Justice",
"ling": "Linguistique",
"litote": "Par litote",
"litt": "Littéraire",
"locutions latines": "Latinisme",
"logi": "Logique",
Expand Down
6 changes: 4 additions & 2 deletions wikidict/lang/fr/template_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,10 @@ def render_siecle(tpl: str, parts: List[str], data: Dict[str, str]) -> str:
'<i>(1957)</i>'
>>> render_siecle("siècle", ["Vers le XI av. J.-C."], defaultdict(str))
'<i>(Vers le XI<sup>e</sup> siècle av. J.-C.)</i>'
>>> render_siecle("siècle", ["XVIII"], defaultdict(str, {"doute":"oui"}))
'<i>(XVIII<sup>e</sup> siècle ?)</i>'
"""
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 = [
Expand All @@ -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:
Expand Down

0 comments on commit 5fd65f8

Please sign in to comment.