|
List Info
Thread: "%p..class"
|
|
| "%p..class" |
  United States |
2007-10-20 17:47:04 |
I was familiarizing myself with the Haml engine code and
came across
this untested negative case. I had assumed that this would
throw
"Illegal element: classes and ids must have
values."
The problem is with the
if !attributes.empty? && '.#'.include?(attributes)
check on line 729 of haml/engine.rb.
This only checks for attributes of length 1 (which should be
invalid
in every case, right, not just the above, since attributes
include the
'.' or '#' qualifier).
This fixes the problem:
if !attributes.empty? && (attributes.length == 1 ||
attributes =~ /[.#]
[.#{]/)
Then add "%p..class" to the list of syntax errors
in engine_test.rb.
Assuming I'm not missing something; which I probably am.
What is the
best way to contribute changes ?
On an aside, I'm getting about 33% variance between
different runs of
the benchmark utility. Any idea what is going on there ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |

|
2007-10-20 20:05:30 |
Create an actual patch by using the diff statement in Unix.
Secondly, the benchmarks are funny that way. Mostly, its
because each
template is *really* fast to render and the small hiccups
and
processor-cache issues going on inside of your computer make
a huge
difference when stretched over the entire benchmark suite.
If its any reason beyond this, I'd love to hear the
reasons.
-hampton.
On 10/20/07, Dylan Bruzenak <AegisThorne gmail.com> wrote:
>
> I was familiarizing myself with the Haml engine code
and came across
> this untested negative case. I had assumed that this
would throw
> "Illegal element: classes and ids must have
values."
>
> The problem is with the
>
> if !attributes.empty? &&
'.#'.include?(attributes)
>
> check on line 729 of haml/engine.rb.
>
> This only checks for attributes of length 1 (which
should be invalid
> in every case, right, not just the above, since
attributes include the
> '.' or '#' qualifier).
>
> This fixes the problem:
>
> if !attributes.empty? && (attributes.length ==
1 || attributes =~ /[.#]
> [.#{]/)
>
> Then add "%p..class" to the list of syntax
errors in engine_test.rb.
>
> Assuming I'm not missing something; which I probably
am. What is the
> best way to contribute changes ?
>
> On an aside, I'm getting about 33% variance between
different runs of
> the benchmark utility. Any idea what is going on there
?
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |
  United States |
2007-10-21 13:24:16 |
For some reason I completely missed the 'development' page
on the haml
site explaining this; I'm going to take the easy out and
blame my
cold.
Here is a patch:
Index: test/haml/engine_test.rb
============================================================
=======
--- test/haml/engine_test.rb (revision 606)
+++ test/haml/engine_test.rb (working copy)
 -190,7
+190,7 
"an%p~nb", "an~nb",
"an~n b", "%p~n b", "%p/n
a",
"%pn t%a b", "%an
bnc", "%an bnc",
":notafiltern This isn'tn a
filter!",
- ".{} a", "#{} a",
".= 'foo'", "%a/ b" ]
+ ".{} a", "#{} a",
".= 'foo'", "%a/ b",
"%p..class" ]
errs.each do |err|
begin
render(err)
Index: lib/haml/engine.rb
============================================================
=======
--- lib/haml/engine.rb (revision 606)
+++ lib/haml/engine.rb (working copy)
 -726,7
+726,7 
attributes_hash = "" if
attributes_hash.nil? ||
literal_attributes || options[:suppress_eval]
object_ref = "nil" if object_ref.nil? ||
options[:suppress_eval]
- if !attributes.empty? &&
'.#'.include?(attributes)
+ if !attributes.empty? && (attributes.length
== 1 ||
attributes =~ /[.#][.#{]/)
raise SyntaxError.new("Illegal element:
classes and ids
must have values. Use %div instead.")
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |
  United States |
2007-10-21 13:31:58 |
Could you pastie that? Google Groups wraps the lines and
makes it
awkward to apply.
- Nathan
Dylan Bruzenak wrote:
> For some reason I completely missed the 'development'
page on the haml
> site explaining this; I'm going to take the easy out
and blame my
> cold.
>
> Here is a patch:
>
> Index: test/haml/engine_test.rb
>
============================================================
=======
> --- test/haml/engine_test.rb (revision 606)
> +++ test/haml/engine_test.rb (working copy)
>  -190,7 +190,7 
> "an%p~nb",
"an~nb", "an~n b", "%p~n
b", "%p/n
> a",
> "%pn t%a b", "%an
bnc", "%an bnc",
> ":notafiltern This isn'tn a
filter!",
> - ".{} a", "#{} a",
".= 'foo'", "%a/ b" ]
> + ".{} a", "#{} a",
".= 'foo'", "%a/ b",
"%p..class" ]
> errs.each do |err|
> begin
> render(err)
> Index: lib/haml/engine.rb
>
============================================================
=======
> --- lib/haml/engine.rb (revision 606)
> +++ lib/haml/engine.rb (working copy)
>  -726,7 +726,7 
> attributes_hash = "" if
attributes_hash.nil? ||
> literal_attributes || options[:suppress_eval]
> object_ref = "nil" if
object_ref.nil? ||
> options[:suppress_eval]
>
> - if !attributes.empty? &&
'.#'.include?(attributes)
> + if !attributes.empty? &&
(attributes.length == 1 ||
> attributes =~ /[.#][.#{]/)
> raise SyntaxError.new("Illegal element:
classes and ids
> must have values. Use %div instead.")
> end
>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |
  United States |
2007-10-21 14:09:16 |
http://pastie.caboo.se/
109396
On Oct 21, 1:31 pm, Nathan Weizenbaum <nex... gmail.com> wrote:
> Could you pastie that? Google Groups wraps the lines
and makes it
> awkward to apply.
>
> - Nathan
>
> Dylan Bruzenak wrote:
> > For some reason I completely missed the
'development' page on the haml
> > site explaining this; I'm going to take the easy
out and blame my
> > cold.
>
> > Here is a patch:
>
> > Index: test/haml/engine_test.rb
> >
============================================================
=======
> > --- test/haml/engine_test.rb (revision 606)
> > +++ test/haml/engine_test.rb (working copy)
> >  -190,7 +190,7 
> > "an%p~nb",
"an~nb", "an~n b", "%p~n
b", "%p/n
> > a",
> > "%pn t%a b", "%an
bnc", "%an bnc",
> > ":notafiltern This isn'tn a
filter!",
> > - ".{} a", "#{}
a", ".= 'foo'", "%a/ b" ]
> > + ".{} a", "#{}
a", ".= 'foo'", "%a/ b",
"%p..class" ]
> > errs.each do |err|
> > begin
> > render(err)
> > Index: lib/haml/engine.rb
> >
============================================================
=======
> > --- lib/haml/engine.rb (revision 606)
> > +++ lib/haml/engine.rb (working copy)
> >  -726,7 +726,7 
> > attributes_hash = "" if
attributes_hash.nil? ||
> > literal_attributes || options[:suppress_eval]
> > object_ref = "nil" if
object_ref.nil? ||
> > options[:suppress_eval]
>
> > - if !attributes.empty? &&
'.#'.include?(attributes)
> > + if !attributes.empty? &&
(attributes.length == 1 ||
> > attributes =~ /[.#][.#{]/)
> > raise SyntaxError.new("Illegal
element: classes and ids
> > must have values. Use %div instead.")
> > end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |
  United States |
2007-10-21 14:24:44 |
Applied. Thanks!
Dylan Bruzenak wrote:
> http://pastie.caboo.se/
109396
>
>
>
> On Oct 21, 1:31 pm, Nathan Weizenbaum <nex... gmail.com> wrote:
>
>> Could you pastie that? Google Groups wraps the
lines and makes it
>> awkward to apply.
>>
>> - Nathan
>>
>> Dylan Bruzenak wrote:
>>
>>> For some reason I completely missed the
'development' page on the haml
>>> site explaining this; I'm going to take the
easy out and blame my
>>> cold.
>>>
>>> Here is a patch:
>>>
>>> Index: test/haml/engine_test.rb
>>>
============================================================
=======
>>> --- test/haml/engine_test.rb (revision
606)
>>> +++ test/haml/engine_test.rb (working
copy)
>>>  -190,7 +190,7 
>>> "an%p~nb",
"an~nb", "an~n b", "%p~n
b", "%p/n
>>> a",
>>> "%pn t%a b",
"%an bnc", "%an bnc",
>>> ":notafiltern This isn'tn
a filter!",
>>> - ".{} a", "#{}
a", ".= 'foo'", "%a/ b" ]
>>> + ".{} a", "#{}
a", ".= 'foo'", "%a/ b",
"%p..class" ]
>>> errs.each do |err|
>>> begin
>>> render(err)
>>> Index: lib/haml/engine.rb
>>>
============================================================
=======
>>> --- lib/haml/engine.rb (revision 606)
>>> +++ lib/haml/engine.rb (working copy)
>>>  -726,7 +726,7 
>>> attributes_hash = "" if
attributes_hash.nil? ||
>>> literal_attributes || options[:suppress_eval]
>>> object_ref = "nil" if
object_ref.nil? ||
>>> options[:suppress_eval]
>>>
>>> - if !attributes.empty? &&
'.#'.include?(attributes)
>>> + if !attributes.empty? &&
(attributes.length == 1 ||
>>> attributes =~ /[.#][.#{]/)
>>> raise SyntaxError.new("Illegal
element: classes and ids
>>> must have values. Use %div instead.")
>>> end
>>>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: "%p..class" |
  United States |
2007-10-21 14:33:31 |
No problem. Now I can get up to more mischief ;)
Thanks to Hampton and yourself for putting out this neat
little
language. It is making my html coding enjoyable for a
change.
On Oct 21, 2:24 pm, Nathan Weizenbaum <nex... gmail.com> wrote:
> Applied. Thanks!
>
> Dylan Bruzenak wrote:
> >http://pastie.caboo.se/
109396
>
> > On Oct 21, 1:31 pm, Nathan Weizenbaum
<nex... gmail.com> wrote:
>
> >> Could you pastie that? Google Groups wraps the
lines and makes it
> >> awkward to apply.
>
> >> - Nathan
>
> >> Dylan Bruzenak wrote:
>
> >>> For some reason I completely missed the
'development' page on the haml
> >>> site explaining this; I'm going to take
the easy out and blame my
> >>> cold.
>
> >>> Here is a patch:
>
> >>> Index: test/haml/engine_test.rb
> >>>
============================================================
=======
> >>> --- test/haml/engine_test.rb
(revision 606)
> >>> +++ test/haml/engine_test.rb
(working copy)
> >>>  -190,7 +190,7 
> >>> "an%p~nb",
"an~nb", "an~n b", "%p~n
b", "%p/n
> >>> a",
> >>> "%pn t%a b",
"%an bnc", "%an bnc",
> >>> ":notafiltern This
isn'tn a filter!",
> >>> - ".{} a",
"#{} a", ".= 'foo'", "%a/ b"
]
> >>> + ".{} a",
"#{} a", ".= 'foo'", "%a/ b",
"%p..class" ]
> >>> errs.each do |err|
> >>> begin
> >>> render(err)
> >>> Index: lib/haml/engine.rb
> >>>
============================================================
=======
> >>> --- lib/haml/engine.rb (revision 606)
> >>> +++ lib/haml/engine.rb (working copy)
> >>>  -726,7 +726,7 
> >>> attributes_hash =
"" if attributes_hash.nil? ||
> >>> literal_attributes || options[:suppress_eval]
> >>> object_ref = "nil" if
object_ref.nil? ||
> >>> options[:suppress_eval]
>
> >>> - if !attributes.empty? &&
'.#'.include?(attributes)
> >>> + if !attributes.empty? &&
(attributes.length == 1 ||
> >>> attributes =~ /[.#][.#{]/)
> >>> raise
SyntaxError.new("Illegal element: classes and ids
> >>> must have values. Use %div
instead.")
> >>> end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-7]
|
|