Skip to content

Commit

Permalink
[en] Split tag validation error into two
Browse files Browse the repository at this point in the history
  • Loading branch information
kristian-clausal committed Oct 28, 2024
1 parent f61ff83 commit 737a3d2
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/wiktextract/wiktionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,25 @@ def check_tags(
from .tags import uppercase_tags, valid_tags

if tag not in valid_tags and tag not in uppercase_tags:
check_error(
wxr,
dt,
word,
lang,
pos,
f"invalid tag {tag} not in valid_tags(or uppercase_tags)",
)
if len(tag) > 0 and tag[0].isupper():
check_error(
wxr,
dt,
word,
lang,
pos,
f"invalid uppercase tag {tag} not in or uppercase_tags",
)
else:
check_error(
wxr,
dt,
word,
lang,
pos,
f"invalid tag {tag} not in valid_tags "
"or uppercase_tags",
)


def check_str_fields(
Expand Down

0 comments on commit 737a3d2

Please sign in to comment.