- Исправлена двойная обработка ITableRow через reflection - Исправлен выход за границы изображения при отрисовке последнего разделителя - Добавлена защита от пустых данных (header, blocks) - Добавлена compile-time проверка интерфейса ITableRow - Переименован tablle_block_style.go → table_block_style.go - Добавлены комментарии на русском ко всем функциям и типам - Написана документация README.md с примерами использования - Добавлен CLAUDE.md Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.7 KiB
1.7 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Go library for rendering data tables as PNG images. Provides two APIs:
DrawTableWarm()— renders a single table with header and rowsRenderDocument()— renders a multi-block document with titled table sections
Build & Test Commands
go test ./... # run all tests
go test -run TestDrawTable # run single test
go test -run TestDocument # run document rendering test
Tests output PNG files to test-data/ (gitignored). Verify rendering by inspecting the generated images visually.
Architecture
image_table.go— Core rendering engine.DrawTableWarm()draws a single table image. Contains font initialization (init()), text measurement/drawing utilities, rounded rect helper, and row-to-string conversion via reflection. Embedsassets/jb.ttf(JetBrains font) at compile time.document.go—RenderDocument()composes multipleTableBlocks into a single document image with titles, using a larger font face for block headings.table_block.go—TableBlockstruct: a titled table with header and rows.tablle_block_style.go—TableBlockStyleimplementsITableRowto allow per-row background colors.itablerow.go—ITableRowinterface for custom row rendering (cells + background color).
Key Patterns
- Rows accept
anytype: slices, structs (via reflection), orITableRowimplementors for custom styling. - Column widths are auto-calculated from content measurement.
- Two
init()functions parse the embedded TTF font at different sizes (10pt for table cells, 12pt for document titles). - Comments and identifiers are in Russian.