fix
This commit is contained in:
parent
8959124a15
commit
40f123d4e4
6
sync.py
6
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
|
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({
|
change_blocks.append({
|
||||||
'id': change_block_id,
|
'id': change_block_id,
|
||||||
'line': i,
|
'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)
|
'count': len(additions_list)
|
||||||
})
|
})
|
||||||
|
|
||||||
for idx, addition_content in enumerate(additions_list):
|
for idx, addition_item in enumerate(additions_list):
|
||||||
html += f'<div class="line-wrapper blank-placeholder change-block" data-change-id="{change_block_id}">'
|
html += f'<div class="line-wrapper blank-placeholder change-block" data-change-id="{change_block_id}">'
|
||||||
html += '<div class="main-line">'
|
html += '<div class="main-line">'
|
||||||
html += '<span class="line-number"> </span>' # 不显示行号
|
html += '<span class="line-number"> </span>' # 不显示行号
|
||||||
|
|
@ -1007,6 +1008,7 @@ def create_diff_html(title, en_diff, en_old_lines, en_new_lines, cn_content=None
|
||||||
html += '</div>'
|
html += '</div>'
|
||||||
|
|
||||||
# 为空白行添加对应的新增批注
|
# 为空白行添加对应的新增批注
|
||||||
|
addition_content = addition_item.get('content', '') # 只取内容字段
|
||||||
escaped_addition = html_escape(addition_content)
|
escaped_addition = html_escape(addition_content)
|
||||||
html += '<div class="annotation">'
|
html += '<div class="annotation">'
|
||||||
html += f'<div class="annotation-item added">'
|
html += f'<div class="annotation-item added">'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue