I installed the module on my fresh drupal6 and choosed the inline insertion of read more link on the configuration page. And it never inserted inline.
I changed a little function ed_readmore_link_place(), the string

    if (preg_match('!</?'. $block_tags .'[^>]*>$!i', $teaser, $match, PREG_OFFSET_CAPTURE)) {

became

    if (preg_match('!</?'. $block_tags .'[^>]*>s*$!mi', $teaser, $match, PREG_OFFSET_CAPTURE)) {

and now everything works for me.

Comments

todd nienkerk’s picture

@netbear: I'm not as familiar with regex as I'd like to be. Can you explain what this change does, exactly?

Before:
'!</?'. $block_tags .'[^>]*>$!i'

After:
'!</?'. $block_tags .'[^>]*>s*$!mi'

netbear’s picture

As default preg_match() works in one_line mode, means that "\n" is not recognizable as space by this command.
In teaser after <p> tag seems the last simbol is linebreak "\n". My change of regexp takes this possibility into account.

todd nienkerk’s picture

Version: 6.x-3.0 » 6.x-5.x-dev
Status: Active » Fixed

Committed to 6.x-5.x-dev. Thanks!

todd nienkerk’s picture

Assigned: Unassigned » todd nienkerk

Status: Fixed » Closed (fixed)

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

flaviovs’s picture

Version: 6.x-5.x-dev » 6.x-5.0-rc7

I applied the proposed fix and it indeed worked, except that sometimes the link was being put in odd places, more specifically they're being put on the first closing tag of a multi paragraph teaser.

Something like:

This is teaser line 1. [read more]

This is teaser line 2.

I then did remove the "m" and changed the regexp to make it ignore whitespaces at the end of the teaser, which looked like the cause for the link not being put inline anymore. I.e. changed

    if (preg_match('!</?'. $elements .'[^>]*>$!i', $node->content['body']['#value'], $match, PREG_OFFSET_CAPTURE)) {

To:

    if (preg_match('!</?'. $elements .'[^>]*>\s*$!i', $node->content['body']['#value'], $match, PREG_OFFSET_CAPTURE)) {

(Notice the "\s*" near the end of the regexp.)

Now the problem is gone. Inline is working as expected, and no read more link in odd places.

dboulet’s picture

Version: 6.x-5.0-rc7 » 6.x-5.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new1.08 KB

I'm having the same problem as the original poster—it looks like the fix committed here has since been undone. Here's a patch with an alternative fix.

flaviovs’s picture

dboulet, the fix in #6 does the same thing and it's much faster and use less memory that the rtrim() method used in your patch. Please, consider using the changed regexp to fix the issue.

I'm so sorry I cannot provide a proper patch file now, but the change is straightforward, as can be seen in my comment.

dboulet’s picture

StatusFileSize
new1.07 KB

Works for me, here's a new patch.

todd nienkerk’s picture

Status: Needs review » Fixed

I will be committing this patch shortly. Thanks!

Status: Fixed » Closed (fixed)

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