Repository: BoboTiG/ebook-reader-dict

Issue:
[EN] Full support for "ISO 639" template
(following #2104)

- Wiktionary page: https://en.wiktionary.org/wiki/ab

Wikicode:
```
{{ISO 639|1}}
```

Output:
```
ISO 639-1 code <b>1</b>
```

Expected:
```
(<i>international standards</i>) <i>ISO 639-1 for</b> <b>Abkhaz</b>.
```

---

Model link: https://en.wiktionary.org/wiki/Template:ISO_639/documentation


Discussion:

Patch:
diff --git a/wikidict/lang/ca/__init__.py b/wikidict/lang/ca/__init__.py
index f779d828..54bc7d83 100644
--- a/wikidict/lang/ca/__init__.py
+++ b/wikidict/lang/ca/__init__.py
@@ -261,7 +261,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     from .template_handlers import lookup_template, render_template
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     from .general import cal_apostrofar
 
diff --git a/wikidict/lang/ca/template_handlers.py b/wikidict/lang/ca/template_handlers.py
index ba94b4c3..c8fceebd 100644
--- a/wikidict/lang/ca/template_handlers.py
+++ b/wikidict/lang/ca/template_handlers.py
@@ -20,7 +20,7 @@ def parse_index_parameters(data: DefaultDict[str, str], i: int) -> str:
     return f" ({concat(toadd, ', ')})" if toadd else ""
 
 
-def render_comp(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_comp(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_comp("comp", ["ca", "cap", "vespre"], defaultdict(str))
     '<i>cap</i> i <i>vespre</i>'
@@ -100,7 +100,7 @@ def value(word: str, standalone: bool = False) -> str:
     return phrase
 
 
-def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_forma("forma-", ["augmentativa", "ca", "Candelera"], defaultdict(str))
     '<i>forma augmentativa de</i> <b>Candelera</b>'
@@ -129,7 +129,7 @@ def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return phrase
 
 
-def render_g(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_g(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_g("g", ["m"], defaultdict(str))
     'm.'
@@ -179,7 +179,7 @@ def render_g(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     )
 
 
-def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_label("marca", ["ca", "castells"], defaultdict(str))
     '<i>(argot casteller)</i>'
@@ -213,7 +213,7 @@ def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return term(res.strip())
 
 
-def render_sigles_de(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_sigles_de(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_sigles_de("sigles de", ["ca", "Organització del Tractat de l'Atlàntic Nord"], defaultdict(str))
     "<i>Sigles de</i> <b>Organització del Tractat de l'Atlàntic Nord</b>"
@@ -247,7 +247,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/de/__init__.py b/wikidict/lang/de/__init__.py
index c5662408..72443110 100644
--- a/wikidict/lang/de/__init__.py
+++ b/wikidict/lang/de/__init__.py
@@ -260,7 +260,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
         return italic(f"{markierung}{template[1] if len(template) > 1 else ''}")
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     # note: this should be used for variants only
     if template[0].startswith(
diff --git a/wikidict/lang/de/template_handlers.py b/wikidict/lang/de/template_handlers.py
index 819944c9..a6b1ac92 100644
--- a/wikidict/lang/de/template_handlers.py
+++ b/wikidict/lang/de/template_handlers.py
@@ -87,7 +87,7 @@
 }
 
 
-def render_bibel(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_bibel(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_bibel("Bibel", ["Mt", "1", "1"], defaultdict(str))
     'Matthäus 1,1'
@@ -105,7 +105,7 @@ def render_bibel(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return phrase
 
 
-def render_foreign_lang(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_foreign_lang(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_foreign_lang("Hebr", ["בַּיִת כְּנֶסֶת"], defaultdict(str))
     'בַּיִת כְּנֶסֶת'
@@ -151,7 +151,7 @@ def render_foreign_lang(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_foreign_lang_simple(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_foreign_lang_simple(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_foreign_lang_simple("Arab", ["أَحْمَدُ بْنُ حَنْبَلٍ"], defaultdict(str))
     'أَحْمَدُ بْنُ حَنْبَلٍ'
@@ -228,7 +228,7 @@ def render_foreign_lang_simple(tpl: str, parts: List[str], data: DefaultDict[str
 )
 
 
-def render_K(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_K(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_K("K", ["Sport"], defaultdict(str))
     '<i>Sport:</i>'
@@ -281,7 +281,7 @@ def render_K(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return italic(f"{phrase}{ft}:")
 
 
-def render_ref_dejure(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_ref_dejure(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_ref_dejure("Ref-dejure", ["", "54", "InsO"], defaultdict(str))
     '54 InsO'
@@ -337,7 +337,7 @@ def render_ref_dejure(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
             assert 0, parts
 
 
-def render_Ut(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_Ut(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_Ut("Üt", ["grc", "διάλογος", "diálogos"], defaultdict(str))
     '<i>διάλογος (diálogos)</i>'
@@ -351,7 +351,7 @@ def render_Ut(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return italic(phrase)
 
 
-def render_Uxx4(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_Uxx4(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_Uxx4("Üxx4", ["ar", "مسجد"], defaultdict(str, {"v":"مَسْجِد", "d":"masğid", "b":"Moschee"}))
     'مَسْجِد (DMG: masğid) ‚Moschee‘'
@@ -390,7 +390,7 @@ def render_Uxx4(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_Uxx5(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_Uxx5(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_Uxx5("Üxx5", ["grc", "anḗr, andrós", "ἀνήρ, ἀνδρός", "ἀνήρ"], defaultdict(str))
     'ἀνήρ, ἀνδρός (anḗr, andrós)'
@@ -419,7 +419,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/defaults.py b/wikidict/lang/defaults.py
index dc0bb9bf..b34f36e5 100644
--- a/wikidict/lang/defaults.py
+++ b/wikidict/lang/defaults.py
@@ -104,7 +104,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     return f"{OPEN_DOUBLE_CURLY}{tpl}{CLOSE_DOUBLE_CURLY}" if tpl else ""
 
 
-def render_wikilink(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_wikilink(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_wikilink("w", [], defaultdict(str))
     ''
diff --git a/wikidict/lang/en/__init__.py b/wikidict/lang/en/__init__.py
index 6a4c604a..13452d3c 100644
--- a/wikidict/lang/en/__init__.py
+++ b/wikidict/lang/en/__init__.py
@@ -340,7 +340,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     )
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     tpl, *parts = template
     data = extract_keywords_from(parts)
diff --git a/wikidict/lang/en/template_handlers.py b/wikidict/lang/en/template_handlers.py
index 37f2fa6b..94bda682 100644
--- a/wikidict/lang/en/template_handlers.py
+++ b/wikidict/lang/en/template_handlers.py
@@ -85,7 +85,7 @@ def gloss_tr_poss(data: DefaultDict[str, str], gloss: str, trans: str = "") -> s
     return phrase
 
 
-def misc_variant(start: str, tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def misc_variant(start: str, tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     if parts:
         parts.pop(0)  # Remove the language
     p = data["alt"] or data["2"] or (parts.pop(0) if parts else "") or ""
@@ -99,13 +99,13 @@ def misc_variant(start: str, tpl: str, parts: List[str], data: DefaultDict[str,
     return phrase
 
 
-def misc_variant_no_term(title: str, tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def misc_variant_no_term(title: str, tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     if data["notext"] in ("1", "yes"):
         return ""
     return data.get("title", title if data["nocap"] in ("1", "yes") else capitalize(title))
 
 
-def render_bce(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_bce(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_bce("B.C.E.", [], defaultdict(str))
     '<small>B.C.E.</small>'
@@ -119,7 +119,7 @@ def render_bce(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return small(text.replace(".", "")) if nodot else small(text)
 
 
-def render_century(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_century(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_century("century", ["17"], defaultdict(str))
     '<small>[from 17th c.]</small>'
@@ -153,7 +153,7 @@ def ordinal(n: str) -> str:
     return small(f"[{phrase}]")
 
 
-def render_clipping(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_clipping(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_clipping("clipping", ["en", "automobile"], defaultdict(str))
     'Clipping of <i>automobile</i>'
@@ -162,10 +162,10 @@ def render_clipping(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     >>> render_clipping("clipping", ["ru", "ку́бовый краси́тель"], defaultdict(str, {"t": "vat dye", "nocap": "1"}))
     'clipping of <i>ку́бовый краси́тель</i> (“vat dye”)'
     """
-    return misc_variant("clipping", tpl, parts, data)
+    return misc_variant("clipping", tpl, parts, data, word=word)
 
 
-def render_coinage(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_coinage(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_coinage("coin", ["en", "Josiah Willard Gibbs"], defaultdict(str))
     'Coined by Josiah Willard Gibbs'
@@ -196,11 +196,11 @@ def render_coinage(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_contraction(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
-    return misc_variant("contraction", tpl, parts, data)
+def render_contraction(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
+    return misc_variant("contraction", tpl, parts, data, word=word)
 
 
-def render_dating(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_dating(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_dating("ante", ["1880"], defaultdict(str))
     '<i>a.</i> <b>1880</b>,'
@@ -216,7 +216,7 @@ def render_dating(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
     return f"{italic(init)} {strong(start)}" + (f" {end}" if end else "") + ","
 
 
-def render_etydate(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_etydate(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_etydate("etydate", ["1880"], defaultdict(str))
     'First attested in 1880.'
@@ -274,7 +274,7 @@ def render_etydate_l2(parts: List[str]) -> str:
     return phrase
 
 
-def render_foreign_derivation(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_foreign_derivation(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_foreign_derivation("bor", ["en", "ar", "الْعِرَاق", "", "Iraq"], defaultdict(str))
     'Arabic <i>الْعِرَاق</i> (<i>ālʿrāq</i>, “Iraq”)'
@@ -478,7 +478,7 @@ def render_foreign_derivation(tpl: str, parts: List[str], data: DefaultDict[str,
     return phrase.lstrip()
 
 
-def render_frac(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_frac(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_frac("frac", ["39", "47", "127"], defaultdict(str))
     '39<small><sup>47</sup><big>⁄</big><sub>127</sub></small>'
@@ -497,7 +497,7 @@ def render_frac(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_given_name(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_given_name(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_given_name("given name", ["en" , "male"], defaultdict(str))
     '<i>A male given name</i>'
@@ -630,7 +630,7 @@ class Seg(TypedDict, total=False):
     return italic(phrase)
 
 
-def render_historical_given_name(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_historical_given_name(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_historical_given_name("historical given name", ["en" , "male", "Saint Abundius, an early Christian bishop"], defaultdict(str, {}))
     '<i>A male given name of historical usage, notably borne by Saint Abundius, an early Christian bishop</i>'
@@ -651,7 +651,7 @@ def render_historical_given_name(tpl: str, parts: List[str], data: DefaultDict[s
     return italic(phrase)
 
 
-def render_ipa_char(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_ipa_char(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_ipa_char("historical given name", ["[tʃ]"], defaultdict(str, {}))
     '[tʃ]'
@@ -661,7 +661,7 @@ def render_ipa_char(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return concat(parts, ", ")
 
 
-def render_iso_639(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_iso_639(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_iso_639("ISO 639", ["ja"], defaultdict(str, {}))
     'ISO 639-1 code <b>ja</b>'
@@ -671,7 +671,14 @@ def render_iso_639(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     'ISO 639-3 code <b>zho</b>'
     >>> render_iso_639("ISO 639", ["zh", "", "zho"], defaultdict(str, {"ref": "1"}))
     'ISO 639-1 code <b>zh</b>, ISO 639-3 code <b>zho</b>'
+    >>> render_iso_639("{{ISO 639|3|}}", ["3", "Ambonese Malay"], defaultdict(str, {}))
+    '(<i>international standards</i>) <i>ISO 639-3 language code for</i> <b>Ambonese Malay</b>.'
+    >>> render_iso_639("{{ISO 639|3|}}", ["1"], defaultdict(str, {}), word="ab")
+    '(<i>international standards</i>) <i>ISO 639-1 language code for</i> <b>Abkhaz</b>.'
     """
+    if parts[0].isdigit():
+        return f"({italic('international standards')}) {italic('ISO 639-' + parts[0] + ' language code for')} {strong(parts[1] if len(parts) == 2 else langs[word])}."
+
     codes = []
     for idx, part in enumerate(parts, 1):
         if part:
@@ -679,7 +686,7 @@ def render_iso_639(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return ", ".join(codes)
 
 
-def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_label("label", ["en" , "Australia", "slang"], defaultdict(str, {"nocat":"1"}))
     '<i>(Australia, slang)</i>'
@@ -733,7 +740,7 @@ def render_label(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return term(res)
 
 
-def render_lit(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lit(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lit("&lit", ["en", "foo", "bar"], defaultdict(str, {"nodot":"1"}))
     '<i>Used other than figuratively or idiomatically:</i> see <i>foo, bar</i>'
@@ -766,7 +773,7 @@ def render_lit(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_morphology(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_morphology(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_morphology("affix", ["en"], defaultdict(str, {"alt1":"tisa-","pos1":"unique name","alt2":"-gen-", "t2": "transfer of genetic material (transduced)", "alt3":"-lec-", "t3":"selection and enrichment manipulation", "alt4":"-leu-", "t4":"leukocytes", "alt5":"-cel", "t5":"cellular therapy"}))
     '<i>tisa-</i> (unique name)&nbsp;+&nbsp;<i>-gen-</i> (“transfer of genetic material (transduced)”)&nbsp;+&nbsp;<i>-lec-</i> (“selection and enrichment manipulation”)&nbsp;+&nbsp;<i>-leu-</i> (“leukocytes”)&nbsp;+&nbsp;<i>-cel</i> (“cellular therapy”)'
@@ -932,7 +939,7 @@ def add_dash(tpl: str, index: int, parts_count: int, chunk: str) -> str:
     return phrase
 
 
-def render_named_after(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_named_after(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_named_after("named-after", ["en", "Pierre Bézier"], defaultdict(str, {"nationality":"French", "occupation":"Renault engineer", "nocap":"1"}))
     'named after French Renault engineer Pierre Bézier'
@@ -966,7 +973,7 @@ def render_named_after(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_nb(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_nb(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_nb("...", [], defaultdict(str))
     ' […] '
@@ -995,7 +1002,7 @@ def render_nb(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return f"{phrase}]{sep if tpl == '...' else ''}"
 
 
-def render_nuclide(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_nuclide(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_nuclide("nuclide", ["2", "1", "H"], defaultdict(str))
     '<sup>2</sup><sub style="margin-left:-1ex;">1</sub>H'
@@ -1016,7 +1023,7 @@ def render_nuclide(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_onomatopoeic(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_onomatopoeic(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_onomatopoeic("onom", ["en"], defaultdict(str))
     'Onomatopoeic'
@@ -1027,10 +1034,10 @@ def render_onomatopoeic(tpl: str, parts: List[str], data: DefaultDict[str, str])
     >>> render_onomatopoeic("onom", ["en"], defaultdict(str, {"notext": "1"}))
     ''
     """
-    return misc_variant_no_term("onomatopoeic", tpl, parts, data)
+    return misc_variant_no_term("onomatopoeic", tpl, parts, data, word=word)
 
 
-def render_pedlink(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_pedlink(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_pedlink("pedlink", ["foo"], defaultdict(str))
     'foo'
@@ -1040,7 +1047,7 @@ def render_pedlink(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return data["disp"] or parts[0]
 
 
-def render_place(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_place(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_place("place", ["en", "A country in the Middle East"], defaultdict(str))
     'A country in the Middle East'
@@ -1141,7 +1148,7 @@ def render_place(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return capitalize(phrase)
 
 
-def render_si_unit(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_si_unit(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_si_unit("SI-unit", ["en", "peta", "second", "time"], defaultdict(str))
     '(<i>metrology</i>) An SI unit of time equal to 10<sup>15</sup> seconds. Symbol: Ps'
@@ -1165,7 +1172,7 @@ def render_si_unit(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_si_unit_2(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_si_unit_2(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_si_unit_2("SI-unit-2", ["peta", "meter", "length", "metre"], defaultdict(str))
     '(<i>metrology</i>) An SI unit of length equal to 10<sup>15</sup> meters; alternative spelling of <i>petametre</i>.'
@@ -1178,7 +1185,7 @@ def render_si_unit_2(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return f"({italic('metrology')}) An SI unit of {category} equal to 10{superscript(exp)} {unit}s; alternative spelling of {italic(prefix+alt)}."  # noqa
 
 
-def render_si_unit_abb(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_si_unit_abb(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_si_unit_abb("SI-unit-abb", ["femto", "mole", "amount of substance"], defaultdict(str))
     '(<i>metrology</i>) <i>Symbol for</i> <b>femtomole</b>, an SI unit of amount of substance equal to 10<sup>-15</sup> moles'
@@ -1190,7 +1197,7 @@ def render_si_unit_abb(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return f"({italic('metrology')}) {italic('Symbol for')} {strong(prefix+unit)}, an SI unit of {category} equal to 10{superscript(exp)} {unit}s"  # noqa
 
 
-def render_surface_analysis(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_surface_analysis(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_surface_analysis("surf", ["en", "ignore", "-ance"], defaultdict(str))
     'By surface analysis, <i>ignore</i>&nbsp;+&nbsp;<i>-ance</i>'
@@ -1200,7 +1207,7 @@ def render_surface_analysis(tpl: str, parts: List[str], data: DefaultDict[str, s
     return phrase
 
 
-def render_surname(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_surname(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_surname("surname", ["en"], defaultdict(str))
     '<i>A surname</i>'
@@ -1259,7 +1266,7 @@ def render_surname(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return italic(f"{art} {parts[0]} {tpl}{from_text}") if parts and parts[0] else italic(f"{art} {tpl}{from_text}")
 
 
-def render_uncertain(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_uncertain(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_uncertain("unc", ["en"], defaultdict(str))
     'Uncertain'
@@ -1268,10 +1275,10 @@ def render_uncertain(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     >>> render_uncertain("uncertain", ["en"], defaultdict(str, {"title": "Not certain"}))
     'Not certain'
     """
-    return misc_variant_no_term("uncertain", tpl, parts, data)
+    return misc_variant_no_term("uncertain", tpl, parts, data, word=word)
 
 
-def render_unknown(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_unknown(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_unknown("unk", ["en"], defaultdict(str, { "notext":"1", "nocap":"1"}))
     ''
@@ -1292,7 +1299,7 @@ def render_unknown(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
         return "Unknown"
 
 
-def render_vern(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_vern(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_vern("vern", ["Pacific cod"], defaultdict(str))
     'Pacific cod'
@@ -1435,7 +1442,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/es/__init__.py b/wikidict/lang/es/__init__.py
index 3b68e450..252a97a2 100644
--- a/wikidict/lang/es/__init__.py
+++ b/wikidict/lang/es/__init__.py
@@ -290,7 +290,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     from .template_handlers import lookup_template, render_template
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     if should_lower_next_templates := template[0] == "csem":
         template = template[1:]
diff --git a/wikidict/lang/es/template_handlers.py b/wikidict/lang/es/template_handlers.py
index a60ff5ba..c45374e9 100644
--- a/wikidict/lang/es/template_handlers.py
+++ b/wikidict/lang/es/template_handlers.py
@@ -61,7 +61,7 @@ def normalizar_nombre(to_normalize: str) -> str:
     return langs.get(to_normalize, to_normalize)
 
 
-def render_adjetivo_de_verbo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_adjetivo_de_verbo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_adjetivo_de_verbo("adjetivo de verbo", ["gorjear", "gorjea"], defaultdict(str))
     'Que gorjea'
@@ -76,7 +76,7 @@ def render_adjetivo_de_verbo(tpl: str, parts: List[str], data: DefaultDict[str,
     return result
 
 
-def render_nimo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_nimo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_nimo("antónimo", ["estatal", "público"], defaultdict(str))
     'Antónimos: estatal, público'
@@ -95,7 +95,7 @@ def render_nimo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return result
 
 
-def render_afi(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_afi(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_afi("AFI", ["/oː/", "/aː/"], defaultdict(str))
     '/oː/, /aː/ <small>(AFI)</small>'
@@ -105,7 +105,7 @@ def render_afi(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return concat(parts, ", ") + f' {small("(AFI)")}'
 
 
-def render_aumentativo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_aumentativo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_aumentativo("aumentativo", ["perro"], defaultdict(str))
     '<i>Aumentativo de</i> perro'
@@ -130,7 +130,7 @@ def render_aumentativo(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_adverbio_de_adjetivo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_adverbio_de_adjetivo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_adverbio_de_adjetivo("adverbio_de_adjetivo", ["accidental"], defaultdict(str))
     'De un modo accidental'
@@ -146,7 +146,7 @@ def render_adverbio_de_adjetivo(tpl: str, parts: List[str], data: DefaultDict[st
     return result
 
 
-def render_adverbio_de_sustantivo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_adverbio_de_sustantivo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_adverbio_de_sustantivo("adverbio de sustantivo", ["escabrosidad"], defaultdict(str))
     'Con escabrosidad'
@@ -158,7 +158,7 @@ def render_adverbio_de_sustantivo(tpl: str, parts: List[str], data: DefaultDict[
     return result
 
 
-def render_comparativo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_comparativo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_comparativo("comparativo", ["bueno", "es"], defaultdict(str, {"irr": "s"}))
     '<i>Comparativo irregular de</i> bueno'
@@ -177,7 +177,7 @@ def render_comparativo(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_contraccion(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_contraccion(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_contraccion("contracción", ["de", "ellas"], defaultdict(str, {"leng": "es"}))
     '<i>Contracción de</i> de <i>y</i> ellas'
@@ -197,7 +197,7 @@ def render_contraccion(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_etim(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_etim(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_etim("etim", ["la", "folia"], defaultdict(str))
     'del latín <i>folia</i>'
@@ -229,7 +229,7 @@ def render_etim(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return result
 
 
-def render_etimologia(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_etimologia(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_etimologia("etimología", [], defaultdict(str))
     ''
@@ -519,7 +519,7 @@ def call_l_single_part(part: str, index: int) -> str:
     return phrase
 
 
-def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_forma("forma", ["-acho", "Forma del femenino de"], defaultdict(str))
     '<i>Forma del femenino de</i> -acho'
@@ -545,7 +545,7 @@ def render_forma(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return phrase
 
 
-def render_gentilicio(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_gentilicio(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_gentilicio("gentilicio", ["Alemania"], defaultdict(str))
     'Originario, relativo a, o propio de Alemania'
@@ -555,7 +555,7 @@ def render_gentilicio(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return f"Originario, relativo a, o propio {'del' if data['contracción'] else 'de'} {parts[0]}"
 
 
-def render_gentilicio2(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_gentilicio2(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_gentilicio2("gentilicio2", ["Alemania"], defaultdict(str))
     'Persona originaria de Alemania'
@@ -565,7 +565,7 @@ def render_gentilicio2(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return f"Persona originaria {data['contracción'] or 'de'} {parts[0]}"
 
 
-def render_gentilicio3(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_gentilicio3(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_gentilicio3("gentilicio3", ["Alemania"], defaultdict(str))
     'Mujer originaria de Alemania'
@@ -575,7 +575,7 @@ def render_gentilicio3(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return f"Mujer {data['adjetivo'] or 'originaria'} {data['contracción'] or 'de'} {parts[0]}"
 
 
-def render_grafia(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_grafia(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_grafia("grafía", ["psicológico"], defaultdict(str))
     '<i>Grafía alternativa de</i> psicológico'
@@ -608,7 +608,7 @@ def render_grafia(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
     return phrase
 
 
-def render_hipocoristico(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_hipocoristico(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_hipocoristico("hipocorístico", ["Antonio"], defaultdict(str))
     '<i>Hipocorístico de</i> Antonio'
@@ -621,7 +621,7 @@ def render_hipocoristico(tpl: str, parts: List[str], data: DefaultDict[str, str]
     return phrase
 
 
-def render_l(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_l(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_l("l+", ["la", "impello", "impellō, impellere"], defaultdict(str, {"glosa":"empujar"}))
     '<i>impellō, impellere</i> ("empujar")'
@@ -654,7 +654,7 @@ def render_l(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_prep_conj(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_prep_conj(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_prep_conj("preposición conjugada", ["con", "primera", "singular"], defaultdict(str))
     '<i>Forma combinada de la preposición</i> con <i>y el pronombre personal de primera persona singular</i>'
@@ -670,7 +670,7 @@ def render_prep_conj(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     )
 
 
-def render_superlativo(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_superlativo(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_superlativo("superlativo", ["abundante"], defaultdict(str))
     '<i>Superlativo de</i> abundante:&nbsp;sumamente abundante'
@@ -704,7 +704,7 @@ def render_superlativo(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_sustantivo_de(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_sustantivo_de(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_sustantivo_de("sustantivo de verbo", ["circular"], defaultdict(str))
     'Acción o efecto de circular'
@@ -740,7 +740,7 @@ def render_sustantivo_de(tpl: str, parts: List[str], data: DefaultDict[str, str]
     return phrase
 
 
-def render_variante(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_variante(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_variante("variante", ["atiesar"], defaultdict(str))
     '<i>Variante de</i> atiesar'
@@ -751,7 +751,7 @@ def render_variante(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return f"{italic(capitalize(sentence))} " + render_l("l", [parts[0]], data)
 
 
-def render_variantes(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_variantes(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_variantes("variantes", ["acrótera", "acroteria"], defaultdict(str))
     '<b>Variantes:</b> acrótera, acroteria'
@@ -822,7 +822,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/fr/__init__.py b/wikidict/lang/fr/__init__.py
index d2223910..2aacd897 100644
--- a/wikidict/lang/fr/__init__.py
+++ b/wikidict/lang/fr/__init__.py
@@ -993,7 +993,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     from .template_handlers import lookup_template, render_template
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     tpl, *parts = template
     data = extract_keywords_from(parts)
diff --git a/wikidict/lang/fr/template_handlers.py b/wikidict/lang/fr/template_handlers.py
index 5195110f..a86a7ad4 100644
--- a/wikidict/lang/fr/template_handlers.py
+++ b/wikidict/lang/fr/template_handlers.py
@@ -29,7 +29,7 @@ def word_tr_sens(w: str, tr: str, sens: str, use_italic: bool = True) -> str:
     return r
 
 
-def render_1e_attestation(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_1e_attestation(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_1e_attestation("1e attestation", [], defaultdict(str, {"date": "1950", "titre": "Les Hirondelles", "lang": "fr"}))
     '<i>(1950)</i> Attesté dans <i>Les Hirondelles</i>'
@@ -47,7 +47,7 @@ def render_1e_attestation(tpl: str, parts: List[str], data: DefaultDict[str, str
     return phrase
 
 
-def render_2e(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_2e(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_2e("2e", [], defaultdict(str))
     '2<sup>e</sup>'
@@ -65,7 +65,7 @@ def render_2e(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_abreviation(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_abreviation(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_abreviation("abréviation", [], defaultdict(str))
     '<i>(Abréviation)</i>'
@@ -95,7 +95,7 @@ def render_abreviation(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_acronyme(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_acronyme(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_acronyme("acronyme", ["fr"], defaultdict(str))
     '<i>(Acronyme)</i>'
@@ -109,7 +109,7 @@ def render_acronyme(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return italic("(Acronyme)")
 
 
-def render_modele_etym(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_modele_etym(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_modele_etym("agglutination", [], defaultdict(str, {"m":"1"}))
     'Agglutination'
@@ -167,7 +167,7 @@ def render_modele_etym(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_apherese(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_apherese(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     render aphérèse and apocope
 
@@ -196,7 +196,7 @@ def render_apherese(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return phrase
 
 
-def render_argot(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_argot(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_argot("argot", ["fr"], defaultdict(str))
     '<i>(Argot)</i>'
@@ -213,7 +213,7 @@ def render_argot(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return term(phrase)
 
 
-def render_au_masculin(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_au_masculin(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_au_masculin("au masculin", [], defaultdict(str))
     '<i>(Au masculin)</i>'
@@ -231,7 +231,7 @@ def render_au_masculin(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return term(phrase)
 
 
-def render_cf(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_cf(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_cf("cf", [], defaultdict(str))
     '→ voir'
@@ -260,7 +260,7 @@ def render_cf(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_cit_ref(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_cit_ref(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_cit_ref("cit_réf", ["Dictionnaire quelconque", "2007"], defaultdict(str))
     '<i>Dictionnaire quelconque</i>, 2007'
@@ -304,7 +304,7 @@ def render_cit_ref(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_contexte(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_contexte(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_contexte("C", [], defaultdict(str))
     '(Pas de contexte)'
@@ -326,7 +326,7 @@ def render_contexte(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return term(capitalize(", ".join(parts)) + spec)
 
 
-def render_compose_de(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_compose_de(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_compose_de("composé de", ["longus", "aevum"], defaultdict(str, {"lang":"la"}))
     'composé de <i>longus</i> et de <i>aevum</i>'
@@ -441,7 +441,7 @@ def render_compose_de(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return phrase
 
 
-def render_date(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_date(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_date("date", [""], defaultdict(str))
     '<i>(Date à préciser)</i>'
@@ -460,7 +460,7 @@ def render_date(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return term(capitalize(date))
 
 
-def render_equiv_pour(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_equiv_pour(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_equiv_pour("équiv-pour", ["un homme", "maître"], defaultdict(str))
     '<i>(pour un homme, on dit</i>&nbsp: maître<i>)</i>'
@@ -489,7 +489,7 @@ def render_equiv_pour(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return phrase
 
 
-def render_etyl(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_etyl(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_etyl("calque", ["la", "fr"], defaultdict(str))
     'latin'
@@ -562,7 +562,7 @@ def render_etyl(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_ko_pron(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_ko_pron(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_ko_pron("ko-pron", ["서울"], defaultdict(str))
     '[sʌ.uɭ]'
@@ -661,7 +661,7 @@ def render_ko_pron(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return f"/{phrase}/" if data["phon"] else f"[{phrase}]"
 
 
-def render_la_verb(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_la_verb(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_la_verb("la-verb", ["amō", "amare", "amāre", "amavi", "amāvi", "amatum", "amātum"], defaultdict(str))
     '<b>amō</b>, <i>infinitif</i> : amāre, <i>parfait</i> : amāvi, <i>supin</i> : amātum'
@@ -687,7 +687,7 @@ def render_la_verb(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_lae(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lae(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lae("laé", ["fr", "adv"], defaultdict(str))
     '<i>(Adverbe)</i>'
@@ -737,7 +737,7 @@ def render_lae(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return term(phrase)
 
 
-def render_lang(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lang(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lang("Lang", ["la", "sine qua non"], defaultdict(str, {"sens": "sans quoi non"}))
     '<i>sine qua non</i> («&nbsp;sans quoi non&nbsp;»)'
@@ -749,7 +749,7 @@ def render_lang(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return word_tr_sens(texte, tr, sens)
 
 
-def render_lien(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lien(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lien("l", ["dies Lunae", "la"], defaultdict(str))
     'dies Lunae'
@@ -772,7 +772,7 @@ def render_lien(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_lien_rouge(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lien_rouge(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lien_rouge("LienRouge", [], defaultdict(str, {"fr":"Comité", "trad":"United Nations", "texte":"COPUOS"}))
     '<i>COPUOS</i>'
@@ -801,7 +801,7 @@ def render_lien_rouge(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return res
 
 
-def render_lien_web(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lien_web(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lien_web("Lien web", [], defaultdict(str, {"titre":"The Weasel-Lobster Race"}))
     '<i>The Weasel-Lobster Race</i>'
@@ -859,7 +859,7 @@ def render_lien_web(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return phrase
 
 
-def render_mot_valise(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_mot_valise(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_mot_valise("mot-valise", ["fr"], defaultdict(str, {"m":"1"}))
     'Mot-valise'
@@ -885,7 +885,7 @@ def render_mot_valise(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return phrase
 
 
-def render_mn_lien(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_mn_lien(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_mn_lien("mn-lien", ["далай", "dalai", "ᠲᠠᠯᠠᠢ"], defaultdict(str))
     'далай (MNS : <i>dalai</i>), ᠲᠠᠯᠠᠢ'
@@ -900,7 +900,7 @@ def render_mn_lien(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return phrase
 
 
-def render_nom_langue(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_nom_langue(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_nom_langue("nom_langue", ["ky"], defaultdict(str))
     'kirghiz'
@@ -908,7 +908,7 @@ def render_nom_langue(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return langs.get(parts[0], parts[0])
 
 
-def render_polytonique(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_polytonique(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_polytonique("polytonique", ["μηρóς", "mêrós", "cuisse"], defaultdict(str))
     'μηρóς, <i>mêrós</i> («&nbsp;cuisse&nbsp;»)'
@@ -931,7 +931,7 @@ def render_polytonique(tpl: str, parts: List[str], data: DefaultDict[str, str])
     return phrase
 
 
-def render_recons(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_recons(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_recons("recons", ["maruos"], defaultdict(str))
     '*<i>maruos</i>'
@@ -950,7 +950,7 @@ def render_recons(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
     return f"*{phrase}"
 
 
-def render_refnec(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_refnec(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_refnec("recons", [], defaultdict(str, {"lang": "fr"}))
     ''
@@ -960,7 +960,7 @@ def render_refnec(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
     return underline(parts[0]) if parts else ""
 
 
-def render_siecle(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_siecle(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_siecle("siècle", [], defaultdict(str))
     '<i>(Siècle à préciser)</i>'
@@ -1000,7 +1000,7 @@ def repl(x: Match[str]) -> str:
     return term(" – ".join(parts) + (" ?" if data["doute"] else ""))
 
 
-def render_siecle2(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_siecle2(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_siecle2("siècle2", ["1"], defaultdict(str))
     "<span style='font-variant:small-caps'>i</span><sup>er</sup>"
@@ -1021,7 +1021,7 @@ def render_siecle2(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return f"{number_string}{superscript(suffix)}"
 
 
-def render_sigle(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_sigle(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_sigle("sigle", ["fr"], defaultdict(str))
     '<i>(Sigle)</i>'
@@ -1040,7 +1040,7 @@ def render_sigle(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return phrase
 
 
-def render_suisse(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_suisse(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_suisse("Suisse", ["fr"], defaultdict(str, {"précision":"Fribourg, Valais, Vaud"}))
     '<i>(Suisse : Fribourg, Valais, Vaud)</i>'
@@ -1053,7 +1053,7 @@ def render_suisse(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
         return term("Suisse")
 
 
-def render_suppletion(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_suppletion(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_suppletion("supplétion", ["aller"], defaultdict(str))
     'Cette forme dénote une supplétion car son étymologie est distincte de celle de <i>aller</i>'
@@ -1077,7 +1077,7 @@ def render_suppletion(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return phrase
 
 
-def render_t(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_t(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_t("T", ["oc"], defaultdict(str))
     'Occitan'
@@ -1088,7 +1088,7 @@ def render_t(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return capitalize(langs[lang]) if lang in langs else lang
 
 
-def render_temps_geologiques(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_temps_geologiques(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_temps_geologiques("Temps géologiques", ["givétien"], defaultdict(str))
     '387,7 ± 0,8'
@@ -1100,7 +1100,7 @@ def render_temps_geologiques(tpl: str, parts: List[str], data: DefaultDict[str,
     return times[parts[0]]
 
 
-def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_term("term", ["ne … guère que"], defaultdict(str))
     '<i>(Ne … guère que)</i>'
@@ -1114,7 +1114,7 @@ def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return term(capitalize(data["libellé"] or data["1"] or parts[0]))
 
 
-def render_transitif(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_transitif(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_transitif("transitif+", ["fr"], defaultdict(str, {"a1": "de"}))
     '<i>(Transitif avec le complément d’objet introduit par </i><b>de</b><i>)</i>'
@@ -1129,7 +1129,7 @@ def render_transitif(tpl: str, parts: List[str], data: DefaultDict[str, str]) ->
     return f"{italic(phrase)}{strong(complement)}{italic(')')}"
 
 
-def render_unite(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_unite(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_unite("unité", ["1234567"], defaultdict(str, {}))
     '1 234 567'
@@ -1199,7 +1199,7 @@ def render_unite(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str
     return phrase
 
 
-def render_variante_ortho(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_variante_ortho(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_variante_ortho("Variante de", ["acupuncture", "fr"], defaultdict(str))
     '<i>Variante de</i> acupuncture'
@@ -1222,7 +1222,7 @@ def render_variante_ortho(tpl: str, parts: List[str], data: DefaultDict[str, str
     return phrase
 
 
-def render_wikisource(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_wikisource(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_wikisource("ws", ["Les Grenouilles qui demandent un Roi"], defaultdict(str))
     'Les Grenouilles qui demandent un Roi'
@@ -1241,7 +1241,7 @@ def render_wikisource(tpl: str, parts: List[str], data: DefaultDict[str, str]) -
     return phrase
 
 
-def render_zh_lien(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_zh_lien(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_zh_lien("zh-lien", ["人", "rén"], defaultdict(str))
     '人 (<i>rén</i>)'
@@ -1349,7 +1349,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/no/__init__.py b/wikidict/lang/no/__init__.py
index cacb5bf9..8f70b930 100644
--- a/wikidict/lang/no/__init__.py
+++ b/wikidict/lang/no/__init__.py
@@ -186,7 +186,7 @@ def last_template_handler(template: tuple[str, ...], locale: str, word: str = ""
     from .template_handlers import lookup_template, render_template
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     tpl, *parts = template
     extract_keywords_from(parts)
diff --git a/wikidict/lang/no/template_handlers.py b/wikidict/lang/no/template_handlers.py
index 9875ddea..af84ee08 100644
--- a/wikidict/lang/no/template_handlers.py
+++ b/wikidict/lang/no/template_handlers.py
@@ -9,7 +9,7 @@
 from .langs import langs
 
 
-def render_avledet(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_avledet(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_avledet("avledet", ["gml", "no", "abbedie"], defaultdict(str))
     'middelnedertysk <i>abbedie</i>'
@@ -19,7 +19,7 @@ def render_avledet(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> s
     return f"{langs.get(parts[0], parts[0])} {italic(parts[2])}"
 
 
-def render_lant(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_lant(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_lant("lånt", ["en", "no", "latte"], defaultdict(str))
     'engelsk <i>latte</i>'
@@ -46,7 +46,7 @@ def render_lant(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_sammensetning(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_sammensetning(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_sammensetning("sammensetning", ["bonde", "vett"], defaultdict(str))
     '<i>bonde</i> + <i>vett</i>'
@@ -65,7 +65,7 @@ def render_sammensetning(tpl: str, parts: List[str], data: DefaultDict[str, str]
     return concat(phrase_parts, " + ")
 
 
-def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_term("term", ["ord"], defaultdict(str))
     '<i>ord</i>'
@@ -104,7 +104,7 @@ def render_term(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return phrase
 
 
-def render_ursprak(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def render_ursprak(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     """
     >>> render_ursprak("proto", ["indoeuropeisk", "klek-", "", "kleg-", "å rope/skrike"], defaultdict(str))
     'urindoeuropeisk *klek-, *kleg- («å rope/skrike»)'
@@ -140,7 +140,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)
diff --git a/wikidict/lang/ru/__init__.py b/wikidict/lang/ru/__init__.py
index 345b4661..acda4453 100644
--- a/wikidict/lang/ru/__init__.py
+++ b/wikidict/lang/ru/__init__.py
@@ -84,7 +84,7 @@ def last_template_handler(template: Tuple[str, ...], locale: str, word: str = ""
     from .template_handlers import lookup_template, render_template
 
     if lookup_template(template[0]):
-        return render_template(template)
+        return render_template(word, template)
 
     tpl, *parts = template
 
diff --git a/wikidict/lang/ru/template_handlers.py b/wikidict/lang/ru/template_handlers.py
index ab99bc0b..7d5a28a7 100644
--- a/wikidict/lang/ru/template_handlers.py
+++ b/wikidict/lang/ru/template_handlers.py
@@ -8,7 +8,7 @@
 
 
 # for etymology content, need to run code to get text from other wiktionary page
-def get_etymology(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def get_etymology(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     # Fetching that endpoint for 1.3+ milion of words is not a solution, skipping for now.
     return ""
     if not parts or not (etyl := parts[0].split("|")[0]):
@@ -20,7 +20,7 @@ def get_etymology(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> st
     return str(content.getText())
 
 
-def get_example(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def get_example(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     # if len(parts) > 0:
     #     return ". (Пример: " + parts[0] + ")"
     # elif "текст" in data.keys():
@@ -28,11 +28,11 @@ def get_example(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
     return ""
 
 
-def get_definition(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def get_definition(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     return str(data["определение"] + data["примеры"])
 
 
-def get_note(tpl: str, parts: List[str], data: DefaultDict[str, str]) -> str:
+def get_note(tpl: str, parts: List[str], data: DefaultDict[str, str], word: str = "") -> str:
     return f"({parts[0]})"
 
 
@@ -50,7 +50,7 @@ def lookup_template(tpl: str) -> bool:
     return tpl in template_mapping
 
 
-def render_template(template: Tuple[str, ...]) -> str:
+def render_template(word: str, template: Tuple[str, ...]) -> str:
     tpl, *parts = template
     data = extract_keywords_from(parts)
-    return template_mapping[tpl](tpl, parts, data)
+    return template_mapping[tpl](tpl, parts, data, word=word)


Test patch:
diff --git a/tests/test_en.py b/tests/test_en.py
index 04e8a7b8..60ee4593 100644
--- a/tests/test_en.py
+++ b/tests/test_en.py
@@ -15,7 +15,7 @@
             ["/æb/"],
             ["Abbreviation of <i>abdominal</i> <i>muscles</i>."],
             [
-                "ISO 639-1 code <b>1</b>",
+                "(<i>international standards</i>) <i>ISO 639-1 language code for</i> <b>Abkhaz</b>.",
                 "<i>(informal)</i> abdominal muscle. <small>[Mid 20<sup>th</sup> century.]</small>",
                 "<i>(slang)</i> An abscess caused by injecting an illegal drug, usually heroin.",
                 "<i>Abbreviation of</i> <b>abortion</b>.",