When you have more than one < !--break-- > inputed into a node, you can save the node with the content, but when you edit the node, the data after the second < !--break--> is lost.

Steps to reproduce

  1. Fresh Drupal install
  2. Create a new node (page or story)
  3. Input the following for the content:
    This is the teaser! < !--break-->
    This appears in the full story! < !--break-->
    This appears after the full story! < !--break-->
    This is the afterlife of the node....
    

    Of course, you'll remove the space between the < and the ! in that example.

  4. Save the node and you'll see that all content appears as expected
  5. Now edit the node and instead of being able to edit all content, you're only able to edit up to the second < !--break-->.

Expected outcome is being able to edit all content in the node.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

LAsan’s picture

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

Confirmed in 6.x-dev.
Still happening in 7.x-dev.

JeremyFrench’s picture

Should we strip instances of < !--break --> after the first, or honour them somehow?

Damien Tournoud’s picture

Title: More than one <!--break--> corrupts node content. » Teaser splitter: more than one <!--break--> corrupts node content
Priority: Minor » Normal
Issue tags: +JavaScript, +Novice

Confirmed.

This should be a simple bug into the teaser splitter javascript.

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
972 bytes

The source of the bug is that the following javascript code:

string.split(<delimiter>, <limit>);

... doesn't behave as you would expect (at least it behaves differently then the PHP explode() function) [1]. Javascript will return only the first two components, ignoring the remaining of the string, so:

'a,b,c'.split(',', 2)

will return { 'a', 'b' } instead of { 'a', 'b,c' }

The attached patch fixes the issue (tested on Firefox 3).

[1] http://www.w3schools.com/jsref/jsref_split.asp

netsensei’s picture

I've noticed the same issue in drupal 7.

Tested the patch. It works on these browsers:

- Safari 3.2.1 (osx)
- Camino 1.6.7 (osx)
- Firefox 3.0.9 and 3.0.10 (osx)

akahn’s picture

#1 indicates a use case where <!--break--> is used more than twice. Shouldn't this patch allow more than two breaks (not that I have ever needed to do this on a site)?

Damien Tournoud’s picture

@akahn: it does, the text between the beginning of the content and the first <!--break--> is going in the teaser, the part after that (including subsequents <!--break-->) is going to the body.

akahn’s picture

Ah, of course.

burningdog’s picture

Status: Needs review » Reviewed & tested by the community

Doesn't apply against D6. D7 works fine - tested on:
Firefox 3.0.8
SeaMonkey 1.1.16
Safari 3.2.1
Camino 1.6.5
Flock 1.2.7
Opera 9.6.2
Mozilla 1.7.3

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +needs Internet Explorer tests

Lots of exotic browsers mentioned here, but let's test in a non-exotic one: IE. :)

burningdog’s picture

Status: Needs review » Reviewed & tested by the community

What?! People still use IE?! You're kidding!

Ok, I've fired up Doze and the patch works for:
IE 6.0
IE 7.0
IE 8.0

burningdog’s picture

Are there other browsers that need to be tested, or is this sufficient?

Dries’s picture

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

Committed to CVS HEAD. Changing version to DRUPAL-6. Thanks!

andypost’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
979 bytes

Patch for D6

Tested on IE6, IE7, FF3, safari 3.2.3

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Same patch, same conclusion. Thanks @andypost.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed to Drupal 6.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.