-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
232 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/__pycache__/ | ||
/.vscode/ | ||
/tools/ | ||
*.code-workspace | ||
*.psd | ||
*.exe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
column_width = 120 | ||
column_width = 180 | ||
indent_type = "Spaces" | ||
quote_style = "AutoPreferSingle" | ||
line_endings = "Windows" | ||
line_endings = "Unix" |
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import os | ||
import re | ||
from slpp import slpp as lua | ||
|
||
# 找到最新的更新文档 | ||
latest_version = 0 | ||
for _, _, files in os.walk("core/changelog", topdown=False): | ||
for file in files: | ||
version = re.sub(r"(\.lua)|(^.*\.xml)", "", file) | ||
if version and not version == "_template": | ||
version = float(version) | ||
if version > latest_version: | ||
latest_version = version | ||
|
||
# 提取更新记录的 lua 字符串 | ||
changelog_path = "core/changelog/{:.2f}.lua".format(latest_version) | ||
with open(changelog_path, "r", encoding="utf8") as f: | ||
changelog_lua_string = f.read().replace("\n", "") | ||
|
||
start_index = changelog_lua_string.find("{") | ||
changelog_lua_string = changelog_lua_string[start_index:] | ||
|
||
# 解析 lua table 到 Python dict | ||
changelog = lua.decode(changelog_lua_string) | ||
|
||
locales = [ | ||
{ | ||
"language": "enUS", | ||
"VERSION": "Version", | ||
"IMPORTANT": "Important", | ||
"NEW": "New", | ||
"IMPROVEMENT": "Improvement", | ||
"RELEASED_STRING": "{} Released" | ||
}, | ||
{ | ||
"language": "zhCN", | ||
"VERSION": "版本", | ||
"IMPORTANT": "重要", | ||
"NEW": "新增", | ||
"IMPROVEMENT": "改善", | ||
"RELEASED_STRING": "{} 发布" | ||
} | ||
] | ||
|
||
parts = [ | ||
{ | ||
"emoji": "🌟", | ||
"name": "IMPORTANT", | ||
}, | ||
{ | ||
"emoji": "🔆", | ||
"name": "NEW", | ||
}, | ||
{ | ||
"emoji": "⚡", | ||
"name": "IMPROVEMENT", | ||
} | ||
] | ||
|
||
with open("CHANGELOG.md", "w", encoding="utf8") as f: | ||
for locale in locales: | ||
f.write("# {}: {:.2f}\n".format(locale["VERSION"], latest_version)) | ||
f.write(locale["RELEASED_STRING"].format( | ||
changelog["RELEASE_DATE"])+"\n") | ||
|
||
for part in parts: | ||
try: | ||
if len(changelog[part["name"]]["zhTW"]) > 0: | ||
f.write("## {} {}\n".format( | ||
part["emoji"], locale[part["name"]])) | ||
for line in changelog[part["name"]][locale["language"]]: | ||
f.write("- {}\n".format(line)) | ||
except: | ||
pass | ||
|
||
f.write("\n------\n") |
Oops, something went wrong.