This patch fixes three problems in revision 1.4:

1) If you edit a post, the automatically generated excerpt does not update with your changes. To fix this, the 'form post' code now checks to see whether the teaser is a custom one or not. If it was automatically generated one, the code makes the Excerpt form field empty so it will get re-generated when you preview or submit your edits.

2) There is no way to specify that you want no excerpt/teaser at all. Rather than add a checkbox or the like, I simply removed the trim() call in the 'validate' code. This now allows you to enter a space character to signify "no excerpt", and I changed the help text to note this.

3) The calculation of $node->readmore in the 'view' code did not take into account the fact that node_prepare() is called first, so either the teaser or the body has already had check_output() run on it. This resulted in "read more" links when they were not needed. The code now corrects for this before comparing the teaser and body.

I'm using the excerpt module with Drupal 4.5.2 in a team website at work, and with these changes it is now working very smoothly.

Comments

zach harkey’s picture

Version: 6.x-1.x-dev » 4.6.x-1.x-dev

Aside from the error (patch: **** malformed patch at line 33: }) , (if you apply it by hand) this patch is awesome. It completely fixes the excerpt module in 4.6 which, otherwise, is completely useless. Let's do whatever we need to do to get this patch accepted into the module.

zach harkey’s picture

This patch used to work great. Under Drupal 4.6.2 however, it no longer works. Is there something fundamentally different now in the way drupal handles teasers?

zach harkey’s picture

I must be the only one who uses this module. Because without this fix it is completely broken. Is there another module that works, that everyone is using -- or do people just not need excerpts these days?

zach harkey’s picture

Status: Active » Needs review
StatusFileSize
new1.58 KB

Ok, I got it working. There were a few problems with Geary's patch that were causing it not to apply. This is the first patch I have ever attempted but I have tested it and it seems to apply to the CVS version fine. Once applied, every thing works perfectly.

thomaslaw’s picture

+1 much better.

ñull’s picture

I don't get this patch installed. It is all HTML and patch cannot read that. Could that be solved please!

ñull’s picture

With some cutting and pasting I tried to apply this patch but I get the message:

patching file excerpt.module
Hunk #2 succeeded at 26 with fuzz 1.

This is not the normal message I get when patching and afterwards excerpt remains useless. Changes a make in the excerpt (teaser) are visualised in the preview but are not updated in the node view. Weird.

Geary’s picture

Hi guys, I'm looking at this code some more, and part of it looks just wrong (aside from the patch problems). I should have a better version ready today. Will upload the complete file as well as the patch. :-)

Geary’s picture

StatusFileSize
new1.66 KB

Here is a good patch that should apply cleanly to version 1.5.2.1 of the excerpt module dated 4/23/2005. Zach, this restores one thing that got dropped out of your previous patch: the ability to specify "no teaser" by putting a space character in the excerpt field. (It would be nice to have a checkbox or radio button for this, but at least this lets you do it.) While I was looking at the code, I corrected the function signature for the excerpt_nodeapi function.

Note that there is a bug in the attachment module that affects the excerpt module. When you have the attachment module installed, every post has a "read more" link even if it shouldn't. I will submit a patch to the attachment module to fix this in just a bit.

Geary’s picture

StatusFileSize
new1.54 KB

And here is a copy of excerpt.module that includes the above patch, for easy downloading.

Geary’s picture

The bug fix I mentioned above for the attachment module is here.

GWL’s picture

... here is a copy of excerpt.module that includes the above patch, for easy downloading.

Tested it using Drupal 4.6.3 and it worked like a charm. Thanks!

noid’s picture

Can't make it work using Geary's update (even the original one). Am using 4.6 and applying it on a flexinode type. Might be a flexinode or TinyMCE issue -- in the Excerpt textarea, can't see the the filters below the textarea. Also, default Excerpt is the the teaser and any flexinode field enabled in the teaser.

Any ideas? :)

zach harkey’s picture

+1 Works like a charm. Too bad it will never get committed since no one maintains this module.

hayesr’s picture

Status: Needs review » Fixed

Committed the patch to the 4.6 branch. I am taking Zach Harkey's word that it works.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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