API page: http://api.drupal.org/api/drupal/modules--field--modules--text--text.mod...

Describe the problem you have found:
The text_summary function has an early exit, if a '

' tag will be found in the content. Sadly i discovered a problem if the author of the html body content didn't placed it correctly:

My body <div>is fine<!--break--></div>

This causes an shortened teaser e.g.:
My body <div>is fine
..and break up the div-structure of the surrounding page.

Not only the author of this body can make this mistake, also the ckeditor / wysiwyg didn't care about.

So i have to handle this issue on the theming layer, but i would prefer a central solution in the text.module.

Here is my patch:

: text.module
text.module (Revision 121)
text.module (Arbeitskopie)
@@ -
361,15 +361,19 @@
// If a valid delimiter has been specified, use it to chop off the summary.
$filters = filter_list_format($format);
   if (
$delimiter !== FALSE) {
-    return
substr($text, 0, $delimiter);
$summary substr($text, 0, $delimiter);
+    if (isset(
$filters['filter_htmlcorrector'])) {
$summary = _filter_htmlcorrector($summary);
+    }
+    return
// We check for the presence of the PHP evaluator filter in the current
   // format. If the body contains PHP code, we do not split it up to prevent
   // parse errors.
if (isset($format)) {
$filters = filter_list_format($format);
     if (isset(
$filters['php_code']) && $filters['php_code']->status && strpos($text, '<?') !== FALSE) {
#1 summary_html_corrector-1387560-1.patch1.05 KBoriol_e9g
PASSED: [[SimpleTest]]: [MySQL] 39,984 pass(es).
[ View ]


Version:7.9» 8.x-dev
Status:Active» Needs work
Issue tags:+Needs tests
new1.05 KB
PASSED: [[SimpleTest]]: [MySQL] 39,984 pass(es).
[ View ]

First this will be fixed in D8 and then backported to D7, rolled a patch for Drupal 8 but we still need tests for this.

Version:8.x-dev» 7.x-dev


I found a similar problem when using the openWysiwyg editor:
The text_summary() method was just cutting everything and the teaser was empty.

Therefore i inserted the following line to quickfix the problem:

function text_summary($text, $format = NULL, $size = NULL) {
  $text = strip_tags($text);

I know that now, all formatting gets lost in the teaser but at least there is displayed sth. Did I miss a setting or is my problem a bug within the function?

Best regards,

Version:8.x-dev» 7.x-dev
Status:Needs review» Closed (duplicate)
Issue tags:+Needs tests

Ok, go all to the other issue.

Status:Needs work» Needs review

I don't see how the two issues should be related. The other issue is about fixing the [node:summary] token only. This issue here shows up even if you don't use the [node:summary] token.

The token will obviously suffer if text_summary() doesn't work right, but just because preparing the token uses text_summary() doesn't mean the two issues are related. Both issues need to be fixed on their own.

Status:Needs review» Needs work

The last submitted patch, summary_html_corrector-1387560-1.patch, failed testing.

Version:7.x-dev» 8.x-dev

Status:Needs work» Needs review
Issue tags:-Needs tests

Version:7.x-dev» 8.x-dev
Status:Closed (duplicate)» Needs review
Issue tags:-Needs tests