Trim a summary field to full sentences under a character limit rather than just a number of words or characters

Use case: Migrate first sentences (up to 200 characters, but only full sentences) of program description fields to findit_program short summary


I thought Smart Trim did this but it explicitly rejects being that smart, this naive patch is as far as it got.

Search for a library just turned up a bunch of articles like

But if we first cut at 200, then search backwards for the first . , ? , or ! that should be plenty good enough.

Ah here’s a library on Packagist!