This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163310 - Incorrect end line for HTML/RUBY code
Summary: Incorrect end line for HTML/RUBY code
Status: RESOLVED DUPLICATE of bug 137688
Alias: None
Product: ruby
Classification: Unclassified
Component: RHTML (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-21 21:07 UTC by Thomas Preisler
Modified: 2009-10-24 06:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2009-04-21 21:07:51 UTC
Originally bug report CR 6829622 Incorrect end line for HTML/RUBY code

FULL PRODUCT VERSION :
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP2

A DESCRIPTION OF THE PROBLEM :
I was unable to find a bug report for this on the database.

I installed instant rails and was working with that as the rails system used by Netbeans with mongrel as the web server.

I am learing Ruby on rails using Netbeans 6.5 as my editing system and server. At first Netbeans was working perfectly, but yesterday, it started having issues with the 
HTML/Ruby code. The following code:

<%= render(:partial => "cart" , :object => @cart) %>

is no longer working because Netbeans is setting the end of the HTML line at the first greater than (>)  symbol instead of the last one. So when I try to view the web page I get 
an error stating that the line is wrong because it only reads "<%= render(:partial =>" ignoring the rest of the line.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I was following the instruction on the book "Agile Web Development with Rails" third edition, which i am using to learn Ruby on rails web development. I was working on 
chapters 5-9 building the Depot application. The code worked until the end of chapter 8 when i inserted the code:

<%= button_to "Empty cart" , :action => :empty_cart %>

here the yellow boxes that signifies the start and end of a function moved from the "%>"  to the "=>" so the server is now ignoring everything after the "=>"

from there on, any code I type that has the  "=>"  causes Netbeans to close the HTML string at the greater than symbol in the "=>" function.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The code should close and when run the application should have read the whole line:

<%= button_to "Empty cart" , :action => :empty_cart %>

and not:

<%= button_to "Empty cart" , :action =>

ACTUAL -
The Netbeans sets the yellow boxes for the HTML code on the less than symbol at the start of the line and the first greater than symbol inside the line.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
NoMethodError in Store#index

Showing app/views/store/_cart.html.erb where line #6 raised:

undefined method `total_price' for #<Cart:0x933f80c>
Extracted source (around line #6):

3:     <%= render(:partial => "cart_item" , :collection => cart.items) %>
4:     <tr class="total-line">
5:       <td colspan="2">Total</td>
6:       <td class="total-cell"><%= number_to_currency(cart.total_price) %></td>
7:     </tr>
8:   </table>
9: <%= button_to "Empty cart" , :action => :empty_cart %>
Trace of template inclusion: app/views/layouts/store.html.erb

RAILS_ROOT: C:/rails/workspace/depot

Application Trace | Framework Trace | Full Trace
app/views/store/_cart.html.erb:6
app/views/layouts/store.html.erb:16
Request

Parameters:

None
Show session dump

Response

Headers:

{"cookie"=>[],
 "Content-Type"=>"text/html",
 "Cache-Control"=>"no-cache"}

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
<h1>Your Pragmatic Cart</h1>
<ul>
<% for item in @cart.items %>
<li><%= item.quantity %> &times; <%=h item.title %></li>
<% end %>
</ul>
<%= button_to "Empty cart" , :action => :empty_cart %>
---------- END SOURCE ----------
Comment 1 Erno Mononen 2009-05-21 15:45:07 UTC
Hi, thanks for the report. Can you please elaborate on what exactly do you mean by:

"The Netbeans sets the yellow boxes for the HTML code on the less than symbol at the start of the line and the first 
greater than symbol inside the line."

By the yellow boxes, do you mean how the brackets get highlighted? Note that this doesn't mean that NB would make any 
changes into the code, it is just highlightning. 
Comment 2 Thomas Preisler 2009-06-24 07:12:23 UTC
Please ask the customer kanifeli@gmail.com directly. I just transferred CR 6829622 to this issue.
Comment 3 Erno Mononen 2009-07-21 11:41:42 UTC
I'm sorry, I don't know to what are you referring by CR 6829622. In any case, I've sent an email to kanifeli@gmail.com 
asking him/her to comment on this issue - marking as incomplete until more info is provided.
Comment 4 kanifeli 2009-07-21 12:30:51 UTC
I am sorry if i was not clear enough at the time. The "yellow boxes" I refer to are the automatic highlights the
Netbeans uses to mark where a code line starts and stops. These are highlights provided for us so that we can check to
make sure that our code is complete and that all functions started are correctly ended. 

In HTML the Netbeans should always highlight the "<" less than symbol and the ">" greater than  symbol at the end of the
code line. Ruby uses the symbols "=>"  when defining many aspects of the work. For some reason, while I was working,
Netbeans started highlighting the symbol ">" at the end of the "=>" ending the section of code there instead of reaching
the true end. 

Using the original example I am going to use "||" to signify the Netbean Highlights. Again the highlights are the color
boxes that show up when you hover over a line of code that tell you where that function, class or line of HTML code
starts and ends.

If my code line is: <%= button_to "Empty cart" , :action => :empty_cart %>

The highlights should be and initially where located like this:

|<|%= button_to "Empty cart" , :action => :empty_cart %|>|

After a while of working however the Highlights were showing like this:

|<|%= button_to "Empty cart" , :action =|>| :empty_cart %>

When I tried running the code, the recorder error showed because it was not reading the full line. It was only reaching
the "=>" and that left the code incomplete creating an error.

I cannot add an image because one of my hard drives recently failed and I lost the Netbeans installation along with the
issue.
Comment 5 Erno Mononen 2009-08-20 13:18:21 UTC
Thanks for the clarification, I can see the issue now.
Comment 6 Erno Mononen 2009-09-09 15:16:59 UTC
This is in fact a dupe of an older issue, namely #137688. I'll try fix for 6.8.

*** This issue has been marked as a duplicate of 137688 ***