Skip to content

Commit

Permalink
2023-10-29 quick bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sctop committed Oct 29, 2023
1 parent d9a2799 commit 683462c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from jinja2 import Environment, FileSystemLoader
from urllib.parse import urljoin

ALL_LANGS = ["en", "zh_cn"]
ALL_LANGS = ["zh_cn"]

filename_to_filetype = {
"album.html": [5],
Expand Down
13 changes: 7 additions & 6 deletions main_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def py_tooltip_background(background, instance_id, instance_type, extra_data):

for (index, part) in enumerate(story["part"], 1):
add_part, seg_index = 0, -1
for (index, segment) in enumerate(part["data"], 1):
for (index2, segment) in enumerate(part["data"], 1):
is_exit = 0
for bg in segment["background"]:
if bg["uuid"] == background["uuid"]:
Expand All @@ -156,8 +156,9 @@ def py_tooltip_background(background, instance_id, instance_type, extra_data):
if is_exit:
break
if is_exit:
seg_index = index
seg_index = index2
break

if seg_index != -1:
story_parts.append([part, index, seg_index, 0])
if len(story_parts) != 0:
Expand All @@ -175,7 +176,7 @@ def py_tooltip_track(track, instance_id, instance_type, extra_data):

for (index, part) in enumerate(story["part"], 1):
seg_index = -1
for (index, segment) in enumerate(part["data"], 1):
for (index2, segment) in enumerate(part["data"], 1):
is_exit = 0
for story_track in segment["track"]:
if story_track["instance_id"] == track["instance_id"]:
Expand All @@ -201,7 +202,7 @@ def py_tooltip_track(track, instance_id, instance_type, extra_data):
if is_exit:
break
if is_exit:
seg_index = index
seg_index = index2
break

if seg_index != -1:
Expand Down Expand Up @@ -229,15 +230,15 @@ def py_tooltip_character(character, instance_id, instance_type, extra_data):
related_parts = []
for (index, part) in enumerate(story["part"], 1):
seg_index = -1
for (index, segment) in enumerate(part["data"], 1):
for (index2, segment) in enumerate(part["data"], 1):
is_exit = 0
for char in segment["character"]:
if char["uuid"] == char_data["uuid"]:
is_exit = 1
break

if is_exit:
seg_index = index
seg_index = index2

if seg_index != -1:
related_parts.append([part, index, seg_index, 0])
Expand Down
6 changes: 3 additions & 3 deletions template/zh_cn/_macro.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% macro generate_story_url(story) %}{{ py_generate_story_url(curr_lang, story) }}{% endmacro %}

{# 通用的Story名称生成 #}
{% macro generate_story_name(story) %}{% set ft = story.filetype %}{% if ft == 15 %}<span><img src="/static/images/student/icon/{{ story.student.image.collection_texture }}.webp" class="icon-stu">{{ auto_zhcn_gen(story.student.name.personal_name) }}的第{{ story.pos.no }}个羁绊故事:{{ auto_zhcn_gen(story.name) }}</span>{% elif ft == 14 %}<span>活动{{ auto_zhcn_gen(story.parent_data.0.name) }}&nbsp;第{{ story.pos.segment }}个故事:{{ auto_zhcn_gen(story.name) }}</span>{% else %}{{ filetype_to_name(ft) }}故事&nbsp;第{{ story.pos.volume }}篇&nbsp;第{{ story.pos.chapter }}章&nbsp;第E{{ story.pos.segment }}话:{{ auto_zhcn_gen(story.name) }}{% endif %}{% endmacro %}
{% macro generate_story_name(story) %}{% set ft = story.filetype %}{% if ft == 15 %}<span><img src="/static/images/student/icon/{{ story.student.image.collection_texture }}.webp" class="icon-stu">{{ auto_zhcn_gen(story.student.name.personal_name) }}的第{{ story.pos.no }}个羁绊故事:{{ auto_zhcn_gen(story.name) }}</span>{% elif ft == 14 %}<span>活动{{ auto_zhcn_gen(story.parent_data.0.name) }}&nbsp;第{{ story.pos.segment }}个故事:{{ auto_zhcn_gen(story.name) }}</span>{% else %}{{ filetype_to_name(ft) }}故事&nbsp;第{{ story.pos.volume }}篇&nbsp;第{{ story.pos.chapter }}章&nbsp;{{ story.pos.segment }}话:{{ auto_zhcn_gen(story.name) }}{% endif %}{% endmacro %}

{# 通用的UI <a>生成 #}
{% macro generate_ui_anchor(ui) %}
Expand Down Expand Up @@ -125,7 +125,7 @@

{# 通用的Tag <a>生成 #}
{% macro tag_altogether(tags, instance_id) %}
{% for tag in tags %}<a href="/en/tag/{{ tag.namespace[-1] }}.html{% if instance_id %}#{{ instance_id }}{% endif %}" target="_blank"><span class="badge badge-{{ tag.color_css }} badge-tag">{{ auto_zhcn_gen(tag.name) }}</span></a>&nbsp;{% endfor %}
{% for tag in tags %}<a href="/{{ curr_lang }}/tag/{{ tag.namespace[-1] }}.html{% if instance_id %}#{{ instance_id }}{% endif %}" target="_blank"><span class="badge badge-{{ tag.color_css }} badge-tag">{{ auto_zhcn_gen(tag.name) }}</span></a>&nbsp;{% endfor %}
{% endmacro %}

{# 平铺人物<a>生成 #}
Expand All @@ -142,6 +142,6 @@

{% for char in char_for_show[:-1] %}<span>{{ generate_character_anchor(char, 0, 0, 0, 0, 0, 0, 0) }}&nbsp;|&nbsp;</span>{% endfor %}
{{ generate_character_anchor(char_for_show[-1], 0, 0, 0, 0, 0, 0, 0) }}
{% if characters|length > char_for_show|length %}<span>&nbsp;and more.</span>{% endif %}
{% if characters|length > char_for_show|length %}<span>&nbsp;及更多人。</span>{% endif %}
{% endif %}
{% endmacro %}

0 comments on commit 683462c

Please sign in to comment.