Skip to content

Commit

Permalink
fix #1368 #1369: [CA] Support 'def-meta' and 'm' templates
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic authored and BoboTiG committed Sep 2, 2022
1 parent b727a88 commit 77cb802
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions tests/test_ca.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"-itzar",
[],
"",
["Del llatí <i>-izare</i>, provinent del grec antic <i>-ίζειν</i>."],
["Del llatí <i>-izare</i>, del grec antic <i>-ίζειν</i>."],
[
"Aplicat a un substantiu o adjectiu forma un verb que expressa la seva realització o convertir-se'n.", # noqa
"<i>Aplicat a un substantiu o adjectiu forma un verb que expressa la seva realització o convertir-se'n.</i>", # noqa
],
),
(
Expand Down Expand Up @@ -258,7 +258,6 @@ def test_parse_word(word, pronunciations, gender, etymology, definitions, page):
("{{pron|ca|/kənˈta/}}", "/kənˈta/"),
("{{pron|en|/əˈkrɔs/|/əˈkrɑs/}}", "/əˈkrɔs/, /əˈkrɑs/"),
("{{q|tenir bona planta}}", "<i>(tenir bona planta)</i>"),
("{{q|{{m}}}}", "<i>(m.)</i>"),
("{{sinònim|ca|aixecador}}", "<i>Sinònim de</i> <b>aixecador</b>"),
("{{etim-s|ca|XIV}}", "segle XIV"),
],
Expand Down
8 changes: 4 additions & 4 deletions wikidict/lang/ca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
templates_multi = {
# {{color|#E01010}}
"color": "color(parts[1])",
# {{def-meta|Utilitzat en l'expressió tros de quòniam.}}
"def-meta": "italic(parts[-1])",
# {{doblet|ca|Castellar}}
"doblet": "italic(parts[-1])",
# {{e|la|lupus}}
Expand Down Expand Up @@ -115,9 +117,7 @@
}

# Templates that will be completed/replaced using custom style.
templates_other = {
"m": "m.",
}
# templates_other = {}


def last_template_handler(
Expand Down Expand Up @@ -264,7 +264,7 @@ def value(word: str) -> str:
phrase = strong(phrase)
return phrase

if tpl in ("terme", "term", "calc"):
if tpl in ("m", "terme", "term", "calc"):
return f"{italic(parts[-1])}{parse_other_parameters()}"

if tpl == "trad":
Expand Down

0 comments on commit 77cb802

Please sign in to comment.