@@ -, +, @@
1;
+use File::Find;
+use Cwd;
+
+
+my @files_with_directive_in_tag = do {
+ my @files;
+ find( sub {
+ my $dir = getcwd();
+ return if $dir =~ /blib/;
+ return unless /\.(tt)$/;
+ open my $fh, "<", $_;
+ my $name = $_;
+ my $line = 1;
+ my @lines;
+ while ( <$fh> ) {
+ push @lines, $line if /<([a-z]*)\s*\[/i;
+ $line++;
+ }
+ ($dir) = $dir =~ /koha-tmpl\/(.*)$/;
+ push @files, { name => "$dir/$name", lines => \@lines } if @lines;
+ }, ( './koha-tmpl/opac-tmpl/prog/en', './koha-tmpl/intranet-tmpl/prog/en' ) );
+ @files;
+};
+
+
+ok( !@files_with_directive_in_tag, "TT syntax: not using TT directive within HTML tag" )
+ or diag( "Files list: \n",
+ join( "\n", map {$_->{name} . ': ' . join(', ', @{$_->{lines}})
+ } @files_with_directive_in_tag ) );
+
+
+
+=head1 NAME
+
+tt_valid.t
+
+=head1 DESCRIPTION
+
+This test validate Template Toolkit (TT) Koha files.
+
+For the time being an unique validation is done: Test if TT files contain TT
+directive within HTML tag. For example:
+
+