Hi Garu,
Apologies, I seem to be causing mild confusion here: my post had the wrong subject line and has nothing to do with the original thread. You might want to repost your reply to the last relevant post on this subject, which I think was made by '/Ashley Pond V'.

Regards,
David T

Note to self: turn off daily digests before posting
/

On 18/05/13 23:18, breno wrote:
Hi there,

I may have not understood the issue at all so, forgive me, but isn't
this a variation of the 'collapse' filter?

https://metacpan.org/module/ABW/Template-Toolkit-2.24/lib/Template/Manual/Filters.pod#collapse

If this is the case, you could achieve minification via a block or a wrapper:

[% WRAPPER minified %]
   this    is my content
   with whitespaces and
   new
lines
[%END %]

Then, in minified.tt:

[% content | collapse %]

Otherwise, you might also want to look at
Template::Plugin::Filter::MinifyHTML and friends. Or even better, if
you're using a plack-based web server to render your templates, go for
a middleware solution such as Plack::Middleware::HTMLMinify.

Cheers!

garu


On Sat, May 18, 2013 at 8:09 AM, David Turland <da...@turland.org> wrote:
Hi,
So this is the hack I have added which 'seems' to 'work':


--- Directive.orig.pm    2013-05-18 11:53:37.363955087 +0100
+++ Directive.pm    2013-05-18 11:52:43.627224944 +0100
@@ -250,6 +250,11 @@
      my ($self, $var, $val, $default) = @_;

      if (ref $var) {
+
+        if ( "\'constants\'" eq $var->[0]){
+          print "Tried to assign $val to  $var->[0] which is probably the
CONSTANTS hash";
+          die " You might want to catch this?";
+        }
          if (scalar @$var == 2 && ! $var->[1]) {
              $var = $var->[0];
          }

Note : it is in Directives::assign (which could die) rather than Stash::set
(which refused to die or throw)

Also, the hack:
-  is probably not in the best place,
-  does not check for CONSTANTS_NAMESPACE
-  does throw or die in an informative way (hence the print)
-  is not constrained to STRICT or DEBUG

Comments and suggestions welcome.

Regards,

David T





_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates


_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to