postloop 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. {postloop-0.1.0/src/postloop.egg-info → postloop-0.2.0}/PKG-INFO +5 -1
  2. {postloop-0.1.0 → postloop-0.2.0}/README.md +4 -0
  3. {postloop-0.1.0 → postloop-0.2.0}/pyproject.toml +1 -1
  4. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/commands.py +8 -2
  5. postloop-0.2.0/src/postloop/htmlreport.py +230 -0
  6. {postloop-0.1.0 → postloop-0.2.0/src/postloop.egg-info}/PKG-INFO +5 -1
  7. {postloop-0.1.0 → postloop-0.2.0}/src/postloop.egg-info/SOURCES.txt +1 -0
  8. {postloop-0.1.0 → postloop-0.2.0}/tests/test_report_bootstrap.py +24 -0
  9. {postloop-0.1.0 → postloop-0.2.0}/LICENSE +0 -0
  10. {postloop-0.1.0 → postloop-0.2.0}/setup.cfg +0 -0
  11. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/__init__.py +0 -0
  12. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/adapters.py +0 -0
  13. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/bootstrap.py +0 -0
  14. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/cli.py +0 -0
  15. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/config.py +0 -0
  16. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/insights.py +0 -0
  17. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/matching.py +0 -0
  18. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/models.py +0 -0
  19. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/notify.py +0 -0
  20. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/output.py +0 -0
  21. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/plan.py +0 -0
  22. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/reconcile.py +0 -0
  23. {postloop-0.1.0 → postloop-0.2.0}/src/postloop/tabular.py +0 -0
  24. {postloop-0.1.0 → postloop-0.2.0}/src/postloop.egg-info/dependency_links.txt +0 -0
  25. {postloop-0.1.0 → postloop-0.2.0}/src/postloop.egg-info/entry_points.txt +0 -0
  26. {postloop-0.1.0 → postloop-0.2.0}/src/postloop.egg-info/requires.txt +0 -0
  27. {postloop-0.1.0 → postloop-0.2.0}/src/postloop.egg-info/top_level.txt +0 -0
  28. {postloop-0.1.0 → postloop-0.2.0}/tests/test_adapters.py +0 -0
  29. {postloop-0.1.0 → postloop-0.2.0}/tests/test_matching.py +0 -0
  30. {postloop-0.1.0 → postloop-0.2.0}/tests/test_plan.py +0 -0
  31. {postloop-0.1.0 → postloop-0.2.0}/tests/test_reconcile.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: postloop
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Plan, check and learn from your community's social media posts.
5
5
  Author: Winnie
6
6
  License-Expression: MIT
@@ -140,6 +140,10 @@ the top posts by **organic** views (Meta exports say how many views came from
140
140
  ads), boosted posts, post types, posts per month and the longest stretches with
141
141
  no posts. It saves `post_report.md` and a CSV with every post.
142
142
 
143
+ Add `--html` to also save `post_report.html`: the same report as one page with
144
+ charts, to send to your team. It is a single file with no scripts and nothing
145
+ loaded from the internet, so it opens offline and is safe to attach or share.
146
+
143
147
  ## Plan next year from last year
144
148
 
145
149
  A yearly event posts much the same things each year. Turn last year's posts into
@@ -108,6 +108,10 @@ the top posts by **organic** views (Meta exports say how many views came from
108
108
  ads), boosted posts, post types, posts per month and the longest stretches with
109
109
  no posts. It saves `post_report.md` and a CSV with every post.
110
110
 
111
+ Add `--html` to also save `post_report.html`: the same report as one page with
112
+ charts, to send to your team. It is a single file with no scripts and nothing
113
+ loaded from the internet, so it opens offline and is safe to attach or share.
114
+
111
115
  ## Plan next year from last year
112
116
 
113
117
  A yearly event posts much the same things each year. Turn last year's posts into
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "postloop"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "Plan, check and learn from your community's social media posts."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,6 +1,6 @@
1
1
  """`postloop report` and `postloop bootstrap`: work from platform exports alone, no calendar needed.
2
2
 
3
- postloop report --posts facebook.csv instagram.csv
3
+ postloop report --posts facebook.csv instagram.csv [--html]
4
4
  postloop bootstrap --posts facebook.csv --event-date 2026-10-17 --next-event 2027-10-16
5
5
  """
6
6
 
@@ -14,6 +14,7 @@ from pathlib import Path
14
14
  from .adapters import load_many
15
15
  from .bootstrap import draft_calendar, summary, write_draft_csv
16
16
  from .config import Config, load_config
