{inline_djot(en.lstrip("# "))}
') elif kind == "sub": out.append(f'{inline_djot(en.lstrip("# "))}
') elif kind == "item": out.append(f'{inline_djot(en)}
') elif kind == "xy": # Blue bold label: "x.y ...。" prefix; rest black body. m = re.match(r"^(\d+\.\d+\s[^。]*。)(.*)$", cn) if m: cn_html = f'{inline_djot(m.group(1))}{inline_djot(m.group(2))}' else: cn_html = f'{inline_djot(cn)}' m2 = re.match(r"^(\d+\.\d+\s[^.]*\.)(.*)$", en) if m2 and m: en_html = f'{inline_djot(m2.group(1))}{inline_djot(m2.group(2))}' else: en_html = f'{inline_djot(en)}' if not m else inline_djot(en) out.append(f'{cn_html}
') out.append(f'{en_html}
') elif kind == "tabtitle": out.append(f'{inline_djot(text)}
') out.append(f'{inline_djot(en)}
') else: cls = ' class="cont"' if part and part.endswith("b") else "" out.append(f'{inline_djot(cn)}
') out.append(f'{inline_djot(en)}
') return "\n".join(out) def emit_table(): """Render the pipe table (lines 45-56); line 57 -> QR strip image. Each cell shows CN on the first line and EN below (muted). The first column uses rowspan like the merged cells in the original PDF.""" rows = [] for ln in TABLE_SRC_ROWS[:-1]: src, tgt = src_lines[ln - 1], tgt_lines[ln - 1] if re.match(r"^\|[-\s|]+\|$", src): continue # separator row cells_src = [c.strip() for c in src.strip().strip("|").split("|")] cells_tgt = [c.strip() for c in tgt.strip().strip("|").split("|")] rows.append((cells_src, cells_tgt)) # Compute first-column spans: a non-empty cell spans until the next non-empty one. spans = {} run_start = None for i in range(1, len(rows)): if rows[i][0][0]: if run_start is not None: spans[run_start] = i - run_start run_start = i if run_start is not None: spans[run_start] = len(rows) - run_start def cell(tag, c_cn, c_en, attrs=""): inner = inline_djot(c_cn) if c_en and c_en != c_cn: inner += f'
QR-code cards for the Master Jiqun and Mindful Peace International WhatsApp channels (one in Chinese and one in English for each)
') return "\n".join(out) def header(): return ('
'
'MPI 个人传灯实践课
'
f'{n}
{esc(src_lines[2].lstrip("-"))}
{esc(tgt_lines[0])}
{esc(tgt_lines[2].lstrip("-"))}