Skip to content

Commit be96484

Browse files
Merge pull request #71 from HardyNLee/feat-script-reference
feat: add script reference and code highlight
2 parents 4ff63dd + b734b61 commit be96484

55 files changed

Lines changed: 2762 additions & 8 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"vuepress-theme-hope": "2.0.0-beta.235"
1919
},
2020
"dependencies": {
21+
"@vuepress/plugin-shiki": "2.0.0-beta.66",
2122
"axios": "^1.6.5",
22-
"fs-extra": "^11.2.0"
23+
"fs-extra": "^11.2.0",
24+
"vuepress-plugin-md-enhance": "2.0.0-beta.66"
2325
}
2426
}

pnpm-lock.yaml

Lines changed: 503 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/.vuepress/config.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { defineUserConfig } from "vuepress";
22
import theme from "./theme.js";
33
import { searchPlugin } from "@vuepress/plugin-search";
4+
import { shikiPlugin } from "@vuepress/plugin-shiki";
5+
import path from 'path'
46
export default defineUserConfig({
57
base: "/",
68
plugins: [
@@ -14,6 +16,28 @@ export default defineUserConfig({
1416
},
1517
},
1618
}),
19+
shikiPlugin({
20+
theme: "dracula",
21+
langs: [
22+
{
23+
id: "webgal",
24+
aliases: [
25+
"webgal",
26+
"WebGAL",
27+
"Webgal",
28+
"ws",
29+
"webgal-script",
30+
"WebgalScript",
31+
"Webgal Script",
32+
"WebGAL Script",
33+
],
34+
scopeName: "source.webgal",
35+
path: path.resolve(__dirname, "../grammar/webgal.tmLanguage.json"),
36+
},
37+
"ts", "bash", "json", "xml", "kotlin",
38+
],
39+
40+
}),
1741
],
1842
locales: {
1943
"/": {

src/.vuepress/sidebar/zh.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,56 @@ export const zhSidebar = sidebar({
5252
"developers/terre",
5353
]
5454
},
55+
{
56+
text: "脚本参考",
57+
prefix: "script-reference/",
58+
children: [
59+
{
60+
text: "命令",
61+
prefix: "commands/",
62+
children:[
63+
"global",
64+
"say",
65+
"changeBg",
66+
"changeFigure",
67+
"bgm",
68+
"playVideo",
69+
"pixiPerform",
70+
"pixiInit",
71+
"intro",
72+
"miniAvatar",
73+
"changeScene",
74+
"choose",
75+
"end",
76+
"setComplexAnimation",
77+
"label",
78+
"jumpLabel",
79+
"setVar",
80+
"callScene",
81+
"showVars",
82+
"unlockCg",
83+
"unlockBgm",
84+
"filmMode",
85+
"setTextbox",
86+
"setAnimation",
87+
"playEffect",
88+
"setTempAnimation",
89+
"comment",
90+
"setTransform",
91+
"setTransition",
92+
"getUserInput",
93+
"applyStyle",
94+
"wait",
95+
]
96+
},
97+
{
98+
text: "其他",
99+
prefix: "others/",
100+
children:[
101+
"transform-reference",
102+
]
103+
},
104+
],
105+
},
55106
],
56107
});

src/.vuepress/styles/palette.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// you can change colors here
2-
$theme-color: #005caf;
2+
$theme-color: #2893f7;

src/en/publish/android/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The game loads `project folder\app\src\main\assets\webgal\index.html` by default
4949
Open Android Studio to open the project.
5050
Modify the `rootProject.name` field in the `project folder\settings.gradle` file.
5151

