I am working on the contributed module Directory, and noticed that unexpected results occur when a document has an < ol > too close to the top of the document. I suspect Directory gets the teaser from the node code in the core, quite possibly node_teaser().

Reviewing that function, I see no provision to strip tags like < ol > and < li > from the teaser, so I think it likely that this is where the problem lies.

Would you be so kind as to provide a second opinion?

Thanks,
Michael

Comments

beginner’s picture

I am sure there was another very similar issue.
I searched the queue, but I couldn't find it.

The best would be for the teaser filter to keep track of all opened tags, and close them at the place the teaser breaks off.
Unfortunately, this is beyond my current skills. I cannot provide a patch for that.

mdlueck’s picture

The best would be for the teaser filter to keep track of all opened tags, and close them at the place the teaser breaks off.

Should the teaser line even contain tags such as < ol > and < li >? I thought, at least in its use in Directory, it should be a non-tagged string. Thus my surprise at not finding a tag stripper in node_teaser(). Would there be any foreseen ill affects of simply stripping tags generically?

beginner’s picture

Status: Active » Closed (duplicate)

It's better not to mix contrib module issues and core issues.

I knew there was another issue about it. See: http://drupal.org/node/82572

And no, we cannot remove tags. Tags are part of the content. There could be links, span tags with classes, img tags, any kind of tag. Removing the tags will change the look and sometimes even the meaning of the text. Nobody would accept that.
See the front page http://drupal.org/ and imagine each teaser to be plain text without any other html! :-s

yched’s picture

The fix for D5 is to use "HTML corrector" module.
It has been included in core D6, so this won't be a problem in the future

mdlueck’s picture

Thanks for the suggestion. Unfortunately having enabled HTML Corrector for the input formats (The default three in our case) we see no corrections have been made.

There is a way to customize Directory via over riding functionality in the theme, so we are going to give that a try, and strip all tags out via that method. I see little/no purpose for tags in teasers that Directory is displaying.

gpk’s picture

The teaser is generated and stored in the database when the node is saved so you need to save all your nodes again in order for the teasers to be regenerated with the new htmlcorrector filter. You may wish to use the http://drupal.org/project/retease module to do the donkey-work for you.