As you know, drupal shows trimmed posts (default 600 chars) on the main page...
However, there is a problem.
If the post has a html code, drupal doesn't strip html tags.

This is an example includes 650 chars. Drupal shows first 600 chars on the main page. It doesn't show last "All nodes are strong on the main page!!!</strong>" section. Now, the "strong" tag opened but not closed!!! Below this trimmed post all other posts shown strong!!!

EXAMPLE:

575 Chars Dummy Text: dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text, dummy text...

<strong>this is strong text and look at below nodes! All nodes are strong on the main page!!!</strong>

Comments

onionweb’s picture

try the html corrector module.

okuldefteri@www.okuldefteri.com’s picture

Status: Active » Needs work

I have already prepared this patch for node.module:

---FIND---
$node->teaser = check_output($node->teaser, $node->format);

---REPLACE---
$node->teaser = nl2br(strip_tags(check_output($node->teaser, $node->format)));

onionweb’s picture

yeah, that strips all html, and you have to explain to your clients why all the font-sizes, bolding. text-colors, and other adornments aren't present on their homepage, especially if they're using a wysiwyg editor.

the best solution to this is probably have the "excerpt" module code in the core, so users can specify the teaser when creating the node.

especially if they're using the wysiwyg modules, it's tough to explain the use of the --break-- tag.

NaX’s picture

I have run into this problem many times before.

What I think is needed is a intelligent teaser that does some sort of regular expressions on opening tags that then checks that each tag has been closed.

I have not tried it but the HTML corrector module seems to do exactly this. I don't know if it does it to the teaser and the full post or just the full post. Either way this problem should not require a module.

If it cuts off a closing div then your layout gets thrown out.

puregin’s picture

Just noticed the SuperTeaser module, which may be just what you're looking for.

Djun

NaX’s picture

That should work. But I still feel that this should be fixed in the core or 4.7. A new user should not require to add a module to fix this. I ran into this problem with my first drupal site and it had me fooled for hours because I thought I had done some thing wrong so I was rechecking myself. Eventually I found that I was not the problem.

puregin’s picture

I'm inclined to agree with you, NaX.

I'm tempted to install SuperTeaser just to see how well it works and if I can break it. If it works well, then this would be a nice thing to have in Core.

Djun

killes@www.drop.org’s picture

Status: Needs work » Active

no patch

hadishon’s picture

Version: 4.6.3 » x.y.z
Priority: Minor » Normal

I noticed many changes in the new 4.7 version of node.module.

In the new module, how do I have the html stripped from the teasers? The "patch" in this list no longer works for the node.module.

I would rather have the html closed verses stripped but, to my knowledge, there is no module for 4.7 that does this yet.

chx’s picture

Status: Active » Closed (won't fix)

i already closed a duplicate version of this. include the htmlcorrector contrib module in your input format and be done.