Is anyone successfully using the custom regular expression feature (when generating the description automatically from the teaser)? I can't seem to get it to do anything. I'm still learning regex, but even if I simplify it down to just one word (when testing it out) I still can't get it to strip that word...

Comments

dave reid’s picture

Category: bug » support
Jiri Volf’s picture

Does not work for me either. Tried the img_assist.module checkbox to get rid of image assist code in automatically generated descriptions, but it did not work, so tried to put

s/[.*]//
s/[.*]//gi
and other variations into the regex field, but did not work either..

drupal 6.19, modules: Better Formats, Wysiwyg, tinymce, Views, Nodewords, Image assist

btw, also failed to set up special tags for other pages, it always reverts to default values...

WildBill’s picture

The img_assist.module checkbox works for me, stripping out all tags created by the Image Assist module. But I'd also like to strip out tags created by the Zemanta module (super-handy module, by the way), but I can't get the custom regex box to do anything.

Using the same setup as vlx above, but instead of tinymce, I'm using CKEditor (in conjunction with WYSIWYG).

quicksketch’s picture

Title: Custom Regex working? » Fix (and clarify) custom regex striping fields
Category: support » feature
Status: Active » Needs review
StatusFileSize
new5.69 KB

The regex already included the leading and trailing slashes (confusing I know). I think this would best be served by putting #field_prefix and #field_suffix on the field, then you'd know they're there already.

But in addition to that, the regexs aren't even run due to a typo in the code "$regexp" vs. "$regex". Finally, the regexs are only run if generating from a teaser, not if generating from a body or the option for "teaser if body is empty". It really doesn't make any sense. This patch cleans up the code for consistent cleanup of the description text no matter its source as well as running the regexs properly.

quicksketch’s picture

StatusFileSize
new5.88 KB

My last patch didn't check for an empty teaser correctly. In the future, I think we could actually safely ditch the "Generate from body if teaser is empty" option. Obviously (90% use-case) if you selected the teaser option you'd want this as the default anyway.

Status: Needs review » Needs work

The last submitted patch, nodewords_regex_fix.patch, failed testing.

quicksketch’s picture

Status: Needs work » Needs review
StatusFileSize
new5.9 KB

Apparently Git's a/b prefixes are now necessary for testing.

Status: Needs review » Needs work

The last submitted patch, nodewords_regex_fix.patch, failed testing.

quicksketch’s picture

Version: 6.x-1.11 » 6.x-1.x-dev
Status: Needs work » Needs review

I'll figure out this testbot yet. :P

quicksketch’s picture

#7: nodewords_regex_fix.patch queued for re-testing.

dave reid’s picture

Version: 6.x-1.x-dev » 6.x-1.11
Status: Needs review » Needs work
dave reid’s picture

Version: 6.x-1.11 » 6.x-1.x-dev
Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, nodewords_regex_fix.patch, failed testing.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new4.79 KB

Rerolled. Needs some thorough testing before I'll commit it.

damienmckenna’s picture

StatusFileSize
new4.73 KB

Rerolled. It also fixes a logic bug when the teaser was not empty but the auto-generate option was set to "teaser or body".

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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