Attached you'll find a patch related to "read more" link. Things fixed by this patch:

  1. Add a lead non-breaking space ONLY if "read more" link is inline. In this case the leading non-breaking space should be placed outside the link for design reasons.
  2. Use strripos() function instead of strripos() for PHP > 4 in order to find also the closing tag </P> (which is non-XHTML but may occur).
  3. Workaround to apply the above issue for PHP4.
  4. Allow the localization of the "read more" link text. Now the ed_readmore_text variable is passed to the t() function before is inserted in the link.
  5. Regular spaces inside "read more" link text are replaced by &nbsp; to preserve the link on o single line.
  6. The title attribute is added to the "read more" link.
  7. Now the "read more" link URL used to regular teasers is relative while the other one, used to RSS, is absolute. This was modified in order to unify the way that internal links are built in the rest of the HTML.

TODO:

  • Is </p> the only closing tag that need to be searched when using inline "read more"? Find other "block" tags that need to be searched. </div> can be one of these... Maybe the filter allowed tags var must be queried for this... Find out this!
  • Add a new variable (maybe ed_readmore_title) in order to let administrators specify a custom title for the "read more" link.

I use these improvements on my site and they work well... Hope that this will help you too... If the the owner of this module consider, he can commit this patch to CVS.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

claudiu.cristea’s picture

Title: Several fixes to "read more" link » Last version of the patch
FileSize
6.32 KB

Several fixes and features:

  1. New variable ed_readmore_title (previous TODO) added in order to customize the "read more" link title. The text entered in this variable must be localized using Drupal localization system.
  2. Administrators can decide if the "read more" link should be removed from node links or just appended to the teaser. On my site I want to keep the "read more" also to the node links. Now you can customize this.

Note: The removal of the "read more" link from the node link is done now by implementing the hook_link_alter() function. This will prevent altering the $node->readmore variable which is needed for theming. We need $node->readmore and we cannot remove it!

claudiu.cristea’s picture

mlncn’s picture

Title: Last version of the patch » Several fixes to "read more" link
Status: Needs review » Reviewed & tested by the community

Applies and provides the listed fixes enhancements.

However it still puts the read more link before the end of the text, after the last paragraph tag, in the cases where (for instance) an h3 or h4 link following.

Other tags that might cause trouble: blockquote, span, ol/ul li...

claudiu.cristea’s picture

However it still puts the read more link before the end of the text, after the last paragraph tag, in the cases where (for instance) an h3 or h4 link following.

Other tags that might cause trouble: blockquote, span, ol/ul li...

I know this Benjamin... It was addressed also in:

This will be the subject of another patch...

gogik’s picture

I successfully installed module for Drupal 5x, and this worked a treat in terms of wrapping 'Read more' onto the end of my node text.

However it didn't remove 'Read more' links from nodes in views that are already displayed in full.

Anyone have a solution for this? Its annoying for users to read an item and click 'Read more' just to be presented with the same content...

fletchgqc’s picture

In regards to:
1. Add a lead non-breaking space ONLY if "read more" link is inline. In this case the leading non-breaking space should be placed outside the link for design reasons.
I had the same idea when I saw that the link underline reaches into the space before the text. But then I realised that if you style your Read More link with no underline, it's more usable to have the link extend into the space on either side. Easier to click. Just an idea.

By the way maybe someone wants to volunteer to take over the project? The original developer doesn't seem to be following the patches / updates anymore.

mcurry’s picture

@gogik:

I successfully installed module for Drupal 5x, and this worked a treat in terms of wrapping 'Read more' onto the end of my node text.

However it didn't remove 'Read more' links from nodes in views that are already displayed in full.

Anyone have a solution for this? Its annoying for users to read an item and click 'Read more' just to be presented with the same content...

Please see: http://drupal.org/node/266432

Probably due to module ordering issues.

mcurry’s picture

By the way maybe someone wants to volunteer to take over the project? The original developer doesn't seem to be following the patches / updates anymore.

I'm baaa-aack. :D

My lack of presence here has been due to a variety of factors, which are no longer keeping me away.

I would be interested in granting CVS access to qualified developers if others want to help with this module.

mlncn’s picture

@ inactivist I could take a junior co-maintainer role here...

benjamin, Agaric Design Collective

Dave Reid’s picture

I'm definitely interested in helping out here. I'll have to get my Drupal 5 local installation back online...

mcurry’s picture

@all: Thanks for the recent activity. For some reason, I'm not receiving email notifications for every posting to my issue queues (I'll have to investigate this).

I'll look into these patches and see if they work as advertised.

@benjamin:

Definitely looking for assistance. Have you done any CVS commits and/or other Drupal module work in that role in the past? If so, what modules? Thanks!

mcurry’s picture

Status: Reviewed & tested by the community » Needs work

@claudiu:

TODO:

* Is </p> the only closing tag that need to be searched when using inline "read more"? Find other "block" tags that need to be searched. </div> can be one of these... Maybe the filter allowed tags var must be queried for this... Find out this!
* Add a new variable (maybe ed_readmore_title) in order to let administrators specify a custom title for the "read more" link.

I would think you would need to look for </div>, br, etc. -- the 'inline' "read more" insertion needs to deal with the last found closing 'block' tag that can cause a line break.

