The docs for node_teaser():

http://api.drupal.org/api/HEAD/function/node_teaser

say that it will return 'a teaser for a node body in a given format' if a $format is passed to it. However, it only checks $format for the prescene of the PHP eval filter, not others, such as the HTML filter. Shouldn't this work for any generic filter format that is passed in?

CommentFileSizeAuthor
#7 node_teaser_115912.patch397 bytesgpk
#4 node.module_20071026.patch525 bytesstevenpatz

Comments

Bevan’s picture

Version: 5.1 » 6.x-dev
Status: Active » Needs review

I think you misunderstood the documentation -- although, arguable it's not very clear.

Index: node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.882
diff -r1.882 node.module
241c241
<  * Automatically generate a teaser for a node body in a given format.
---
>  * Automatically generate a teaser for a node body.
Bevan’s picture

catch’s picture

Status: Needs review » Needs work

Needs a real patch in unified diff format:
http://drupal.org/patch/create

stevenpatz’s picture

Status: Needs work » Needs review
StatusFileSize
new525 bytes

here's a patch

gpk’s picture

Title: Documentation of node_teaser() - 'in a given format' is confusing » Documentation of node_teaser() is confusing - could imply returned teaser is 'in a given format'

Changed title to reflect the focus of this issue.

Related questions: is the fact that for PHP input format pages that actually contain PHP code the teaser is always the same as the entire body made clear to the end user? Also that Drupal tries to slice the main body text at a paragraph break to generate the teaser, and that multibyte characters count as multiple characters when calculating the teaser length. These probably belong in new issue(s). [edited]

gpk’s picture

Title: node_teaser() is supposed to return 'in a given format', but it only works for PHP evaluator filter » Documentation of node_teaser() - 'in a given format' is confusing

Hmmm not sure there is much actual improvement going on here :/ !!

gpk’s picture

Title: Documentation of node_teaser() is confusing - could imply returned teaser is 'in a given format' » Documentation of node_teaser() - 'in a given format' is confusing
StatusFileSize
new397 bytes

Previous patch no longer worked since documentation of node_teaser() had been updated. Here's a new one.

gábor hojtsy’s picture

IMHO "in a given format" only means that you need to pass on the format (for checking for the PHP format). Otherwise teaser generation is the same in all formats.

gpk’s picture

Agreed ... I think the point it that "in a given format" does not add anything to "Automatically generate a teaser for a node body" - it only confuses, especially since the argument $format is clearly defined now in the documentation.

gábor hojtsy’s picture

Status: Needs review » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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