Parametric reptags too greedy

f_p - August 17, 2008 - 12:43
Project:Rep[lacement]Tags
Version:6.x-1.x-dev
Component:Code / API
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Dear all,

I've created a tag to wrap email addresses into some JavaScript as follows: MAILTO{name,host} is replaced by <script type="text/javascript">var email="%name"+unescape("%40")+"%host"; document.write("<a href='mailto:"+email+"'>"+email+"</a>");</script>.

This works fine until I use the tag several times on the same page. For instance:

1... $MAILTO{user1,host1}$ ...1
2... $MAILTO{user2,host2}$ ...2
3... $MAILTO{user3,host3}$ ...3
4... $MAILTO{user4,host4}$ ...4

In the situation, only the first tag is interpreted, its first parameter is set to

user1,host1}$ ...1
2... $MAILTO{user2,host2}$ ...2
3... $MAILTO{user3,host3}$ ...3
4... $MAILTO{user4

and its second parameter to host4.

Presumably the regexp that parses the tag is greedy and gets text until the last occurrence of }$ in the page... If this is actually a regexp problem, I would expect that this can be fixed using either a non-greedy .* regexp (like .*? in Perl)or, better, a narrower regexp like [^}$]*... But I'm not good enough with PHP in order to go into the module's code... And unfortunately, I've found no workaround yet...

Thanks for any help!
Franck

#1

profix898 - September 28, 2008 - 14:52
Status:active» fixed

Should be solved in the latest -dev version.

#2

Anonymous (not verified) - October 12, 2008 - 14:56
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.