Skip to content

Commit

Permalink
Fix language codes additions with "é"
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertbossot committed Apr 28, 2024
1 parent 6ad43c9 commit e817d33
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/wiktionary/fr_wiktionary_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ def treat_page(page):
print(' empty language code')
return

if debug_level > 1:
if debug_level > 0:
print(' language found: ' + language_code)

regex = r'[a-zA-Z\-]+'
if not re.search(regex, language_code):
banner = '{{formater|Code langue incorrect : ' + language_code + '}}\n'
Expand Down
2 changes: 1 addition & 1 deletion src/wiktionary/fr_wiktionary_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ def add_language_code_with_named_parameter_to_template(
return next_template(final_page_content, page_content)

# Correct language code with the paragraph's one
regex_lang = r'^[^{}]+\| *lang(?:gue|1)? *= *([a-zA-Z\- ]*)'
regex_lang = r'^[^{}]+\| *lang(?:gue|1)? *= *([\w\- ]*)'
p = re.compile(regex_lang)
m = p.match(page_content)
if m is None:
Expand Down

0 comments on commit e817d33

Please sign in to comment.