Skip to content
Snippets Groups Projects
Commit 692ead37 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

alternative spellings

parent c1e56ea4
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@ string_values = {
"t_snd":"audio", #template for audio
"t_acc":"a", #template for accents
"t_deflabel":"lb",
"t_alt":"alternative spelling of",
"t_alt_param":1, #number of the parameter of t_alt containing the other spelling
"t_ex":["ux", "usex"],
"t_lbl":["lb","lbl", "label"], #template for labels
"regions":{
......
......@@ -81,6 +81,8 @@ class En_en_straktor(Wikstraktor):
def_text = parsed_def.plain_text().strip()
templates = parsed_def.templates
the_def = self.parse_template_1(templates)
if the_def == None:
the_def = self.parse_alt_spell(templates)
if the_def == None:
the_def = Definition(self.entry_language, def_text)
if the_def == None:
......
......@@ -4,6 +4,8 @@ string_values = {
"en":" {{langue|en}} ",
"fr":"Français",
"t_deflabel":["lexique", "info lex"],
"t_alt":"variante de",
"t_alt_param":0, #number of the parameter of t_alt containing the other spelling
"t_ex":"exemple",
#Inexistants
"t_ipa":"pron", #template for transcription
......
......@@ -623,6 +623,14 @@ class Wikstraktor:
def process_etymology(self, parsedwikitext):
pass#in subclass
def parse_alt_spell(self, templates):
the_def = None
for t in templates:
if t.normal_name() == self.constants['t_alt']:
the_def = Definition(self.entry_language, f"Alternate spelling of “{t.arguments[self.constants['t_alt_param']].value}")
break
return the_def
#can be overloaded
def process_example(self, example_wiki_text):
k = 0
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment