From 40f123d4e49e768ab7bedcd968d1f371e010b5e1 Mon Sep 17 00:00:00 2001 From: wdjwxh Date: Mon, 22 Dec 2025 10:25:47 +0800 Subject: [PATCH] fix --- sync.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sync.py b/sync.py index 7d02a89..cf189ad 100644 --- a/sync.py +++ b/sync.py @@ -990,7 +990,8 @@ def create_diff_html(title, en_diff, en_old_lines, en_new_lines, cn_content=None change_block_id += 1 # 添加变更块到导航列表 - preview_text = additions_list[0][:50] + "..." if len(additions_list[0]) > 50 else additions_list[0] + first_content = additions_list[0].get('content', '') if additions_list else '' + preview_text = first_content[:50] + "..." if len(first_content) > 50 else first_content change_blocks.append({ 'id': change_block_id, 'line': i, @@ -999,7 +1000,7 @@ def create_diff_html(title, en_diff, en_old_lines, en_new_lines, cn_content=None 'count': len(additions_list) }) - for idx, addition_content in enumerate(additions_list): + for idx, addition_item in enumerate(additions_list): html += f'
' html += '
' html += ' ' # 不显示行号 @@ -1007,6 +1008,7 @@ def create_diff_html(title, en_diff, en_old_lines, en_new_lines, cn_content=None html += '
' # 为空白行添加对应的新增批注 + addition_content = addition_item.get('content', '') # 只取内容字段 escaped_addition = html_escape(addition_content) html += '
' html += f'
'