Re: [Templates] pre/post chomp question....

[prev] [thread] [next] [Date index for 2004/12/13]

From: Darren Chamberlain
Subject: Re: [Templates] pre/post chomp question....
Date: 22:11 on 13 Dec 2004
--rQ2U398070+RC21q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Sean T Allen <sean at usaherbals.com> [2004/12/13 11:48]:
> if i have the following at the start of a template:
>=20
> [%- DEFAULT
>   mc =3D 'WPJF1'
> -%]
> [%- IF mc =3D=3D 'WPJF1' -%]
>   [%- SET shipping =3D '4.95' -%]
> [%- ELSIF mc =3D=3D 'WPJF4' -%]
>   [%- SET shipping =3D '2.95' -%]
> [%- END -%]
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>=20
>=20
> shouldnt this remove all whitespace and newlines proceeding the doctype=
=20
> line?

You could just do it like this:

  [%- DEFAULT
    mc =3D 'WPJF1';

  IF mc =3D=3D 'WPJF1';
    SET shipping =3D '4.95';
  ELSIF mc =3D=3D 'WPJF4';
    SET shipping =3D '2.95';
  END;
  -%]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

This way, there is no chance of whitespace slipping through.  Plus,
it's a little easier to read.

(darren)

--=20
When correctly viewed, everything is lewd.
    -- Tom Lehrer

--rQ2U398070+RC21q
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFBvhN2zsinjrVhZaoRAopeAKCAnrqWPpClIrouhbHjDyUquutxCACgi/Fm
hGZlKfzaF78JcI9CNdKMZGo=
=1mwj
-----END PGP SIGNATURE-----

--rQ2U398070+RC21q--

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

[Templates] pre/post chomp question....
Sean T Allen 16:48 on 13 Dec 2004

Re: [Templates] pre/post chomp question....
Dave Cross 16:52 on 13 Dec 2004

Re: [Templates] pre/post chomp question....
Darren Chamberlain 22:11 on 13 Dec 2004

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