Permalink
Browse files

Filter names: require alphanum_ and ignore trailing wspc

  • Loading branch information...
1 parent 156621d commit 34ed02bf393f6c3f38ca55f40a8a03b969eda2e0 enosis committed with enosis Aug 13, 2010
Showing with 10 additions and 2 deletions.
  1. +1 −1 lib/Text/Haml.pm
  2. +9 −1 t/filters.t
View
2 lib/Text/Haml.pm
@@ -253,7 +253,7 @@ sub parse {
}
# Filter
- if ($line =~ m/^:(.*)/) {
+ if ($line =~ m/^:(\w+)/) {
$el->{type} = 'filter';
$el->{name} = $1;
$el->{text} = '';
View
10 t/filters.t
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 6;
use Text::Haml;
@@ -64,3 +64,11 @@ is($output, <<'EOF');
A line with many spaces!
EOF
+# :plain
+$output = $haml->render(<<'EOF');
+:plain
+ This is a plain text - filter name with trailing whitespace.
+EOF
+is($output, <<'EOF');
+This is a plain text - filter name with trailing whitespace.
+EOF

0 comments on commit 34ed02b

Please sign in to comment.