Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Attached you'll find a patch related to "read more" link. Things fixed by this patch:
- 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.
- Use
strripos()
function instead ofstrripos()
for PHP > 4 in order to find also the closing tag</P>
(which is non-XHTML but may occur). - Workaround to apply the above issue for PHP4.
- Allow the localization of the "read more" link text. Now the
ed_readmore_text
variable is passed to thet()
function before is inserted in the link. - Regular spaces inside "read more" link text are replaced by
to preserve the link on o single line. - The
title
attribute is added to the "read more" link. - 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.
Comment | File | Size | Author |
---|---|---|---|
#21 | ed_readmore_d6.patch | 6.42 KB | claudiu.cristea |
#1 | ed_readmore.patch | 6.32 KB | claudiu.cristea |
ed_readmore.patch | 3.36 KB | claudiu.cristea |
Comments
Comment #1
claudiu.cristeaSeveral fixes and features:
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.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!Comment #2
claudiu.cristeaComment #3
mlncn CreditAttribution: mlncn commentedApplies 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...
Comment #4
claudiu.cristeaI know this Benjamin... It was addressed also in:
This will be the subject of another patch...
Comment #5
gogik CreditAttribution: gogik commentedI 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...
Comment #6
fletchgqc CreditAttribution: fletchgqc commentedIn 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.
Comment #7
mcurry CreditAttribution: mcurry commented@gogik:
Please see: http://drupal.org/node/266432
Probably due to module ordering issues.
Comment #8
mcurry CreditAttribution: mcurry commentedI'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.
Comment #9
mlncn CreditAttribution: mlncn commented@ inactivist I could take a junior co-maintainer role here...
benjamin, Agaric Design Collective
Comment #10
Dave ReidI'm definitely interested in helping out here. I'll have to get my Drupal 5 local installation back online...
Comment #11
mcurry CreditAttribution: mcurry commented@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!
Comment #12
mcurry CreditAttribution: mcurry commented@claudiu:
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.)
Comment #13
mcurry CreditAttribution: mcurry commentedAlso 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.
Comment #14
mcurry CreditAttribution: mcurry commentedNeed info, before we proceed.
Comment #15
fletchgqc CreditAttribution: fletchgqc commentedI 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.
Comment #16
fletchgqc CreditAttribution: fletchgqc commentedI 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.
Comment #17
mcurry CreditAttribution: mcurry commented@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.
Comment #18
fletchgqc CreditAttribution: fletchgqc commentedYeah I mainly meant this one and Drupal 6.
Comment #19
ajaysolutions CreditAttribution: ajaysolutions commentedNice 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,
Comment #20
claudiu.cristeaNo. It will not work on Drupal 6. It's for Drupal 5.x only!
Comment #21
claudiu.cristeaAnd... finally the patch for Drupal 6.
Comment #22
Summit CreditAttribution: Summit commentedHi,
Will these patches be committed?
greetings,
Martijn
Comment #23
kenorb CreditAttribution: kenorb commented+1 for commit
Comment #24
mcurry CreditAttribution: mcurry commentedThank you for submitting the patch! I'll test it as soon as I can, and if it's solid, I'll commit it.
Comment #25
claudiu.cristeaThere 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.
Comment #26
mcurry CreditAttribution: mcurry commentedI'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.
Comment #27
claudiu.cristeaOK. Add me as co-maintainer
Comment #28
mcurry CreditAttribution: mcurry commented@cladiu.cristea:
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'.
Comment #29
mcurry CreditAttribution: mcurry commentedOther changes are afoot. Putting this back to 'active'
Comment #30
Todd Nienkerk CreditAttribution: Todd Nienkerk commentedI'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?
Comment #31
Todd Nienkerk CreditAttribution: Todd Nienkerk commentedNevermind. This patch applied cleanly to 6.x-3.x-dev.
Comment #32
Todd Nienkerk CreditAttribution: Todd Nienkerk commentedThese 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.