Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Text-Haml CPAN distribution.

Report information
The Basics
Id: 87716
Status: new
Priority: 0/
Queue: Text-Haml

People
Owner: Nobody in particular
Requestors: jason [...] moz.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Jason Younker <jason [...] ynkr.org>
Subject: [PATCH] Do not confuse double braces for attributes
Date: Thu, 8 Aug 2013 09:41:39 -0700
To: bug-Text-Haml [...] rt.cpan.org
From: Jason Younker <jason [...] moz.com>
--- lib/Text/Haml.pm | 2 +- t/html-attributes.t | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/Text/Haml.pm b/lib/Text/Haml.pm index 087afc3..a7f824b 100644 --- a/lib/Text/Haml.pm +++ b/lib/Text/Haml.pm @@ -342,7 +342,7 @@ sub parse { if ($line =~ m/^(?:$tag_start |$class_start |$id_start - |$attributes_start + |$attributes_start[^$attributes_start] |$attributes_start2 )/x ) diff --git a/t/html-attributes.t b/t/html-attributes.t index 9e27c89..fedd6a8 100644 --- a/t/html-attributes.t +++ b/t/html-attributes.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 9; use Text::Haml; @@ -44,6 +44,24 @@ is($output, <<'EOF'); <div class='bar hello'></div> </html> EOF + +# Do not confuse double braces for attributes +$output = $haml->render(<<'EOF'); +{{ foo }} +EOF +is($output, <<'EOF'); +{{ foo }} +EOF + +$output = $haml->render(<<'EOF'); +%div{:class => 'foo'} + {{ bar }} +EOF +is($output, <<'EOF'); +<div class='foo'> + {{ bar }} +</div> +EOF # ## Attribute Methods # -- 1.7.3.4