Closed (works as designed)
Project:
Drupal core
Version:
x.y.z
Component:
node.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jun 2004 at 19:40 UTC
Updated:
13 Jul 2006 at 20:40 UTC
I have made a post with a ul list. node_teaser() chopped it off after the first
leaving an open ul list on my frontpage which ceased to validate properly.
Comments
Comment #1
jhriggs commentedI think it is a little much to expect node_teaser() to properly handle every type of HTML block tag (table, ul, ol, etc.). When blocks like this are used, I always use a <!--break--> to specify exactly where the break should occur (usually before or after the block element).
Comment #2
killes@www.drop.org commentedI _wanted_ the split to be after the first of the lis. I could not make it that way by using the break tag. I would have needed to close the ul and open a new one for the rest of the body. Don't know how this displays on the node/view view.
This workaround wouldn't work at all for ols.
So I guess we need some additional logic in node_teaser, run the htmlcorrector module, or offer another way to construct the teaser.
Comment #3
jonbob commentedIn my opinion, node_teaser() should have code added to close any open tags after it does its truncation, or htmlcorrector should be folded into core.
Comment #4
Steven commentedHtmlcorrector is functional, but it's not written for speed. It really needs a good rewrite (note: I wrote htmlcorrector ;) ).
We cannot do such HTML validation in node_teaser though, because we have no guarantee that the unfiltered text is in fact intended to be HTML. Even without the input formats filter patch, an admin can choose to escape all HTML so that it appears literally. Alternatively he/she could be using something like textile for markup.
In those cases, we will be modifying the actual content when we close any HTML-like structures in the body.
Comment #5
boris mann commentedUse break tags.
Comment #6
killes@www.drop.org commentedBreak tags won't fix this as outlined http://drupal.org/node/8456#comment-8620
This is pretty much non-fixable inside node_teaser() as the discussion has shown. The proper solution would probably be to use excerpt.module.
Comment #7
sjs commentedHi.
I replaced node_teaser with a function found from this site:
http://www.phpinsider.com/smarty-forum/viewtopic.php?p=3349
So far it seems to work fine..