Skip to content

Commit

Permalink
Ignore empty string template parameter of the "trad-début" template
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyzz committed Oct 13, 2023
1 parent 2a9bc51 commit 2b4f32d
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 73 deletions.
2 changes: 1 addition & 1 deletion src/wiktextract/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ def expand_group(v):
if a == "2":
v = "√"
elif a == "3":
v = "∛",
v = "∛"
elif a == "4":
v = "∜"
else:
Expand Down
6 changes: 3 additions & 3 deletions src/wiktextract/extractor/fr/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def process_translation_templates(
# translation box start: https://fr.wiktionary.org/wiki/Modèle:trad-début
sense_parameter = template_node.template_parameters.get(1)
if sense_parameter is not None:
base_translation_data["sense"] = clean_node(
wxr, None, sense_parameter
)
sense_text = clean_node(wxr, None, sense_parameter)
if len(sense_text) > 0:
base_translation_data["sense"] = sense_text
elif template_node.template_name == "T":
# Translation language: https://fr.wiktionary.org/wiki/Modèle:T
base_translation_data["code"] = template_node.template_parameters.get(1)
Expand Down
4 changes: 2 additions & 2 deletions src/wiktextract/form_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
r"\s+\((({}): ([^()]|\([^()]+\))+)\)"
.format("|".join(re.escape(x.removeprefix("?"))
for x in sorted(xlat_head_map.values(),
key=lambda x: len(x),
key=len,
reverse=True)
if x and not x.startswith("class-"))))

Expand All @@ -179,7 +179,7 @@
"|".join(re.escape(x) for x in
# The sort is to put longer ones first, preferring them in
# the regexp match
sorted(xlat_head_map.keys(), key=lambda x: len(x),
sorted(xlat_head_map.keys(), key=len,
reverse=True)))
head_final_re = re.compile(head_final_re_text + "$")

Expand Down
Loading

0 comments on commit 2b4f32d

Please sign in to comment.