#!/usr/bin/env python3
"""JCAI one-pager 目标件的底线自检 —— 只守底线,不管设计。
目标件是「带脚本演示页」(照仓里 PRD 方法论):允许 ', ' ', html, flags=re.I)
def visible_text(html):
"""人看得见的正文:去脚本、去注释、去 ', ' ', h, flags=re.I)
return re.sub(r'<[^>]*>', ' ', h)
def run(path):
html = Path(path).read_text(encoding='utf-8')
markup = strip_scripts(html) # 剥掉脚本后的标记面(内联事件/外链在这上面查)
text = visible_text(html)
styles = ''.join(re.findall(r'', html, re.I))
checks = []
def c(name, passed, evidence=''):
checks.append({'text': name, 'passed': bool(passed), 'evidence': str(evidence)})
m = re.search(r'https?://', html, re.I)
c('无外链(样式/字体/图标/脚本全内联)', not m, m.group(0) if m else '0 命中')
m = re.search(r'\son[a-z]+=', markup, re.I)
c('无内联事件处理器(脚本集中在 script 标签里,平移一剥就净)', not m,
m.group(0) if m else '0 命中')
c('standalone 可直接打开(doctype + charset)',
html.lstrip().lower().startswith(' 在)', '