diff --git a/VERSION b/VERSION index 7179039..abd4105 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.3 +0.2.4 diff --git a/snooper_summary.py b/snooper_summary.py index 5c47505..47474d8 100644 --- a/snooper_summary.py +++ b/snooper_summary.py @@ -1066,7 +1066,10 @@ def summarize_messages( ] day_context = _day_context(target_day) if not rows and not calendar_events: - return f"# {target_day.isoformat()} 工作总结({day_context})\n\n本日未收到消息。\n" + return ( + f"# {target_day.isoformat()} 工作总结\n\n" + f"> {day_context}\n\n本日未收到消息。\n" + ) messages = [serialize_message(row, tz) for row in rows] groups: dict[str, list[dict[str, Any]]] = {} for message in messages: @@ -1278,13 +1281,17 @@ def summarize_messages( content = sanitize_wikilink_pipes( drop_casual_content(format_followup_checkboxes(shorten_headings(content))) ) - # Prepend day context to the title - if content.startswith("# "): - content = content.replace( + # Keep day context out of the heading so calendar metadata is easy to hide. + if content.startswith(f"# {target_day.isoformat()}"): + lines = content.splitlines() + lines[0] = re.sub( + rf"^# {re.escape(target_day.isoformat())}([^)]*)", f"# {target_day.isoformat()}", - f"# {target_day.isoformat()}({day_context})", - 1, + lines[0], ) + lines.insert(1, "") + lines.insert(2, f"> {day_context}") + content = "\n".join(lines) + ("\n" if content.endswith("\n") else "") return content diff --git a/tests/test_summary.py b/tests/test_summary.py index 3481472..b187930 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -140,6 +140,8 @@ def test_system_only_private_chat_does_not_require_a_person_name(): ) assert "本日未收到消息" in result + assert result.startswith("# 2026-11-03 工作总结\n\n> 周二,工作日,交易日\n") + assert "工作总结(" not in result assert session.post_calls == []