Re: Turn interpolation on and off within template?

Sherwood Botsford <[email protected]> Sun, 24 Apr 2016 15:12:36 -0600
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <CAOX=2F8wbnVvuT+S1hekY_S8cmS0stOvrDcBFw50wpHWESZD5w@mail.gmail.com>
--===============1431283363318566630==
Content-Type: multipart/alternative; boundary=94eb2c04e8da44dd90053141875e

--94eb2c04e8da44dd90053141875e
Content-Type: text/plain; charset=UTF-8

Yuck.  I use interpolation extensively.  Do NOT want to modify 226 files to
replace $foo with [% foo %]

Yes, I can run ttree --nointerpolation, but now I have to single out the
.htaccess files for a separate run.

I was hoping that there was a way to do this as a directive:  [%
INTERPOLATE off %] or some such.

****

Later:

Ok, the following compromise works:

In my .htaccess file, I escaped all the dollar signs.  Regexes are already
clunky enough that additional clunk won't matter that much.

Respectfully,

Sherwood of Sherwood's Forests


On 24 April 2016 at 12:38, Johan Vromans <[email protected]> wrote:

> On Sun, 24 Apr 2016 12:28:12 -0600
> Sherwood Botsford <[email protected]> wrote:
>
> > I'm expanding tt2 for my .htaccess files.  In those I need to use $base
> > for my error document, but tt2 is borking on my rewrite rules, which, of
> > course use regexes.
> >
> > How do I interpolate $base then turn off interpolation?
>
> Switch variable interpolation off with INTERPOLATE, and use
> [% base %] to interpolate the base variable.
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>

--94eb2c04e8da44dd90053141875e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Yuck.=C2=A0 I use interpolation extensively.=C2=A0 Do=
 NOT want to modify 226 files to replace $foo with [% foo %]<br><br></div><=
div>Yes, I can run ttree --nointerpolation, but now I have to single out th=
e .htaccess files for a separate run. <br><br></div><div>I was hoping that =
there was a way to do this as a directive:=C2=A0 [% INTERPOLATE off %] or s=
ome such.<br><br></div><div>****<br><br></div><div>Later:<br><br></div><div=
>Ok, the following compromise works:<br><br></div><div>In my .htaccess file=
, I escaped all the dollar signs.=C2=A0 Regexes are already clunky enough t=
hat additional clunk won&#39;t matter that much.<br></div></div><div class=
=3D"gmail_extra"><br clear=3D"all"><div><div class=3D"gmail_signature"><div=
 dir=3D"ltr"><div><div dir=3D"ltr"><div>Respectfully,<br><br>Sherwood of Sh=
erwood&#39;s Forests<br><br></div></div></div></div></div></div>
<br><div class=3D"gmail_quote">On 24 April 2016 at 12:38, Johan Vromans <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_blank=
">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_=
quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1=
ex"><span class=3D"">On Sun, 24 Apr 2016 12:28:12 -0600<br>
Sherwood Botsford &lt;<a href=3D"mailto:[email protected]">sgbotsford@gm=
ail.com</a>&gt; wrote:<br>
<br>
&gt; I&#39;m expanding tt2 for my .htaccess files.=C2=A0 In those I need to=
 use $base<br>
&gt; for my error document, but tt2 is borking on my rewrite rules, which, =
of<br>
&gt; course use regexes.<br>
&gt;<br>
&gt; How do I interpolate $base then turn off interpolation?<br>
<br>
</span>Switch variable interpolation off with INTERPOLATE, and use<br>
[% base %] to interpolate the base variable.<br>
<br>
_______________________________________________<br>
templates mailing list<br>
<a href=3D"mailto:[email protected]">templates@template-toolki=
t.org</a><br>
<a href=3D"http://mail.template-toolkit.org/mailman/listinfo/templates" rel=
=3D"noreferrer" target=3D"_blank">http://mail.template-toolkit.org/mailman/=
listinfo/templates</a><br>
</blockquote></div><br></div>

--94eb2c04e8da44dd90053141875e--


--===============1431283363318566630==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

--===============1431283363318566630==--