This is one of the reasons why I've not dealt with this issue -- there are multiple cases to deal with if you want to do it properly. So: Either we try to figure out a reasonable approach, or we punt and just say that the module has certain weaknesses. Unfortunately, I've not spent much time trying to analyze the best approach to solving this problem in a clean way (also consider performance issues, as well... this code will be called on very teaser render call.)

mcurry’s picture

Also consider what happens with a non-traditional filter like wiki markup, or bbcode...

I suspect this may be a tougher problem than it appears to be at first glance.. I'll have to think about it, and I'd appreciate other input here. What kinds of issues will we run into with the wide range of input filters in use? Or can we just generalize this and look for a fixed pattern of HTML tags? Or should the pattern be configurable?

I've thought of using a set of configurable regular expressions but I'm not sure what they might be, or if regexp's would hurt performance.

mcurry’s picture

Status: Needs work » Postponed (maintainer needs more info)

Need info, before we proceed.

fletchgqc’s picture

I would go for the idea of "module has limitations" rather than covering spurious cases that no-one actually using the module has yet encountered.

I found the Angry Donuts post first, but I decided to use your module instead of custom code because I would like my Drupal installs to be as simple as possible (least custom code) to enhance maintainability for other (perhaps less drupal-savvy) developers. I think this is the main advantage/use of your module so let's keep it lean and fast and let it fit this model of "simplicity".

If a person wants to solve a really special case then they can just go to the Angry Donuts site and use the example there to create custom code for their site.

fletchgqc’s picture

I might add that we should also be careful of biting off more than we can chew. The module had uncommitted but necessary patches for ages, now we want to expand it to suit wikis etc? Rather keep it simpler but maintain it well.

mcurry’s picture

@fletchgqc:

No, I don't want to expand anything. What I am trying to do is raise awareness that this issue is deeper and wider than people think, and that I'm fine with drawing a line in the sand if the this will meet most users' needs. One must first identify the issues and then ask the question, and that is what I have done. Your feedback helps, but I would like to know if I've missed any compatibility issues before we try to roll another release to deal with this issue.

Regarding patches that are both necessary and 'ready for prime time', and have been so for ages, please identify them (besides this one, of course) so I can focus on them first. I've seen only a few patches that fit my idea of what the module is and should be. I recently committed the Drupal 6 patch, which was the most necessary one AFAIK.

fletchgqc’s picture

Yeah I mainly meant this one and Drupal 6.

ajaysolutions’s picture

Nice little module - I'm a bit of a Drupal novice, so perhaps excuse the question, but to summarise;

I'm running Drupal 6 and the only issue I have is with the lack of leading non-breaking space to the inline Read more link. I see from the beginning of this post that there's a patch which has fixed this amongst other issues, but will that work on Drupal 6? This thread is for 5.x

Thanks!

Al,

claudiu.cristea’s picture

No. It will not work on Drupal 6. It's for Drupal 5.x only!

claudiu.cristea’s picture

FileSize
6.42 KB

And... finally the patch for Drupal 6.

Summit’s picture

Hi,
Will these patches be committed?

greetings,
Martijn

kenorb’s picture

+1 for commit

mcurry’s picture

Assigned: claudiu.cristea » mcurry
Status: Postponed (maintainer needs more info) » Needs review

Thank you for submitting the patch! I'll test it as soon as I can, and if it's solid, I'll commit it.

claudiu.cristea’s picture

There are a lot of reasons for this patch which is available here for Drupal 5 & 6. I cannot understand why is not committed to repository.

mcurry’s picture

I've been swamped and don't have time to properly review, test, and commit these patches right now. I will work on them as soon as I have time to do it properly. Sorry, but that's the way it is right now.

Or is there another qualified developer who wishes to jump in as a co-maintainer (if only for this task) to create a branch and generate a new dev release for this? If so, I'll grant CVS access and you can have at it.

claudiu.cristea’s picture

OK. Add me as co-maintainer

mcurry’s picture

Assigned: mcurry » claudiu.cristea

@cladiu.cristea:

OK. Add me as co-maintainer

Thanks for offering to help.

I've granted you CVS access; please limit your changes to this issue for the time being -- generate appropriate CVS tags and create development releases for this patch. Let me know if you want to add anything or make changes to the project page related to this effort.

Has this patch been 'reviewed and tested by the community' ? The current state is 'code needs review'.

mcurry’s picture

Assigned: claudiu.cristea » Unassigned
Status: Needs review » Active

Other changes are afoot. Putting this back to 'active'

Todd Nienkerk’s picture

I've been added as a co-maintainer as part of the Drupal.org upgrade effort. I'll be submitting a number of patches to clean up UI and logic, some of which may solve some issues addressed in this patch.

Can someone update this thread with the version of the module this patch should be applied to?

Todd Nienkerk’s picture

Version: 5.x-1.2 » 6.x-3.x-dev

Nevermind. This patch applied cleanly to 6.x-3.x-dev.

Todd Nienkerk’s picture

Assigned: Unassigned » Todd Nienkerk
Status: Active » Fixed

These and other fixes have been added to 6.x-3.x-dev. I should note that some of the changes made by this patch were altered further. Everyone is encouraged to try to dev snapshot for today when it's generated.

Status: Fixed » Closed (fixed)

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