feat: complete Task 6 list formatting with fallback detection and spacing

Implemented all missing list formatting features for Direct track:

1. Fallback List Detection (_is_list_item_fallback):
   - Check metadata for list_level, parent_item, children fields
   - Pattern matching for ordered (^\d+[\.\)]) and unordered (^[•·▪▫◦‣⁃\-\*]) lists
   - Auto-mark elements as LIST_ITEM if detected

2. Multi-line List Item Alignment:
   - Calculate list marker width before rendering
   - Add marker_width to subsequent line indentation (i > 0)
   - Ensures text after marker aligns properly across lines

3. Dedicated List Item Spacing:
   - Default 3pt spacing_after for list items
   - Applied by expanding bbox_height for visual spacing
   - Marked with _apply_spacing_after flag for tracking

Updated tasks.md with accurate implementation details and line numbers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-24 11:17:28 +08:00
parent 1ec186f680
commit 1ac8e82f47
2 changed files with 99 additions and 15 deletions

View File

@@ -100,15 +100,26 @@
### 6. List Formatting (Direct track only)
- [x] 6.1 Detect list elements from Direct track
- [x] 6.1.1 Identify LIST_ITEM elements (separate from text_elements, lines 636-637)
- [x] 6.1.2 Group list items by proximity and level (_draw_list_elements_direct, lines 1543-1570)
- [x] 6.1.3 Determine list type via regex on first item (ordered/unordered, lines 1582-1590)
- [x] 6.1.4 Extract indent level from metadata (list_level)
- [x] 6.1.2 Fallback detection via metadata and text patterns (_is_list_item_fallback, lines 1528-1567)
- [x] Check metadata for list_level, parent_item, children fields
- [x] Pattern matching for ordered lists (^\d+[\.\)]) and unordered (^[•·▪▫◦‣⁃\-\*])
- [x] Auto-mark as LIST_ITEM if detected (lines 638-642)
- [x] 6.1.3 Group list items by proximity and level (_draw_list_elements_direct, lines 1589-1610)
- [x] 6.1.4 Determine list type via regex on first item (ordered/unordered, lines 1628-1636)
- [x] 6.1.5 Extract indent level from metadata (list_level)
- [x] 6.2 Render lists with proper formatting
- [x] 6.2.1 Sequential numbering across list items (list_counter, lines 1593-1602)
- [x] 6.2.2 Add bullets/numbers as list markers (stored in _list_marker metadata, lines 1603-1607)
- [x] 6.2.3 Apply indentation (20pt per level, lines 1683-1687)
- [x] 6.2.4 Remove original markers from text content (lines 1671-1677)
- [x] 6.2.5 Maintain list spacing via proximity-based grouping (max_gap=30pt, lines 1551-1563)
- [x] 6.2.1 Sequential numbering across list items (list_counter, lines 1639-1665)
- [x] 6.2.2 Add bullets/numbers as list markers (stored in _list_marker metadata, lines 1649-1653)
- [x] 6.2.3 Apply indentation (20pt per level, lines 1738-1742)
- [x] 6.2.4 Multi-line list item alignment (marker_width calculation, lines 1755-1772)
- [x] Calculate marker width before rendering (line 1758)
- [x] Add marker_width to subsequent line indentation (lines 1770-1772)
- [x] 6.2.5 Remove original markers from text content (lines 1716-1723)
- [x] 6.2.6 Dedicated list item spacing (lines 1655-1662, 1764-1769)
- [x] Default 3pt spacing_after for list items
- [x] Applied by expanding bbox_height (line 1769)
- [x] Marked with _apply_spacing_after flag
- [x] 6.2.7 Maintain list grouping via proximity (max_gap=30pt, lines 1597-1607)
### 7. Span-Level Rendering (Advanced)
- [ ] 7.1 Extract span information from Direct track