Input '>' character into html builder array


#1

I’m using an html calendar builder and am getting a compile error when
trying to input a close to some ruby code into the cell_input:
cell_text << “%>”, it seems that it is choking on the closing > sign.
Is there any way to escape this?

I could really use some help here, not sure how to search for
information on this. Thanks.
This is the line that I am having issues with:

cell_text << “%>”

This is the error output:

ActionView::TemplateError (compile error
syntax error, unexpected $undefined, expecting kEND
…<< “).to_s); erbout.concat “”\n \n \n\n\n [cell_text,…
^
syntax error, unexpected $end, expecting ‘)’) on line #37 of users/
calendar_large_data.rhtml:
34:
35: cell_text << "<%= "
36: cell_text << "javascript_tag "new Popup('test_popup
#{@day}’,
'test_popup_link
#{@day}’,{position:‘25%,30%’, trigger:‘click’,
modal:true})”"
37: cell_text << “%>”
38:
39:
40:

I was having a similar compile issue with inputting double quotes into
the cell_text array and was able to use \ to avoid any problems:

cell_text << “<div id=“test_popup_#{@day}” class=“cal_popup” style=
“display:none”>”


#2

On 14 Jan 2009, at 03:50, David wrote:

cell_text << “%>”

<% and %> are special in erb. You need to use <%% and %%> to include
literal <% and %>
Or avoid the whole lot by putting it in a helper.

Fred