Re: [Templates] Assigning chained filter output to variable?

[prev] [thread] [next] [Date index for 2004/06/04]

From: darren chamberlain
Subject: Re: [Templates] Assigning chained filter output to variable?
Date: 20:29 on 04 Jun 2004
--UJXkkAiHhNbsaLO7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Jesse Sheidlower <jester at panix.com> [2004/06/04 16:23]:
> I can do something like
>=20
>  [% title =3D FILTER html; raw_title; END %]
>=20
> but suppose I'd like to take "raw_title" and chain it through:
>=20
>   FILTER replace('<title>','<i>') | replace('</title>','</i>') | html
>=20
> but assign the whole lot to "title". Is there a way to do this
> by chaining, i.e. without having several separate filter statements?

What's wrong with several FILTERs?

  $ tpage=20
  [% raw_title =3D '<title>foo</title>' %]
  [% title =3D raw_title | replace('<title>', '<i>') | replace('</title>', =
'</i>') | html %]
  raw_title =3D '[% raw_title %]'
  title =3D '[% title %]'

  raw_title =3D '<title>foo</title>'
  title =3D '&lt;i&gt;foo&lt;/i&gt;'

(darren)

--=20
It has long been an axiom of mine that the little things are
infinitely the most important.
    -- Arthur Conan Coyle

--UJXkkAiHhNbsaLO7
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAwNuizsinjrVhZaoRAgQTAJ4p9lFpK36Jtiff6NvMmi7qSmbJSACfVpzh
qlo/9I7HDADeKJSQXoaL0b4=
=oVJ9
-----END PGP SIGNATURE-----

--UJXkkAiHhNbsaLO7--

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] Assigning chained filter output to variable?
darren chamberlain 20:29 on 04 Jun 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52