[Jifty-commit] r2240 - Template-Declare/lib/Template/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Fri Dec 1 00:12:29 EST 2006


Author: audreyt
Date: Fri Dec  1 00:12:29 2006
New Revision: 2240

Modified:
   Template-Declare/lib/Template/Declare/Tags.pm

Log:
* Template::Declare::Tags - Tr/td is now row/cell.

Modified: Template-Declare/lib/Template/Declare/Tags.pm
==============================================================================
--- Template-Declare/lib/Template/Declare/Tags.pm	(original)
+++ Template-Declare/lib/Template/Declare/Tags.pm	Fri Dec  1 00:12:29 2006
@@ -4,12 +4,16 @@
 package Template::Declare::Tags;
 use vars qw/@EXPORT @EXPORT_OK $self/;
 use base 'Exporter';
- at EXPORT = (qw(with template private show get_current_attr outs in_isolation $self));
+ at EXPORT = qw( with template private show get_current_attr outs in_isolation $self
+              Tr td ); # these two warns the user to use row/cell instead
 
 our $DEPTH = 0;
 our %ATTRIBUTES = ();
 our $BUFFER = '';
 
+sub Tr (&) { die "tr {...} and td {...} are invalid; use row {...} and cell {...} instead." }
+sub td (&) { die "tr {...} and td {...} are invalid; use row {...} and cell {...} instead." }
+
 sub outs { $BUFFER .= join('',grep { defined } @_); return ''; }
 
 sub template ($$) {
@@ -34,13 +38,19 @@
 sub private ($) {
 }
 
+use constant TagAlternateSpelling => {
+    Tr => 'row',
+    td => 'cell',
+};
+
 sub install_tag {
     my $tag = shift;
-    { no strict 'refs';
-      *{$tag} = sub (&) {local *__ANON__ = $tag; _tag(@_)};
+    {
+        no strict 'refs';
+        my $name = (TagAlternateSpelling->{$tag} || $tag);
+        *$name = sub (&) { local *__ANON__ = $tag; _tag(@_) };
     }
-      push @EXPORT_OK, $tag;
-      push @EXPORT, $tag;
+    push @EXPORT, $tag;
 }
 
 


More information about the Jifty-commit mailing list