17
+ from .htmlreport import to_html
17
18
  from .insights import analyze, to_markdown, write_posts_table
18
19
 
19
20
 
@@ -42,6 +43,7 @@ def report(argv: list[str]) -> int:
42
43
  p.add_argument("--top", type=int, default=5, help="how many top posts to list per platform")
43
44
  p.add_argument("--gap-days", type=int, default=14, help="report stretches with no posts longer than this")
44
45
  p.add_argument("--out", default="post_report", help="output path without extension (.md and .csv are written)")
46
+ p.add_argument("--html", action="store_true", help="also save the report as one HTML page to share")
45
47
  args = p.parse_args(argv)
46
48
  try:
47
49
  config, posts = _setup(args)
@@ -54,7 +56,11 @@ def report(argv: list[str]) -> int:
54
56
  out = Path(args.out)
55
57
  out.with_suffix(".md").write_text(text, encoding="utf-8")
56
58
  write_posts_table(results, out.with_suffix(".csv"))
57
- print(f"Saved {out.with_suffix('.md')} and {out.with_suffix('.csv')}", file=sys.stderr)
59
+ saved = [out.with_suffix(".md"), out.with_suffix(".csv")]
60
+ if args.html:
61
+ out.with_suffix(".html").write_text(to_html(results, config.language, args.gap_days), encoding="utf-8")
62
+ saved.append(out.with_suffix(".html"))
63
+ print("Saved " + ", ".join(str(s) for s in saved), file=sys.stderr)
58
64
  return 0
59
65
 
60
66
 
