INNER CODE UNIT · Python
flush
kangarooking/cangjie-skill · scripts/build_chunks.py:46
def flush():
nonlocal buf, buf_type
content = "\n".join(buf).strip()
buf = []
if not content:
return
elements.append({
"element_id": f"el-{len(elements):06d}",
"type": buf_type,
"text": content,
"heading_path": [h for _, h in heading_stack],
"page": None,
"time_start_ms": None,
"time_end_ms": None,
"bbox": None,
"asset_ref": None,
"confidence": None,
"content_hash": f"sha256:{sha256_text(content)}",