Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"vuepress-theme-hope": "2.0.0-beta.235"
},
"dependencies": {
"@vuepress/plugin-shiki": "2.0.0-beta.66",
"axios": "^1.6.5",
"fs-extra": "^11.2.0"
"fs-extra": "^11.2.0",
"vuepress-plugin-md-enhance": "2.0.0-beta.66"
}
}
503 changes: 503 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions src/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { defineUserConfig } from "vuepress";
import theme from "./theme.js";
import { searchPlugin } from "@vuepress/plugin-search";
import { shikiPlugin } from "@vuepress/plugin-shiki";
import path from 'path'
export default defineUserConfig({
base: "/",
plugins: [
Expand All @@ -14,6 +16,28 @@ export default defineUserConfig({
},
},
}),
shikiPlugin({
theme: "dracula",
langs: [
{
id: "webgal",
aliases: [
"webgal",
"WebGAL",
"Webgal",
"ws",
"webgal-script",
"WebgalScript",
"Webgal Script",
"WebGAL Script",
],
scopeName: "source.webgal",
path: path.resolve(__dirname, "../grammar/webgal.tmLanguage.json"),
},
"ts", "bash", "json", "xml", "kotlin",
],

}),
],
locales: {
"/": {
Expand Down
51 changes: 51 additions & 0 deletions src/.vuepress/sidebar/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,56 @@ export const zhSidebar = sidebar({
"developers/terre",
]
},
{
text: "脚本参考",
prefix: "script-reference/",
children: [
{
text: "命令",
prefix: "commands/",
children:[
"global",
"say",
"changeBg",
"changeFigure",
"bgm",
"playVideo",
"pixiPerform",
"pixiInit",
"intro",
"miniAvatar",
"changeScene",
"choose",
"end",
"setComplexAnimation",
"label",
"jumpLabel",
"setVar",
"callScene",
"showVars",
"unlockCg",
"unlockBgm",
"filmMode",
"setTextbox",
"setAnimation",
"playEffect",
"setTempAnimation",
"comment",
"setTransform",
"setTransition",
"getUserInput",
"applyStyle",
"wait",
]
},
{
text: "其他",
prefix: "others/",
children:[
"transform-reference",
]
},
],
},
],
});
2 changes: 1 addition & 1 deletion src/.vuepress/styles/palette.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// you can change colors here
$theme-color: #005caf;
$theme-color: #2893f7;
4 changes: 2 additions & 2 deletions src/en/publish/android/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The game loads `project folder\app\src\main\assets\webgal\index.html` by default
Open Android Studio to open the project.
Modify the `rootProject.name` field in the `project folder\settings.gradle` file.

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

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

``` gradle
```
...
android {
namespace 'com.openwebgal.demo' //Modify the package name
Expand Down
266 changes: 266 additions & 0 deletions src/grammar/webgal.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "WebGAL Script",
"patterns": [
{
"include": "#comment-line"
},
{
"include": "#statement"
}
],
"repository": {
"argument-list": {
"patterns": [
{
"comment": ">1 arguments left, ie -kwarg0=val0 -kwarg1=val1 ...",
"match": "(\\s\\-)(.*?)(\\s\\-.*)$",
"captures": {
"1": {
"patterns": [
{
"include": "#operator"
}
]
},
"2": {
"patterns": [
{
"include": "#parameter"
}
]
},
"3": {
"patterns": [
{
"include": "#argument-list"
}
]
}
}
},
{
"comment": "only one argument left, ie -kwarg0=val0",
"match": "(\\s\\-)(.*)",
"captures": {
"1": {
"patterns": [
{
"include": "#operator"
}
]
},
"2": {
"patterns": [
{
"include": "#parameter"
}
]
}
}
}
]
},
"character": {
"match": ".*",
"name": "markup.changed"
},
"command": {
"match": ".*",
"name": "punctuation.definition.character-class.regexp"
},
"comment-line": {
"match": "\\;.*?$",
"name": "comment"
},
"operator": {
"match": "[\\:\\=\\<\\>\\|\\+\\-]",
"name": "markup.deleted"
},
"parameter": {
"patterns": [
{
"comment": "value only, ie val0",
"match": "(?!.*\\=).+",
"name": "markup.changed"
},
{
"comment": "name and value, ie [kwarg0]=[val0]",
"match": "(.*?)(\\=)(.*?)$",
"captures": {
"1": {
"name": "markup.changed"
},
"2": {
"patterns": [
{
"include": "#operator"
}
]
},
"3": {
"name": "markup.inserted"
}
}
}
]
},
"utterance": {
"patterns": [
{
"comment": "utterance only",
"match": "(?!.*\\s\\-)(.+)",
"captures": {
"0": {
"name": "string.regexp"
}
}
},
{
"comment": "utterance and argument list",
"match": "(.*?)(\\s\\-.*?)$",
"captures": {
"1": {
"name": "string.regexp"
},
"2": {
"patterns": [
{
"include": "#argument-list"
}
]
}
}
}
]
},
"character-colon": {
"comment": "[char]:[utt[ -args]][;cmt]",
"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]*?)($|\\;.*?$)",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The list of WebGAL commands is hardcoded in four different regular expressions in this file. This creates a maintenance burden, as any change to the command set needs to be reflected in all four places.

Furthermore, the command list here is inconsistent with the new documentation in the sidebar:

  • Commands like setFilter, chooseLabel, and if are present here but not documented in the new script reference.
  • The command comment is listed here, but its documentation page states it's not a command keyword.

To improve maintainability and correctness, I suggest ensuring the command list is consistent with the documentation. If the tmLanguage format doesn't support defining the list once, consider adding a comment to the file to remind future developers to update all instances.

"captures": {
"1": {
"name": "meta.character.webgal",
"patterns": [
{
"include": "#character"
}
]
},
"2": {
"patterns": [
{
"include": "#operator"
}
]
},
"3": {
"patterns": [
{
"include": "#utterance"
}
]
},
"4": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"command-colon": {
"comment": "cmd:[arg0[ -args]][;cmt]",
"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]*?)($|\\;.*?$)",
"captures": {
"1": {
"name": "meta.command.webgal",
"patterns": [
{
"include": "#command"
}
]
},
"2": {
"patterns": [
{
"include": "#operator"
}
]
},
"3": {
"patterns": [
{
"include": "#argument-list"
}
]
},
"4": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"command-semicolon": {
"comment": "cmd;[cmt]",
"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)($|\\;.*?$)",
"captures": {
"1": {
"name": "meta.command.webgal",
"patterns": [
{
"include": "#command"
}
]
},
"2": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"utterance-semicolon": {
"comment": "utt[ -args];[cmt]",
"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]+?)(\\;.*)?$",
"captures": {
"1": {
"patterns": [
{
"include": "#utterance"
}
]
},
"2": {
"patterns": [
{
"include": "#comment-line"
}
]
}
}
},
"statement": {
"patterns": [
{
"include": "#character-colon"
},
{
"include": "#command-colon"
},
{
"include": "#command-semicolon"
},
{
"include": "#utterance-semicolon"
}
]
}
},
"scopeName": "source.webgal"
}
Loading