Skip to content

Commit 25e2f31

Browse files
committed
Check more fields for special characters
1 parent 4ca4824 commit 25e2f31

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

check.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ def contains_ascii(s: str):
4949
f'invalid 小韻字號: {小韻字號}'
5050
)
5151
assert len(韻目原貌) == 1, f'invalid 韻目原𩩕: {韻目原貌}'
52-
assert re.fullmatch(r'{.+}|[.+]|.+〈.+〉|[^{}[]〈〉]+', 字頭), (
53-
f'invalid 字頭: {字頭}'
54-
)
5552

5653
assert PATTERN_描述.fullmatch(音韻地位描述) is not None, (
5754
f'invalid 音韻地位: {音韻地位描述}'
@@ -60,8 +57,17 @@ def contains_ascii(s: str):
6057
if 反切:
6158
assert PATTERN_反切.fullmatch(反切) is not None, f'invalid 反切: {反切}'
6259

63-
assert 釋義 or 釋義參照, '釋義 and 釋義參照 should not be both empty'
64-
assert not contains_ascii(釋義), (
65-
'釋義 should not contain any ASCII characters'
60+
assert re.fullmatch(r'{.+}|[.+]|.+〈.+〉|[^{}[]〈〉]+', 字頭), (
61+
f'invalid 字頭: {字頭}'
6662
)
63+
64+
assert 釋義 or 釋義參照, '釋義 and 釋義參照 should not be both empty'
6765
assert 釋義參照 in ('', '上', '下'), '釋義參照 should be "上" or "下"'
66+
67+
for name, value in (('反切', 反切), ('字頭', 字頭), ('釋義', 釋義)):
68+
assert not contains_ascii(value), (
69+
f'{name} should not contain any ASCII characters'
70+
)
71+
assert not re.search(r'[【】]', 字頭說明), (
72+
'字頭說明 should not contain "【】"'
73+
)

0 commit comments

Comments
 (0)