Postponed (maintainer needs more info)
Project:
Leech
Version:
5.x-1.6
Component:
leech
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2007 at 22:40 UTC
Updated:
19 Apr 2007 at 17:19 UTC
When getting news from yahoo the alt attribute of an image is too long. This makes so that the teaser is trimmed in the middle of the alt attribute and as a consequence it brakes the html output.
My question is, where I need to put the code so that the teaser is passed to the db as i want to. The code I need to insert is this:
$patern = '/alt\=\"(.*?)\"/e';
$node->teaser = preg_replace($patern, "'alt=\"'.substr('$1', 0, 20).'...\"'" , $node->teaser);
but where? I tried to place it in node_template module, before the node_save call but it doesn't work.
Comments
Comment #1
tic2000 commentedI solved this. In leech.module I changed line 2235 from:
to
Comment #2
alex_b commentedHi - sorry, I have to re-open this.
I can't take this code into leech because it is a workaround that appears to fix the issue only in your particular case. When image tags get severed by the node_teaser() function, some other tags might get cut in pieces as well. Making the tag shorter only reduces the probability. Or am I missing something here?
There is some discussion about the latest patch for node_teaser() here: http://drupal.org/node/73910 . If you can verify a bug, your input would be very much appreciated on the Drupal issue tracker.
Comment #3
tic2000 commentedThe fact is like this. I have this html code in the body of a node created by leech:
Well, this body is trimmed by the teaser in middle of the alt attribute of the image. I don't think the problem is with node_teaser, since it's purpose is to trim text inserted by the user on that site and not content taken from somewhere else. The patches on that pages would shorten the teaser maybe but not necessarily will solve the problem. And in my case sure it won't, cause the image tag it's gone be broken anyway.
I know this is a particular case, and can only happen with images tags and maybe anchors tags to if there is a too long title, but still it's a problem.
What I'd do is to put an option in the setting page of the module so that the user can select if they want that code to do his job or not depending on what content they leech. But this is only my opinion, and the code I posted wasn't intended as a patch, but just a mare solution for people who may encounter the same problem.