Kapila Kohli wrote:
> I have so far gathered a code-
>
> <pre[% ' id="comment_text_' _ count _ '"' IF mode == "edit" %]>
> [% count = 0 %]
> [% increment = 1 %]
> [%- text= wrapped_comment FILTER quoteUrls(bug.bug_id) -%]
>
> [% IF (matches =
> text.match('([\w./]+)[\s|\n]+([\d.]+|NONE)[\s|\n]+([\d.]+|NONE)')) %]
> [% FOREACH match = matches %]
> [%- text= text.replace('match.\$count','<a
> href="http://svn/cvsweb/cvsweb.cgi">abc</a>') -%]
> [% END %]
> [% count = count + increment %]
> [% END %]
> [%- text -%]
>
> But still not able to get the right code replace i.e in match regex.
> Can anyone suggest where i am going wrong.
Ok, I missed this one. Making good progress. :) What's the quoteURLs filter do?
Have you checked what kind of output it provides?
text.match() will only return an array of the parenthesis values for a single
match, unless you provide it with a 1 value for the global parameter. ie:
text.match('regexp', 1). So you'll probably want to do that, since that appears
to be how you are using it in your code.
The documentation shows that:
http://template-toolkit.org/docs/manual/VMethods.html#method_match
I just tested your regexp with your original string and it works fine.
(Although it doesn't include the dash as you probably want: [\w./\-]+ instead
of [\w./]+) So I'm guessing the quoteUrls filter is doing something.
-- Josh
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates