Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3570

Re: File.open of HTML file removes code

From Scott Elwood <elwood32@live.com>
Newsgroups comp.lang.ruby
Subject Re: File.open of HTML file removes code
Date 2011-04-27 13:57 -0500
Organization Service de news de lacave.net
Message-ID <188b9aabd4a7d3d2732aced0c2a27b7d@ruby-forum.com> (permalink)
References <f35f5a43da863832e708040011124ed4@ruby-forum.com>

Show all headers | View raw


Thanks to both of you!

I checked both of the code you guys suggested and it worked fine. 
However there is still a problem.

I am developing an application for a ruby class I am in, and I would 
like to edit some of that .erb file in an HTML textarea. I am using 
Ruby/Sinatra, and here is what happens:

If I print the data into a <div>, it will show everything including the 
doctype, body, etc.

Yet when I do this:

<textarea cols="93" rows="32" name="contents">
   <% File.open("views/layoutAdmin.erb") do |file| %>
      <% file.each_line do |line| %>
         <%= line %>
      <% end %>
   <% end %>
</textarea>

The textarea will take away all of the aforementioned tags. Like I said 
before, if I replace the <textarea> tags with <div> tags, it works fine, 
but I of course can't edit that content.

Is there some reason why textareas do not display this data?

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-27 01:01 -0500
  Re: File.open of HTML file removes code Nikita Baksalyar <n.baksalyar@yandex.ru> - 2011-04-27 01:52 -0500
  Re: File.open of HTML file removes code Brian Candler <b.candler@pobox.com> - 2011-04-27 02:49 -0500
  Re: File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-27 13:57 -0500
    Re: File.open of HTML file removes code 7stud -- <bbxx789_05ss@yahoo.com> - 2011-04-27 19:39 -0500
  Re: File.open of HTML file removes code Scott Elwood <elwood32@live.com> - 2011-04-28 01:14 -0500

csiph-web