Skip to content

Commit 08f3b54

Browse files
authored
Merge branch 'typst-jp:main' into translate/emph
2 parents 28fafaa + 9887fbf commit 08f3b54

File tree

7 files changed

+24423
-47981
lines changed

7 files changed

+24423
-47981
lines changed

gen.py

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,74 @@ class PageDict(TypedDict):
3636
children: list["PageDict"]
3737

3838

39+
def type2href(parameter_type: str) -> str | None:
40+
"""型名からリンクを取得する"""
41+
foundation_set = set(
42+
(
43+
"arguments",
44+
"array",
45+
"auto",
46+
"bool",
47+
"bytes",
48+
"content",
49+
"datetime",
50+
"decimal",
51+
"dictionary",
52+
"duration",
53+
"float",
54+
"function",
55+
"int",
56+
"label",
57+
"module",
58+
"none",
59+
"plugin",
60+
"regex",
61+
"selector",
62+
"str",
63+
"type",
64+
"version",
65+
)
66+
)
67+
layout_set = set(
68+
(
69+
"alignment",
70+
"angle",
71+
"direction",
72+
"fraction",
73+
"length",
74+
"ratio",
75+
"relative",
76+
)
77+
)
78+
visualize_set = set(
79+
(
80+
"color",
81+
"gradient",
82+
"pattern",
83+
"stroke",
84+
)
85+
)
86+
introspection_set = set(
87+
(
88+
"counter",
89+
"location",
90+
"state",
91+
)
92+
)
93+
if parameter_type in foundation_set:
94+
return f"foundations/{parameter_type}"
95+
elif parameter_type in layout_set:
96+
return f"layout/{parameter_type}"
97+
elif parameter_type in visualize_set:
98+
return f"visualize/{parameter_type}"
99+
elif parameter_type in introspection_set:
100+
return f"introspection/{parameter_type}"
101+
else:
102+
return None
103+
104+
39105
def type2class(parameter_type: str) -> str:
40-
"""関数の引数の型名からCSSのクラス名を取得する"""
106+
"""型名からCSSのクラス名を取得する"""
41107
type2class_map: dict[str, str] = {
42108
"none": "pill-kw",
43109
"auto": "pill-kw",
@@ -155,6 +221,7 @@ def _render_to_file(
155221
path=path,
156222
prev=previous_page,
157223
next=next_page,
224+
type2href=type2href,
158225
type2class=type2class,
159226
gen_path=gen_path,
160227
**page,

static/assets/search-cn.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)