Skip to content

Instantly share code, notes, and snippets.

@cooldaemon
Created February 19, 2009 08:11
Show Gist options
  • Save cooldaemon/66796 to your computer and use it in GitHub Desktop.
Save cooldaemon/66796 to your computer and use it in GitHub Desktop.
setlocal makeprg=~/bin/ttlint.pl\ %
#!/usr/bin/env perl
use strict;
use warnings;
use Path::Class qw(file);
use Template::Parser;
my $file = file(shift);
my $source = $file->slurp;
my $parser = Template::Parser->new;
if ($parser->parse($source)) {
print 'Syntax OK', "\n";
exit;
}
my $error = $parser->error;
$error =~ s/^line\s(\d+):\s/${1}:/;
$error =~ s/\n//g;
$error =~ s/\s{2,}/ /g;
print $file->absolute, ':', $error, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment