mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 08:47:33 +00:00
Extract responsibilities that were inlined during the no-split optimization:
- parseParagraphLine(): encapsulates single-line parsing (trimEnd, empty
check, fast path, word classification) so findTextSegments() becomes a
clean newline-scanning loop.
- isAllPlainText(): names the first-pass "all words plain?" loop that was
previously embedded inside parseParagraphLine.
- isPlainWord(): renames isRegularByIndex() — the "ByIndex" suffix was an
implementation detail; the new name states what the function checks.
- mergeIfAllRegular(): extracts the post-processing lambda in
findTextSegments that re-joins all-RegularTextSegment paragraphs.
- parseSchemelessUrl(): extracts the 8-line nested schemeless-URL block
from wordIdentifier() into its own function returning nullable.
Additional cleanup:
- Add category section comments to wordIdentifier() (media, emoji,
Lightning/Cashu, Nostr/NIP-19, contact info, schemeless URL).
- Rename removeQueryParamsForExtensionComparison() →
stripUrlForExtensionCheck(); also strips # fragments, which the old
name didn't mention. Update all three call sites.
- Group companion object members with section headers (date/number
patterns, file extensions, URL patterns, Nostr/NIP-19, hash tags).
- Remove stale comments that referenced the old split()-based
implementation ("mirror ... from the original", etc.).
No behavior or performance changes.
https://claude.ai/code/session_01NXsow7yLBd6ModmGSsqR9g