52-
``` gradle
52+
```
5353
...
5454
rootProject.name = "WebGAL" //Modify the project title
5555
...
@@ -65,7 +65,7 @@ Modify the title information in `project folder\app\src\main\res\values\strings.
6565

6666
Modify the `namespace` and `applicationId` fields in `project folder\app\build.gradle` to the reverse of the domain name.
6767

68-
``` gradle
68+
```
6969
...
7070
android {
7171
namespace 'com.openwebgal.demo' //Modify the package name

src/grammar/webgal.tmLanguage.json

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "WebGAL Script",
4+
"patterns": [
5+
{
6+
"include": "#comment-line"
7+
},
8+
{
9+
"include": "#statement"
10+
}
11+
],
12+
"repository": {
13+
"argument-list": {
14+
"patterns": [
15+
{
16+
"comment": ">1 arguments left, ie -kwarg0=val0 -kwarg1=val1 ...",
17+
"match": "(\\s\\-)(.*?)(\\s\\-.*)$",
18+
"captures": {
19+
"1": {
20+
"patterns": [
21+
{
22+
"include": "#operator"
23+
}
24+
]
25+
},
26+
"2": {
27+
"patterns": [
28+
{
29+
"include": "#parameter"
30+
}
31+
]
32+
},
33+
"3": {
34+
"patterns": [
35+
{
36+
"include": "#argument-list"
37+
}
38+
]
39+
}
40+
}
41+
},
42+
{
43+
"comment": "only one argument left, ie -kwarg0=val0",
44+
"match": "(\\s\\-)(.*)",
45+
"captures": {
46+
"1": {
47+
"patterns": [
48+
{
49+
"include": "#operator"
50+
}
51+
]
52+
},
53+
"2": {
54+
"patterns": [
55+
{
56+
"include": "#parameter"
57+
}
58+
]
59+
}
60+
}
61+
}
62+
]
63+
},
64+
"character": {
65+
"match": ".*",
66+
"name": "markup.changed"
67+
},
68+
"command": {
69+
"match": ".*",
70+
"name": "punctuation.definition.character-class.regexp"
71+
},
72+
"comment-line": {
73+
"match": "\\;.*?$",
74+
"name": "comment"
75+
},
76+
"operator": {
77+
"match": "[\\:\\=\\<\\>\\|\\+\\-]",
78+
"name": "markup.deleted"
79+
},
80+
"parameter": {
81+
"patterns": [
82+
{
83+
"comment": "value only, ie val0",
84+
"match": "(?!.*\\=).+",
85+
"name": "markup.changed"
86+
},
87+
{
88+
"comment": "name and value, ie [kwarg0]=[val0]",
89+
"match": "(.*?)(\\=)(.*?)$",
90+
"captures": {
91+
"1": {
92+
"name": "markup.changed"
93+
},
94+
"2": {
95+
"patterns": [
96+
{
97+
"include": "#operator"
98+
}
99+
]
100+
},
101+
"3": {
102+
"name": "markup.inserted"
103+
}
104+
}
105+
}
106+
]
107+
},
108+
"utterance": {
109+
"patterns": [
110+
{
111+
"comment": "utterance only",
112+
"match": "(?!.*\\s\\-)(.+)",
113+
"captures": {
114+
"0": {
115+
"name": "string.regexp"
116+
}
117+
}
118+
},
119+
{
120+
"comment": "utterance and argument list",
121+
"match": "(.*?)(\\s\\-.*?)$",
122+
"captures": {
123+
"1": {
124+
"name": "string.regexp"
125+
},
126+
"2": {
127+
"patterns": [
128+
{
129+
"include": "#argument-list"
130+
}
131+
]
132+
}
133+
}
134+
}
135+
]
136+
},
137+
"character-colon": {
138+
"comment": "[char]:[utt[ -args]][;cmt]",
139+
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|setFilter|label|jumpLabel|chooseLabel|setVar|if|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|comment|setTransform|setTransition|getUserInput|applyStyle|wait)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
140+
"captures": {
141+
"1": {
142+
"name": "meta.character.webgal",
143+
"patterns": [
144+
{
145+
"include": "#character"
146+
}
147+
]
148+
},
149+
"2": {
150+
"patterns": [
151+
{
152+
"include": "#operator"
153+
}
154+
]
155+
},
156+
"3": {
157+
"patterns": [
158+
{
159+
"include": "#utterance"
160+
}
161+
]
162+
},
163+
"4": {
164+
"patterns": [
165+
{
166+
"include": "#comment-line"
167+
}
168+
]
169+
}
170+
}
171+
},
172+
"command-colon": {
173+
"comment": "cmd:[arg0[ -args]][;cmt]",
174+
"match": "^(say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|setFilter|label|jumpLabel|chooseLabel|setVar|if|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|comment|setTransform|setTransition|getUserInput|applyStyle|wait)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
175+
"captures": {
176+
"1": {
177+
"name": "meta.command.webgal",
178+
"patterns": [
179+
{
180+
"include": "#command"
181+
}
182+
]
183+
},
184+
"2": {
185+
"patterns": [
186+
{
187+
"include": "#operator"
188+
}
189+
]
190+
},
191+
"3": {
192+
"patterns": [
193+
{
194+
"include": "#argument-list"
195+
}
196+
]
197+
},
198+
"4": {
199+
"patterns": [
200+
{
201+
"include": "#comment-line"
202+
}
203+
]
204+
}
205+
}
206+
},
207+
"command-semicolon": {
208+
"comment": "cmd;[cmt]",
209+
"match": "^(say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|setFilter|label|jumpLabel|chooseLabel|setVar|if|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|comment|setTransform|setTransition|getUserInput|applyStyle|wait)($|\\;.*?$)",
210+
"captures": {
211+
"1": {
212+
"name": "meta.command.webgal",
213+
"patterns": [
214+
{
215+
"include": "#command"
216+
}
217+
]
218+
},
219+
"2": {
220+
"patterns": [
221+
{
222+
"include": "#comment-line"
223+
}
224+
]
225+
}
226+
}
227+
},
228+
"utterance-semicolon": {
229+
"comment": "utt[ -args];[cmt]",
230+
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|setFilter|label|jumpLabel|chooseLabel|setVar|if|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|comment|setTransform|setTransition|getUserInput|applyStyle|wait)\\;)([^\\:\\;\n]+?)(\\;.*)?$",
231+
"captures": {
232+
"1": {
233+
"patterns": [
234+
{
235+
"include": "#utterance"
236+
}
237+
]
238+
},
239+
"2": {
240+
"patterns": [
241+
{
242+
"include": "#comment-line"
243+
}
244+
]
245+
}
246+
}
247+
},
248+
"statement": {
249+
"patterns": [
250+
{
251+
"include": "#character-colon"
252+
},
253+
{
254+
"include": "#command-colon"
255+
},
256+
{
257+
"include": "#command-semicolon"
258+
},
259+
{
260+
"include": "#utterance-semicolon"
261+
}
262+
]
263+
}
264+
},
265+
"scopeName": "source.webgal"
266+
}

0 commit comments

Comments
 (0)