Skip to content

Commit 1a75f21

Browse files
Filter helper schemas from catalog (#40)
* Filter helper schemas from site manifest * Apply local site updates
1 parent 188dfd1 commit 1a75f21

19 files changed

Lines changed: 6505 additions & 656 deletions
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY
2+
version = 1
3+
name = "Chinese_Rime"
4+
5+
[setup]
6+
script = ""
7+
8+
[[actions]]
9+
name = "Run"
10+
icon = "run"
11+
command = '''
12+
cd site
13+
corepack pnpm dev
14+
'''

script/manifest/walk_submodules.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import yaml
88

99

10+
HELPER_SCHEMA_DIRS = {"ext-dict"}
11+
12+
1013
def walk_submodules(sources_dir: Path) -> list[dict]:
1114
"""Return one normalized dict per unique schema_id under sources_dir.
1215
@@ -35,7 +38,16 @@ def walk_submodules(sources_dir: Path) -> list[dict]:
3538
def _iter_schema_yamls(root: Path) -> Iterable[Path]:
3639
# Walk recursively but emit shallower paths first so the de-dup in
3740
# walk_submodules keeps the primary file rather than a nested variant.
38-
yield from sorted(root.rglob("*.schema.yaml"), key=lambda p: (len(p.parts), str(p)))
41+
schema_paths = (
42+
path
43+
for path in root.rglob("*.schema.yaml")
44+
if not _is_helper_schema(path.relative_to(root))
45+
)
46+
yield from sorted(schema_paths, key=lambda p: (len(p.parts), str(p)))
47+
48+
49+
def _is_helper_schema(relative_path: Path) -> bool:
50+
return any(part in HELPER_SCHEMA_DIRS for part in relative_path.parts[:-1])
3951

4052

4153
def _load_one(path: Path) -> dict:

script/manifest_overrides.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,31 +591,91 @@ schema_assignments:
591591
dialect: 潮州話
592592
recipe: kahaani/dieghv
593593
upstream_url: https://github.com/kahaani/dieghv
594+
dieziu_60:
595+
branch: nan
596+
dialect: 潮州話
597+
recipe: kahaani/dieghv
598+
upstream_url: https://github.com/kahaani/dieghv
599+
dieziu_mtr:
600+
branch: nan
601+
dialect: 潮州話
602+
recipe: kahaani/dieghv
603+
upstream_url: https://github.com/kahaani/dieghv
594604
dioion:
595605
branch: nan
596606
dialect: 潮陽話
597607
recipe: kahaani/dieghv
598608
upstream_url: https://github.com/kahaani/dieghv
609+
dioion_60:
610+
branch: nan
611+
dialect: 潮陽話
612+
recipe: kahaani/dieghv
613+
upstream_url: https://github.com/kahaani/dieghv
614+
dioion_mtr:
615+
branch: nan
616+
dialect: 潮陽話
617+
recipe: kahaani/dieghv
618+
upstream_url: https://github.com/kahaani/dieghv
599619
gekion:
600620
branch: nan
601621
dialect: 揭陽話
602622
recipe: kahaani/dieghv
603623
upstream_url: https://github.com/kahaani/dieghv
624+
gekion_60:
625+
branch: nan
626+
dialect: 揭陽話
627+
recipe: kahaani/dieghv
628+
upstream_url: https://github.com/kahaani/dieghv
629+
gekion_mtr:
630+
branch: nan
631+
dialect: 揭陽話
632+
recipe: kahaani/dieghv
633+
upstream_url: https://github.com/kahaani/dieghv
604634
suantau:
605635
branch: nan
606636
dialect: 汕頭話
607637
recipe: kahaani/dieghv
608638
upstream_url: https://github.com/kahaani/dieghv
639+
suantau_60:
640+
branch: nan
641+
dialect: 汕頭話
642+
recipe: kahaani/dieghv
643+
upstream_url: https://github.com/kahaani/dieghv
644+
suantau_mtr:
645+
branch: nan
646+
dialect: 汕頭話
647+
recipe: kahaani/dieghv
648+
upstream_url: https://github.com/kahaani/dieghv
609649
tenghai:
610650
branch: nan
611651
dialect: 澄海話
612652
recipe: kahaani/dieghv
613653
upstream_url: https://github.com/kahaani/dieghv
654+
tenghai_60:
655+
branch: nan
656+
dialect: 澄海話
657+
recipe: kahaani/dieghv
658+
upstream_url: https://github.com/kahaani/dieghv
659+
tenghai_mtr:
660+
branch: nan
661+
dialect: 澄海話
662+
recipe: kahaani/dieghv
663+
upstream_url: https://github.com/kahaani/dieghv
614664
riaupeng:
615665
branch: nan
616666
dialect: 饒平話
617667
recipe: kahaani/dieghv
618668
upstream_url: https://github.com/kahaani/dieghv
669+
riaupeng_60:
670+
branch: nan
671+
dialect: 饒平話
672+
recipe: kahaani/dieghv
673+
upstream_url: https://github.com/kahaani/dieghv
674+
riaupeng_mtr:
675+
branch: nan
676+
dialect: 饒平話
677+
recipe: kahaani/dieghv
678+
upstream_url: https://github.com/kahaani/dieghv
619679
diege_j:
620680
branch: nan
621681
dialect: 潮州話

script/tests/test_walk_submodules.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ def test_walk_submodules_keeps_shallow_duplicate_schema(tmp_path: Path):
7070
result = walk_submodules(tmp_path / "sources")
7171
assert len(result) == 1
7272
assert result[0]["display_name"] == "Primary"
73+
74+
75+
def test_walk_submodules_skips_extension_dictionary_schemas(tmp_path: Path):
76+
primary = tmp_path / "sources" / "晉語" / "sample" / "jieny.schema.yaml"
77+
helper = tmp_path / "sources" / "晉語" / "sample" / "ext-dict" / "easy_en.schema.yaml"
78+
primary.parent.mkdir(parents=True)
79+
helper.parent.mkdir(parents=True)
80+
primary.write_text("schema:\n schema_id: jieny\n name: 嘉樂泉話\n", encoding="utf-8")
81+
helper.write_text("schema:\n schema_id: easy_en\n name: Easy English\n", encoding="utf-8")
82+
83+
result = walk_submodules(tmp_path / "sources")
84+
assert [schema["schema_id"] for schema in result] == ["jieny"]

0 commit comments

Comments
 (0)