<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>Re: [ic] more-list and interpolation</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>&nbsp; On 8/17/2010 4:02 PM, Peter wrote:<BR>
&gt; On 17/08/10 03:39, Wadkins, Raymond wrote:<BR>
&gt;&gt;&nbsp;&nbsp; I had a requirement to conditionally control the inclusion of<BR>
&gt;&gt; decade-next and decade-prev tags in a more-list.&nbsp; So, I blithely wrapped<BR>
&gt;&gt; them in an if block, then was surprised when the negative condition<BR>
&gt;&gt; wasn't working.&nbsp; Turns out that the contents of more-list aren't<BR>
&gt;&gt; interpolated before being processed, so the regular expression in<BR>
&gt;&gt; tag_more_list was matching my tags desipite their being included in an<BR>
&gt;&gt; if block.<BR>
&gt;&gt;<BR>
&gt;&gt; I hacked a few extra lines into Vend::Interpolate (below), but I'm<BR>
&gt;&gt; wondering if there's something I've missed that could do this without<BR>
&gt;&gt; the hack?<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if($r =~ s:\[interpolate\]::i) {<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $r = Vend::Interpolate::interpolate_html($r);<BR>
&gt;&gt;<BR>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&gt; Can you give some more details about what you were originally trying to<BR>
&gt; accomplish here?&nbsp; There is almost certainly a better way to do this than<BR>
&gt; by hacking Interpolate.html, but it's hard to tell you what to do with<BR>
&gt; so little information.<BR>
&gt;<BR>
Imagine that the scratch values are optionally set elsewhere<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [tmp has_decade]0[/tmp]<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --snip--<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [tmp body_more_links]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [more-list]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [first-anchor]none[/first-anchor]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [last-anchor]none[/last-anchor]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [next-anchor][scratch text_action_next][/next-anchor]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [prev-anchor][scratch text_action_previous][/prev-anchor]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [if scratch has_decade][decade-next][scratch<BR>
text_action_next_decade][/decade-next][/if]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [if scratch has_decade][decade-prev][scratch<BR>
text_action_links_prev_decade][/decade-prev][/if]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [scratch text_label_page]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [more]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [/more-list]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [/tmp]<BR>
<BR>
Unfortunately, what gets handed to Vend::Interpolate::tag_more_list as<BR>
the body is not interpolated, so the &quot;if&quot; blocks aren't evaluated and<BR>
the string &quot;[decade-next]&quot;, when encountered by the regular expression,<BR>
turns on the decade functionality.&nbsp; It seems that the code is reparsed<BR>
when it's done, but by then it's too late, the functionality has been<BR>
changed.<BR>
<BR>
What I want to happen is to be able to control when the decade-based<BR>
logic occurs on a list of pages conditionally.&nbsp; I could achieve this<BR>
with two different more-list blocks, but I hate repeated code.<BR>
</FONT>
</P>

</BODY>
</HTML>