Index: ed_readmore.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ed_readmore/ed_readmore.module,v
retrieving revision 1.5.8.2.2.11.2.6
diff -u -p -r1.5.8.2.2.11.2.6 ed_readmore.module
--- ed_readmore.module	15 Sep 2009 20:06:58 -0000	1.5.8.2.2.11.2.6
+++ ed_readmore.module	15 Sep 2009 23:02:15 -0000
@@ -31,6 +31,7 @@ define('ED_READMORE_TEXT_DEFAULT', t('<s
 define('ED_READMORE_TITLE_DEFAULT', t('Read the whole post'));
 define('ED_READMORE_SEPARATOR_DEFAULT', '&nbsp;');
 
+
 /**
  * Implementation of hook_menu().
  */
@@ -53,12 +54,26 @@ function ed_readmore_menu() {
 function ed_readmore_admin_settings() {
   $form = array();
 
+  $elements = array(
+    'address'    => '<address>',
+    'blockquote' => '<blockquote>',
+    'cite'       => '<cite>',
+    'div'        => '<div>',
+    'h1'         => '<h1>',
+    'h2'         => '<h2>',
+    'h3'         => '<h3>',
+    'h4'         => '<h4>',
+    'h5'         => '<h5>',
+    'h6'         => '<h6>',
+    'p'          => '<p>',
+    'span'       => '<span>',
+  );
+
   $form['ed_readmore_display'] = array(
     '#type' => 'fieldset',
     '#title' => t('Read More link display options'),
     '#collapsible' => FALSE,
   );
-
     $form['ed_readmore_display']['ed_readmore_placement'] = array(
       '#type' => 'radios',
       '#title' => t('Link placement'),
@@ -70,7 +85,15 @@ function ed_readmore_admin_settings() {
       '#default_value' => variable_get('ed_readmore_placement', ED_READMORE_PLACEMENT_DEFAULT),
       '#description' => t('For more information about how this is done, read this <a href="@link">Angry Donuts post</a>.', array('@link' => url('http://www.angrydonuts.com/the_nuisance_of_the_read_more_fl'))),
     );
-
+    $form['ed_readmore_display']['ed_readmore_elements'] = array(
+      '#type' => 'select',
+      '#title' => t('Elements'),
+      '#description' => t('Select the elements into which the <strong>Read More</strong> link may be inserted, if added inline.'),
+      '#multiple' => TRUE,
+      '#options' => $elements,
+      '#default_value' => variable_get('ed_readmore_elements', array('p')),
+      '#size' => 10,
+    );
     $form['ed_readmore_display']['ed_readmore_remove'] = array(
       '#type' => 'checkbox',
       '#title' => t('Remove <strong>Read More</strong> link from links section'),
@@ -83,7 +106,6 @@ function ed_readmore_admin_settings() {
     '#title' => t('Read More link formatting and attributes'),
     '#collapsible' => FALSE,
   );
-
     $form['ed_readmore_formatting']['ed_readmore_text'] = array(
       '#type' => 'textfield',
       '#title' =>  t('Link text'),
@@ -91,7 +113,6 @@ function ed_readmore_admin_settings() {
       '#description' => t('Enter the text you wish to display in the <strong>Read More</strong> link. May contain HTML. Special characters should be encoded (like %raquo or %amp). Spaces will be changed to non-breaking spaces (%nbsp).', array('%raquo' => '&raquo;', '%amp' => '&amp;', '%nbsp' => '&nbsp;')),
       '#required' => TRUE,
     );
-
     $form['ed_readmore_formatting']['ed_readmore_title'] = array(
       '#type' => 'textfield',
       '#title' => t('Link title'),
@@ -99,14 +120,12 @@ function ed_readmore_admin_settings() {
       '#description' => t('Enter the text you wish to be used as the title for the <strong>Read More</strong> link (the value of the %title attribute). It is used for accessibility and search engine optimization purposes and appears as a tooltip in some browsers.', array('%title' => 'title=""')),
       '#required' => FALSE,
     );
-
     $form['ed_readmore_formatting']['ed_readmore_nofollow'] = array(
       '#type' => 'checkbox',
       '#title' => t('Make link nofollow'),
       '#default_value' => variable_get('ed_readmore_nofollow', TRUE),
       '#description' => t('Adds %nofollow to the link\'s attributes. Often used for search engine optimization purposes.', array('%nofollow' => 'rel="nofollow"')),
     );
-
     $form['ed_readmore_formatting']['ed_readmore_separator'] = array(
       '#type' => 'textfield',
       '#title' => t('Separator'),
@@ -150,10 +169,12 @@ function ed_readmore_preprocess_node(&$v
  */
 function ed_readmore_link_place($teaser, $node, $display) {
   if ($display == 'inline') {
-    $block_tags = '(?:p)';
-    // Get last position of the last closing marker
-    // If found, insert the link before the marker
-    if (preg_match('!</?'. $block_tags .'[^>]*>s*$!mi', $teaser, $match, PREG_OFFSET_CAPTURE)) {
+    $elements_array = variable_get('ed_readmore_elements', array('p'));
+    $elements = '(?:'. implode('|', $elements_array) .')';
+
+    // Get last position of the last closing markers
+    // If found, insert the link before the markers
+    if (preg_match('!(</?'. $elements .'[^>]*>)+s*$!mi', $teaser, $match, PREG_OFFSET_CAPTURE)) {
       $teaser = substr_replace($teaser, ed_readmore_link_render($node, $display), $match[0][1], 0);
     }
 /*