@@ -0,0 +1,230 @@
1
+ """`postloop report --html`: the same report as one HTML page to share with the team.
2
+
3
+ The page is a single file with no scripts and nothing loaded from the internet,
4
+ so it opens offline, can be attached to an email or dropped in a shared drive,
5
+ and shows the same numbers as the Markdown report. Post titles come from the
6
+ platform exports, so every piece of text is escaped before it goes in.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from datetime import datetime
12
+ from html import escape
13
+
14
+ from . import __version__
15
+ from .insights import PLATFORM_NAMES, PlatformInsights, TEXT, engagement
16
+
17
+ HTML_TEXT = {
18
+ "en": {
19
+ "posts": "Posts",
20
+ "median_views": "Typical organic views",
21
+ "median_eng": "Typical reactions, comments & shares",
22
+ "boosted_n": "Boosted posts",
23
+ "organic": "Organic",
24
+ "paid": "From the ad",
25
+ "all_posts": "All {n} posts",
26
+ "col_date": "Date",
27
+ "col_title": "Post",
28
+ "col_type": "Type",
29
+ "col_views": "Organic views",
30
+ "col_vs": "vs typical",
31
+ "col_eng": "Engagement",
32
+ "made": "Made with postloop {v} on {d}",
33
+ "lang": "en",
34
+ },
35
+ "zh-TW": {
36
+ "posts": "貼文數",
37
+ "median_views": "一般貼文的自然觀看",
38
+ "median_eng": "一般貼文的心情、留言和分享",
39
+ "boosted_n": "加強推廣的貼文",
40
+ "organic": "自然觀看",
41
+ "paid": "廣告帶來",
42
+ "all_posts": "全部 {n} 篇貼文",
43
+ "col_date": "日期",
44
+ "col_title": "貼文",
45
+ "col_type": "類型",
46
+ "col_views": "自然觀看",
47
+ "col_vs": "與一般貼文相比",
48
+ "col_eng": "互動",
49
+ "made": "由 postloop {v} 產生於 {d}",
50
+ "lang": "zh-Hant-TW",
51
+ },
52
+ }
53
+
54
+ CSS = """
55
+ :root {
56
+ color-scheme: light;
57
+ --surface: #fcfcfb; --surface-2: #f3f2ee; --line: #e3e1da;
58
+ --text: #0b0b0b; --text-2: #52514e; --text-3: #7a7873;
59
+ --organic: #2a78d6; --paid: #eb6834; --link: #1f5fae;
60
+ }
61
+ @media (prefers-color-scheme: dark) {
62
+ :root:not([data-theme="light"]) {
63
+ color-scheme: dark;
64
+ --surface: #1a1a19; --surface-2: #242422; --line: #34332f;
65
+ --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8d86;
66
+ --organic: #3987e5; --paid: #d95926; --link: #7fb0f0;
67
+ }
68
+ }
69
+ :root[data-theme="dark"] {
70
+ color-scheme: dark;
71
+ --surface: #1a1a19; --surface-2: #242422; --line: #34332f;
72
+ --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f8d86;
73
+ --organic: #3987e5; --paid: #d95926; --link: #7fb0f0;
74
+ }
75
+ * { box-sizing: border-box; }
76
+ body { margin: 0; background: var(--surface); color: var(--text);
77
+ font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif; }
78
+ main { max-width: 960px; margin: 0 auto; padding: 32px 16px 64px; }
79
+ h1 { font-size: 28px; margin: 0 0 4px; }
80
+ h2 { font-size: 22px; margin: 48px 0 4px; padding-top: 24px; border-top: 1px solid var(--line); }
81
+ h3 { font-size: 16px; margin: 32px 0 12px; color: var(--text-2); }
82
+ a { color: var(--link); }
83
+ .sub { color: var(--text-2); margin: 0; }
84
+ .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
85
+ .tile { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; }
86
+ .tile .v { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
87
+ .tile .k { color: var(--text-2); font-size: 14px; }
88
+ .bars { display: grid; gap: 10px; }
89
+ .bar-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
90
+ .bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
91
+ .bar-label .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
92
+ .bar-label .n { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
93
+ .track { display: flex; gap: 2px; height: 12px; }
94
+ .seg { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
95
+ .seg.organic { background: var(--organic); }
96
+ .seg.paid { background: var(--paid); }
97
+ .track .seg:not(:last-child) { border-radius: 0; }
98
+ .legend { display: flex; gap: 16px; font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
99
+ .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
100
+ .months { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 18px; border-bottom: 1px solid var(--line); }
101
+ .month { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
102
+ .month .col { width: 100%; max-width: 36px; background: var(--organic); border-radius: 4px 4px 0 0; }
103
+ .month .c { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
104
+ .month-axis { display: flex; gap: 6px; }
105
+ .month-axis span { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); min-width: 0; overflow: hidden; }
106
+ ul.plain { list-style: none; padding: 0; margin: 0; }
107
+ ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
108
+ details { margin-top: 24px; }
109
+ summary { cursor: pointer; color: var(--text-2); }
110
+ .table-wrap { overflow-x: auto; }
111
+ table { border-collapse: collapse; width: 100%; font-size: 14px; margin-top: 12px; }
112
+ th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
113
+ th { color: var(--text-2); font-weight: 600; }
114
+ td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
115
+ .note { color: var(--text-3); font-size: 14px; margin-top: 48px; }
116
+ """
117
+
118
+
119
+ def _link(text: str, url: str) -> str:
120
+ """A link only for real web addresses: export files are not trusted input."""
121
+ safe = escape(text)
122
+ if url.startswith(("https://", "http://")):
123
+ return f'<a href="{escape(url, quote=True)}">{safe}</a>'
124
+ return safe
125
+
126
+
127
+ def _pct(part: float, whole: float) -> str:
128
+ return f"{100 * part / whole:.2f}%" if whole else "0%"
129
+
130
+
131
+ def _platform(r: PlatformInsights, t: dict, h: dict, gap_days: int) -> str:
132
+ base = r.median_views_organic or 1
133
+ first, last = r.posts[0].published_at.date(), r.posts[-1].published_at.date()
134
+ out = [
135
+ f"<h2>{escape(PLATFORM_NAMES.get(r.platform, r.platform))}</h2>",
136
+ f'<p class="sub">{escape(t["period"].format(n=len(r.posts), first=first, last=last))}</p>',
137
+ '<div class="tiles">',
138
+ f'<div class="tile"><div class="v">{len(r.posts):,}</div><div class="k">{h["posts"]}</div></div>',
139
+ f'<div class="tile"><div class="v">{round(r.median_views_organic):,}</div>'
140
+ f'<div class="k">{h["median_views"]}</div></div>',
141
+ f'<div class="tile"><div class="v">{round(r.median_engagement):,}</div>'
142
+ f'<div class="k">{h["median_eng"]}</div></div>',
143
+ f'<div class="tile"><div class="v">{len(r.boosted):,}</div><div class="k">{h["boosted_n"]}</div></div>',
144
+ "</div>",
145
+ ]
146
+
147
+ # Top posts: one bar each, organic views only, against the biggest one.
148
+ out.append(f"<h3>{escape(t['top'])}</h3><div class=\"bars\">")
149
+ peak = max((p.views_organic for p in r.top), default=0)
150
+ for p in r.top:
151
+ times = escape(t["times"].format(x=p.views_organic / base))
152
+ tip = f"{p.published_at:%Y-%m-%d} · {p.views_organic:,} · {times}"
153
+ out.append(
154
+ f'<div class="bar-row" title="{escape(tip, quote=True)}">'
155
+ f'<div class="bar-label"><span class="t">{p.published_at:%m/%d} · {_link(p.headline, p.url)}</span>'
156
+ f'<span class="n">{p.views_organic:,} · {times}</span></div>'
157
+ f'<div class="track"><div class="seg organic" style="width:{_pct(p.views_organic, peak)}"></div></div>'
158
+ "</div>"
159
+ )
160
+ out.append("</div>")
161
+
162
+ # Boosted posts: organic and paid views side by side in one bar.
163
+ if r.boosted:
164
+ out.append(f"<h3>{escape(t['boosted'])}</h3>")
165
+ out.append(f'<div class="legend"><span><i style="background:var(--organic)"></i>{h["organic"]}</span>'
166
+ f'<span><i style="background:var(--paid)"></i>{h["paid"]}</span></div><div class="bars">')
167
+ peak = max(p.views for p in r.boosted)
168
+ for p in r.boosted:
169
+ line = escape(t["boosted_line"].format(share=p.views_boosted / p.views if p.views else 0, views=p.views))
170
+ tip = f"{h['organic']} {p.views_organic:,} · {h['paid']} {p.views_boosted:,}"
171
+ out.append(
172
+ f'<div class="bar-row" title="{escape(tip, quote=True)}">'
173
+ f'<div class="bar-label"><span class="t">{p.published_at:%m/%d} · {_link(p.headline, p.url)}</span>'
174
+ f'<span class="n">{line}</span></div>'
175
+ f'<div class="track"><div class="seg organic" style="width:{_pct(p.views_organic, peak)}"></div>'
176
+ f'<div class="seg paid" style="width:{_pct(p.views_boosted, peak)}"></div></div>'
177
+ "</div>"
178
+ )
179
+ out.append("</div>")
180
+
181
+ # Posts per month: a small column chart with the count on each column.
182
+ out.append(f"<h3>{escape(t['months'])}</h3><div class=\"months\">")
183
+ most = max(r.per_month.values(), default=1)
184
+ for m, n in r.per_month.items():
185
+ out.append(f'<div class="month" title="{m}: {n}"><span class="c">{n}</span>'
186
+ f'<div class="col" style="height:{_pct(n, most)}"></div></div>')
187
+ out.append('</div><div class="month-axis">')
188
+ out += [f"<span>{m[2:]}</span>" for m in r.per_month]
189
+ out.append("</div>")
190
+
191
+ if any(k != "?" for k in r.by_type):
192
+ out.append(f"<h3>{escape(t['types'])}</h3><ul class=\"plain\">")
193
+ out += [f"<li>{escape(k)}: {escape(t['types_line'].format(n=n, views=round(v)))}</li>"
194
+ for k, (n, v) in r.by_type.items()]
195
+ out.append("</ul>")
196
+
197
+ out.append(f"<h3>{escape(t['gaps'])}</h3><ul class=\"plain\">")
198
+ lines = [t["gap_line"].format(days=g.days, start=g.start, end=g.end) for g in r.gaps[:5]]
199
+ out += [f"<li>{escape(x)}</li>" for x in lines] or [f"<li>{escape(t['no_gaps'].format(d=gap_days))}</li>"]
200
+ out.append("</ul>")
201
+
202
+ # Every post, as a table: the same numbers without needing the charts.
203
+ out.append(f"<details><summary>{escape(h['all_posts'].format(n=len(r.posts)))}</summary>"
204
+ '<div class="table-wrap"><table><thead><tr>'
205
+ f'<th>{h["col_date"]}</th><th>{h["col_title"]}</th><th>{h["col_type"]}</th>'
206
+ f'<th class="num">{h["col_views"]}</th><th class="num">{h["col_vs"]}</th>'
207
+ f'<th class="num">{h["col_eng"]}</th></tr></thead><tbody>')
208
+ for p in sorted(r.posts, key=lambda p: p.published_at, reverse=True):
209
+ out.append(f"<tr><td class=\"num\">{p.published_at:%Y-%m-%d}</td><td>{_link(p.headline, p.url)}</td>"
210
+ f"<td>{escape(p.type)}</td><td class=\"num\">{p.views_organic:,}</td>"
211
+ f"<td class=\"num\">{p.views_organic / base:.1f}×</td>"
212
+ f"<td class=\"num\">{engagement(p):,}</td></tr>")
213
+ out.append("</tbody></table></div></details>")
214
+ return "\n".join(out)
215
+
216
+
217
+ def to_html(results: list[PlatformInsights], language: str = "en", gap_days: int = 14,
218
+ today: datetime | None = None) -> str:
219
+ t = TEXT.get(language, TEXT["en"])
220
+ h = HTML_TEXT.get(language, HTML_TEXT["en"])
221
+ made = h["made"].format(v=__version__, d=f"{today or datetime.now():%Y-%m-%d}")
222
+ body = "\n".join(_platform(r, t, h, gap_days) for r in results)
223
+ return (
224
+ f'<!doctype html>\n<html lang="{h["lang"]}">\n<head>\n<meta charset="utf-8">\n'
225
+ '<meta name="viewport" content="width=device-width, initial-scale=1">\n'
226
+ f"<title>{escape(t['title'])}</title>\n<style>{CSS}</style>\n</head>\n<body>\n<main>\n"
227
+ f"<h1>{escape(t['title'])}</h1>\n{body}\n"
228
+ f'<p class="note">{escape(t["note"])}<br>{escape(made)}</p>\n'
229
+ "</main>\n</body>\n</html>\n"
230
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: postloop
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Plan, check and learn from your community's social media posts.
5
5
  Author: Winnie
6
6
  License-Expression: MIT
@@ -140,6 +140,10 @@ the top posts by **organic** views (Meta exports say how many views came from
140
140
  ads), boosted posts, post types, posts per month and the longest stretches with
141
141
  no posts. It saves `post_report.md` and a CSV with every post.
142
142
 
143
+ Add `--html` to also save `post_report.html`: the same report as one page with
144
+ charts, to send to your team. It is a single file with no scripts and nothing
145
+ loaded from the internet, so it opens offline and is safe to attach or share.
146
+
143
147
  ## Plan next year from last year
144
148
 
145
149
  A yearly event posts much the same things each year. Turn last year's posts into
@@ -7,6 +7,7 @@ src/postloop/bootstrap.py
7
7
  src/postloop/cli.py
8
8
  src/postloop/commands.py
9
9
  src/postloop/config.py
10
+ src/postloop/htmlreport.py
10
11
  src/postloop/insights.py
11
12
  src/postloop/matching.py
12
13
  src/postloop/models.py
@@ -9,6 +9,7 @@ import pytest
9
9
  from postloop.adapters import load_posts
10
10
  from postloop.bootstrap import _bump_year, draft_calendar, write_draft_csv
11
11
  from postloop.cli import main
12
+ from postloop.htmlreport import to_html
12
13
  from postloop.insights import analyze, to_markdown
13
14
  from postloop.models import PublishedPost
14
15
 
@@ -114,3 +115,26 @@ def test_cli_bad_input_is_one_line_not_a_traceback(export, tmp_path, capsys):
114
115
  bad.write_text("foo = 1\n", encoding="utf-8")
115
116
  assert main(["--plan", str(calendar), "--posts", str(export), "--config", str(bad)]) == 2
116
117
  assert "Unknown settings" in capsys.readouterr().err
118
+
119
+
120
+ def test_html_report(posts):
121
+ page = to_html(analyze(posts, top_n=2), "en")
122
+ assert page.startswith("<!doctype html>") and "<title>Post report</title>" in page
123
+ assert "Keynote #1" in page and 'href="https://fb/3"' in page
124
+ assert "80% of 10,000 views were paid" in page # the boosted post
125
+ assert "<script" not in page and "http://" not in page.split("<style>")[0] # nothing loaded from outside
126
+
127
+
128
+ def test_html_report_escapes_titles_and_skips_unsafe_links():
129
+ post = PublishedPost(post_id="1", platform="facebook", message="<script>alert(1)</script> & more",
130
+ published_at=datetime(2026, 8, 10, 16, tzinfo=TAIPEI), views=10,
131
+ url="javascript:alert(1)")
132
+ page = to_html(analyze([post]), "zh-TW")
133
+ assert "<script>alert" not in page and "&lt;script&gt;" in page
134
+ assert "javascript:" not in page and "貼文成效報告" in page
135
+
136
+
137
+ def test_cli_report_html(export, tmp_path):
138
+ assert main(["report", "--posts", str(export), "--timezone", "Asia/Taipei", "--html",
139
+ "--out", str(tmp_path / "r")]) == 0
140
+ assert (tmp_path / "r.html").read_text(encoding="utf-8").startswith("<!doctype html>")
File without changes
File without changes
File without changes
File without changes
File without changes