Skip to content

Commit

Permalink
Use DOTALL
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 committed Jun 30, 2024
1 parent 837e8bd commit 52ece0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def children(regex: str):

# Require text to match regex
def text(regex: str):
if not re.fullmatch(regex, element.text):
if not re.fullmatch(regex, element.text, flags=re.DOTALL):
raise ValidationError(f"<{element.tag}> text '{element.text}' does not match r'{regex}'")

# Check requirements for each tag
Expand Down Expand Up @@ -102,21 +102,21 @@ def text(regex: str):
children(r"<name>" if for_73 else r"<display><accessible>(<variant>)*")

case "name" if for_73:
text(r"[\S\s]+")
text(r".+")

case "display":
text(r"[\S\s]+")
text(r".+")

case "accessible":
text(r"[\u0000-\u00FF]*")
text(r"[\u0000-\u00FF]+")

if element.text in all_names[version][lang]:
raise ValidationError(f"{lang} accessible name '{element.text}' is not unique within {version}")

all_names[version][lang].add(element.text)

case "variant":
text(r"[\S\s]+")
text(r".+")

if element.text in all_names[version][lang]:
raise ValidationError(f"{lang} variant name '{element.text}' is not unique within {version}")
Expand Down

0 comments on commit 52ece0d

Please sign in to comment.