Skip to content

refactor: extract textFromContentStream into handler methods, remove dead code, add reference snapshot tests - #29

Merged
ymettier merged 4 commits into
mainfrom
kiss
Jul 30, 2026
Merged

refactor: extract textFromContentStream into handler methods, remove dead code, add reference snapshot tests#29
ymettier merged 4 commits into
mainfrom
kiss

Conversation

@ymettier

Copy link
Copy Markdown
Owner

Summary

Refactor textFromContentStream (282 → 61 lines) by extracting 16 handler methods into a textRenderer struct. Each handler is under 50 lines per KISS.

Changes

  • pdftotext: textRenderer struct with handler methods (handlePushCTM, handlePopCTM, handleConcatMatrix, handleSetFont, handleTextMove, handleSetTextMatrix, handleTextStar, handleQuoteSingle, handleQuoteDouble, handleShowText, renderTopString, etc.), parse6Numbers helper deduplicates cm/Tm matrix parsing, removed dead aw/ac parsing from "
  • logger: removed unused FromCtx/WithCtx/ctxKey abstraction (dead code, only called in tests)
  • main_test.go: extracted withArgs(t, args...) helper eliminating 57 lines of os.Args boilerplate across 19 tests
  • Tests: 10 reference snapshot tests comparing PDF text extraction against expected output, 100% coverage in pdftotext package

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ymettier
ymettier merged commit a63d1da into main Jul 30, 2026
6 checks passed
@ymettier
ymettier deleted the kiss branch July 30, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant