On Fri, Apr 25, 2008 at 06:06:59AM -0700, Chris Kutler wrote:
> Hi,
>
> Most times in an erb file, when I click on a <%, <%= or %>, it and its mate
> are highlighted in yellow. Sometimes, when I click to the right of an ending
> %>, the > is highlighted in red and the beginning < is not highlighed. Do you
> know why?
>
> In the following code, the first and third are highlighted correctly, but I
> get red on the > for the 2nd line.
>
>
>
> <% @post_comments.each do |comment| %>
> <%= render :partial=>"comment", :object => comment %> << red
> <% end %>
>
>
>
> In the following code, I get red for the first line but not the others
>
> <% form_remote_tag :url => {:action => 'post_comment'} do % << red
> <p><label for="comment_comment">Comment</label><br/>
> <%= text_area 'comment', 'comment' %></p>
>
> <%= submit_tag "Post" %>
> <%end %>
I've noticed this, too. It seems to be down to the fact the parser seems
to not group <% and %> as a pair - instead, it just observes the < >, so
that in hash assignments, the > of the => is taken as the closing token
for the erb tag <%.
So in your example, above, the <%= is matched (in the opinion of the
parser, at any rate) by the first => in your hash assignments. In the
correctly highlighted cases, there are no other angle brackets embedded
between your erb tags.
I don't know if this has been logged as a bug? I haven't time to check
right now, I'm late for work already! ;-)
Dan
--
Daniel Bye
_
ASCII ribbon campaign ( )
- against HTML, vCards and X
- proprietary attachments in e-mail / \