I'm having a problem on my printer-friendly pages that include "a name" tags. My guess is the RegEx is confusing "a name" with "a href".
I've gone through my HTML and made sure there aren't problems with the markup. It's XHMTL valid.
Normal page: http://juice.altiris.com/node/279
Printer-friendly page: http://juice.altiris.com/node/279/print
Thanks.
Kevin
-----------------------------------
http://www.webwiseone.com
It's all about community.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | print_aname.patch | 822 bytes | kmillecam |
Comments
Comment #1
GN commentedI'm also having problems with "a name" followed by "a href" (Drupal 4.7.3, print.module 1.6.2.7).
With this example, any text between "a name" and "a href" tags (
Chapter 1. Bla-bla-bla...) is not displayed in the print view -- seems like print.module cannot understand bookmarks.Comment #2
the greenman commentedIt seems like the best way to solve this is to tweak the url regular expression slightly. (I have not got a clean copy of print.module right now to make a patch)
The main thing to change is the ".*" after the initial A tag. If this gets replaced with "[^>]*", it seems to work fine.
So a manual patch (approx line 239):
Replace
$pattern = "@]*)([^>]*)>(.+?)@ise";
with
$pattern = "@]*?href=([\']?[\"]?)([^\"|^\'|^|^>]*)([^>]*)>(.+?)@ise";
Comment #3
the greenman commentedHmm. Let me escape that:
Comment #4
kmillecam commentedI've created a patch based on the greenman's change.
Comment #5
kmillecam commentedComment #6
jmcclelland commentedThe included patch works for me on 4.7.4 with the latest version of the print module. Thanks!
Comment #7
ekrispin commentedI have the very same problem in 5.1 also
Comment #8
ekrispin commentedI have the very same problem in 5.1 also
Comment #9
ekrispin commentedI have the very same problem in 5.1 also
Comment #10
ekrispin commentedI have the very same problem in 5.1 also
Comment #11
scooper@drupal.org commentedI just installed the 5.1 version and had the same problem. However, the patch contributed on Nov. 20, 2006 fixed it. Just open print.module in a text editor, and replace $pattern with the code given above.Thanks for sharing that patch!
Comment #12
jcnventuraPatch applied to HEAD
Comment #13
felipensp commentedMy suggestion:
'@\s]+)\s*[\x22\x27]?[^>]*>([^<]+)<\/a>@eis'
Only 2 groups capturing.
Comment #14
felipensp commentedOps...
'@<a(?:(?!href=).)+href=[\x22\x27]?\s*([^\x22\x27>\s]+)\s*[\x22\x27]?[^>]*>([^<]+)<\/a>@eis'Comment #15
jcnventuraThanks for your suggestion. However the code in the 5.x branch is now completely different..
To be able to navigate around "a alt="href=" href="the_url", I had to abandon that simple pattern matching and develop a more robust algorithm.
Try the new 5.x-2.n versions and tell me what you think of them.