I've got ed_readmore installed on Drupal 5.3, and overall it's great. However, when a teaser ends in a bulleted list, it places the "read more" link at the end of the preceding paragraph rather than at the end of the teaser.

Looking at the code, it appears that the author is already aware of this, and that it would probably also occur if the teaser ended in a blockquote, numbered list, heading, etc.

The workaround is to place a

after an additional paragraph. But, it would be nice if it "just worked".

Comments

ob3ron’s picture

Sorry, that was supposed to say "place a <!--break--> after an additional paragraph."

guardian’s picture

facing the same issue, however adding a teaser break doesn't suit my needs

guardian’s picture

here is what i implemented as part of a custom module of mine


function custom_readmore_nodeapi(&$node, $op, $teaser, $page) {  if ($node->readmore && $enabled = variable_get('custom_readmore_tweak', TRUE)) {    $readmore = '&nbsp;<span class="read-more">'. l(t('Read More!'), "node/$node->nid", NULL, NULL, NULL, TRUE, TRUE). '</span>';
    $pattern = "/(<\/(p|li)>(\s*<\/[^\s<>]*>)*\s*)$/i";

    switch($op) {
      case 'rss item':
        $node->readmore = FALSE;
        $node->teaser = preg_replace($pattern, "$readmore\${1}", $node->teaser);
        break;

      case 'view':
        if ($teaser)
          $node->content['body']['#value'] = preg_replace($pattern, "$readmore\${1}", $node->content['body']['#value']);
        break;

      default:
        break;
    }
  }
}

function custom_readmore_link_alter(&$node, &$links) {
  $enabled = variable_get('custom_readmore_tweak', TRUE);

  if ($enabled) {
    unset($links['node_read_more']);
  }
}

mshaver’s picture

This is also an issue for the Drupal 6.x dev version. Haven't tried the custom module above, but seems like it would work.

todd nienkerk’s picture

Status: Active » Closed (duplicate)

This is addressed in #164343: Read More link needs to insert itself before more tags that could end a teaser. Unfortunately, the link cannot be added in the midst of <ul>, <ol>, and <li> elements because it results in invalid markup.