Skip to content

Add InputNormalizer.plain_text and normalize_whitespace - #30

Merged
sethherr merged 4 commits into
mainfrom
sanitize_with_whitespace
Aug 12, 2026
Merged

Add InputNormalizer.plain_text and normalize_whitespace#30
sethherr merged 4 commits into
mainfrom
sanitize_with_whitespace

Conversation

@sethherr

@sethherr sethherr commented Aug 12, 2026

Copy link
Copy Markdown
Member

Adds two Binxtils::InputNormalizer methods for HTML bodies where the line structure is part of the content (an email body, a pasted bug report) — sanitize flattens those onto a single line.

  • plain_text(value = nil) — strips the tags, unescapes the entities with CGI.unescapeHTML, then normalizes the whitespace. It's plain text rather than escaped HTML, so it differs from sanitize on more than whitespace: every entity is decoded and angle brackets stay literal. Kept as its own method rather than a sanitize keyword, so no call site has to read a flag to know which of the two it's getting back.
  • normalize_whitespace(value = nil)  becomes a space (so an HTML email's "blank" lines actually strip), each line is stripped, and runs of blank lines collapse to one. Public rather than concealed, since bug_report.rb calls it directly from body_significant_tags?.

sethherr and others added 3 commits August 12, 2026 08:26
The placeholder example called sanitize rather than the new method, so it
was failing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JaPDxxSr3thh2CstJtaE1z
The old name advertised one of three ways it differs from sanitize. It also
decodes every entity and leaves angle brackets literal, which "plain text"
covers in one word. Nothing calls it yet - it isn't in the v0.6.0 tag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JaPDxxSr3thh2CstJtaE1z
@sethherr sethherr changed the title Add InputNormalizer.sanitize_with_whitespace Add InputNormalizer.plain_text Aug 12, 2026
bug_report.rb in bike_index calls it directly from body_significant_tags?,
so concealing it would leave a second copy of the same one-liner there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JaPDxxSr3thh2CstJtaE1z
@sethherr sethherr changed the title Add InputNormalizer.plain_text Add InputNormalizer.plain_text and normalize_whitespace Aug 12, 2026
@sethherr
sethherr marked this pull request as ready for review August 12, 2026 17:05
@sethherr
sethherr merged commit da34f5e into main Aug 12, 2026
4 checks passed
@sethherr
sethherr deleted the sanitize_with_whitespace branch August 12, 2026 17:05
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