# -*- coding: utf-8 -*-
import io, sys, os, re, html
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
B = r"D:\work buddy\2026-11-05-14-15-52"
h = open(os.path.join(B,"raw_unc.html"),encoding="utf-8").read()
i = h.find('id="byorgtextcontainer"')
j = h.find('id="bynametextcontainer"')
seg = h[i:j if j>0 else len(h)]
ps = re.findall(r'<p class="body"([^>]*)>(.*?)</p>', seg, re.S)
for k,(attr,p) in enumerate(ps):
    indent = "margin-left" in attr
    txt = re.sub(r"<[^>]+>","",p)
    txt = html.unescape(txt).replace("\xa0"," ")
    lead = len(txt)-len(txt.lstrip(" "))
    txt=txt.strip()
    flag = "SUB" if (indent or lead>=3) else "TOP"
    print(f"{k:3} {flag} lead={lead:2} | {txt[:78]}")
