text_summary will generate very small summaries if it doesn't encounter a stop character close to the given size.
ex:
LOREM, IP. - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
If text_summary is given a size that is after the first period, but before the second the summary becomes:
LOREM, UP.
Instead of something closer to the desired size.
Closely related core issue is worked on in: #1482178: text_summary does not break on word boundaries if the first sentence is longer than the length of the summary being produced
I created a new issue because the problem description did not match this bug (chopping text as opposed to unexpected behavior), and that issue is marked as Drupal 8.
Comments
Comment #0.0
steven.wichers CreditAttribution: steven.wichers commentedClarified why a new issue was created when a similar one exists
Comment #1
steinmb CreditAttribution: steinmb commentedThis issue is cross posted with #1482178: text_summary does not break on word boundaries if the first sentence is longer than the length of the summary being produced though nothing is committed to D8 core. Leaving this open. People hitting this an would like to move this forward should jump in in on the Drupal 8 issue. Code from there will get backported to D7.
Comment #2
dcam CreditAttribution: dcam commentedThis is still an issue in 8.x and must be fixed in that version first.
Since the two issues seem like distinctly different problems I'll leave it up to the maintainer to decide whether they should be combined into one.
Comment #3
DamienMcKennaShould this code be just removed entirely from text_summary()?
Comment #4
hctomThis is also a problem in German when you have a long first sentence which contains a date at the very beginning like "Am 07. Oktober wurde Drupal RC1 veröffentlicht." (in English: Drupal RC1 was released on the October, 1st.). With a short summary length this would result in "Am 07." which does not make any sense.
Comment #5
chx CreditAttribution: chx at Smartsheet commentedI submitted a fix to the other side if it's accepted this will be fixed too.
Comment #18
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis is a duplicate of #2835615: Trimmed Formatter no work with html code space.