-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2023-10-29 multiple updates, close #3
index.html redesigned Album page added Changelog page added (with additional data) New filters/global functions added Page generation (mostly macros) are rewritten
- Loading branch information
Showing
72 changed files
with
2,868 additions
and
1,717 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
Submodule dev_changelogs
added at
3a4a98
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,30 @@ | ||
import json | ||
import os | ||
from jinja2 import Environment | ||
|
||
TEMPLATE_NAME = "changelog.html" | ||
TEMPLATE_LANG = ["en", "zh_cn"] | ||
CHANGELOG_FILENAME = ["changelog_data", "changelog_parser", "changelog_site"] | ||
|
||
|
||
class ChangelogGeneration: | ||
def __init__(self, env: Environment, template_name: str = TEMPLATE_NAME, template_lang: list = TEMPLATE_LANG, | ||
changelog_name: list = CHANGELOG_FILENAME): | ||
self.env = env | ||
self.template_name = template_name | ||
self.template_lang = template_lang | ||
self.changelog_filename = changelog_name | ||
|
||
def generate(self): | ||
for i in self.template_lang: | ||
template = self.env.get_template(f"page/{i}/{self.template_name}") | ||
|
||
for j in self.changelog_filename: | ||
filepath = f"dev_changelogs/{j}_{i}.json" | ||
with open(filepath, "r", encoding="UTF-8") as file: | ||
content = json.load(file) | ||
html = template.render(changelog=content) | ||
|
||
os.makedirs(f"data_html/{i}", exist_ok=True) | ||
with open(f"data_html/{i}/{j}.html", "w", encoding="UTF-8") as file: | ||
file.write(html) |
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,67 @@ | ||
class TemplateEn: | ||
@staticmethod | ||
def filetype_to_name(filetype): | ||
filetype = str(filetype) | ||
filetype_dict = { | ||
"1": "OST", | ||
"2": "Short Animation", | ||
"3": "Animation", | ||
"4": "Other", | ||
"11": "Main", | ||
"12": "Side", | ||
"13": "Short", | ||
"14": "Event", | ||
"15": "Bond", | ||
"16": "Other" | ||
} | ||
|
||
return filetype_dict[filetype] | ||
|
||
@staticmethod | ||
def tracktype_to_name(track_type): | ||
track_type = str(track_type) | ||
track_type_dict = { | ||
"0": "OST", | ||
"1": "Short Animation", | ||
"2": "Animation", | ||
"3": "Other", | ||
} | ||
|
||
return track_type_dict[track_type] | ||
|
||
class TemplateZhCn: | ||
@staticmethod | ||
def filetype_to_name(filetype): | ||
filetype = str(filetype) | ||
filetype_dict = { | ||
"1": "OST", | ||
"2": "短篇动画", | ||
"3": "动画", | ||
"4": "其它", | ||
"11": "主线", | ||
"12": "支线", | ||
"13": "短篇", | ||
"14": "活动", | ||
"15": "羁绊", | ||
"16": "其它" | ||
} | ||
|
||
return filetype_dict[filetype] | ||
|
||
@staticmethod | ||
def tracktype_to_name(track_type): | ||
track_type = str(track_type) | ||
track_type_dict = { | ||
"0": "OST", | ||
"1": "短篇动画", | ||
"2": "动画", | ||
"3": "其它", | ||
} | ||
|
||
return track_type_dict[track_type] | ||
|
||
|
||
ALL_FUNC_EN = {"filetype_to_name": TemplateEn.filetype_to_name, | ||
"tracktype_to_name": TemplateEn.tracktype_to_name} | ||
ALL_FUNC_ZHCN = {"filetype_to_name": TemplateZhCn.filetype_to_name, | ||
"tracktype_to_name": TemplateZhCn.tracktype_to_name} |
Oops, something went wrong.