feat: --footer/--header with {page}/{pages} placeholders, center-aligned

md2pdf.py:
- Expose --footer and --header (was dead code before)
- Remove --forms flag (B2 fix — weasyprint 68.1 silently drops <input>)
- Substitution support: {page} → counter(page), {pages} → counter(pages)
- Center-aligned via @bottom-center / @top-center

md2doc.py:
- Add --footer and --header support via Word field codes (PAGE, NUMPAGES)
- Center-aligned paragraph in footer/header
- Same {page}/{pages} substitution API as md2pdf

Both tools:
- GFM task list support: - [ ] → ☐, - [x]/- [X] → ☑ (synced _bulletize)
- Help text explains placeholder syntax with examples
This commit is contained in:
2026-07-28 11:02:23 +03:00
parent 21b3a7a77d
commit 5a62572f55
3 changed files with 518 additions and 30 deletions
+16
View File
@@ -28,3 +28,19 @@ def test_tilde_fence_also_preserved():
text = "~~~bash\n-x\n~~~\n"
result = _bulletize(text)
assert "-x" in result
def test_unchecked_task_list_becomes_empty_checkbox():
text = "- [ ] todo item\n"
result = _bulletize(text)
assert "☐ todo item" in result
assert "[ ]" not in result
def test_checked_task_list_becomes_checked_checkbox():
text = "- [x] done item\n- [X] also done\n"
result = _bulletize(text)
assert "☑ done item" in result
assert "☑ also done" in result
assert "[x]" not in result
assert "[X]" not in result