Hi all, I''d like to unindent a block of ERB specifically to combat the extra spacing being added to content inside <textarea> by the browser. Is there such a feature in ERB? I shall denote indentation with underscores in the pseudo code example below. Thanks in advance, Khoan. myview.erb: <html ...> __<%= render ''form'' %> </html> _form.erb: <% form_for ... do %> __<%= render ''unindented'' %> <% end %> _unindented.erb: <textarea><%= ''this is unindented'' %></textarea> which would output something along the line of: <html ...> __<form ...> ____<textarea>this is unindented</textarea> __</form> </html> I want something to this effect: <html ...> __<form ...> <textarea>this is unindented</textarea> __</form> </html> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 17 February 2011 04:19, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I''d like to unindent a block of ERB specifically to combat the extra > spacing being added to content inside <textarea> by the browser. Is > there such a feature in ERB? > > I shall denote indentation with underscores in the pseudo code example > below. > > Thanks in advance, > Khoan. > > > myview.erb: > > <html ...> > __<%= render ''form'' %> > </html> > > > _form.erb: > > <% form_for ... do %> > __<%= render ''unindented'' %> > <% end %> > > > _unindented.erb: > > <textarea><%= ''this is unindented'' %></textarea> > > > which would output something along the line of: > > <html ...> > __<form ...> > ____<textarea>this is unindented</textarea>I don''t think so, have you tried it and checked the html (View > Page Source or similar in the browser). The line __<%= render ''unindented'' %> says output underlines then render unindented. There is no way that you can remove the underlines before the <%= render %>. However why not just put, at the start of the line <%= render ''unindented'' %> However I do not understand why it matters. None of this will give you extra space *inside* the textarea. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> > > I don''t think so, have you tried it and checked the html (View > Page > Source or similar in the browser). The line > __<%= render ''unindented'' %> > says output underlines then render unindented. There is no way that > you can remove the underlines before the <%= render %>. However why > not just put, at the start of the line > <%= render ''unindented'' %> > However I do not understand why it matters. None of this will give > you extra space *inside* the textarea. > > Colin > > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaceswith underscores so it would be easy to picture. He wanted to remove the indentation for the textarea tag so it would be in line with the html tag when you look at the html source. To the OP, I don''t think there''s an erb option that would give you what you want. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
To solve the indentation problem, don''t indent the tags in your templates. You may have to experiment, but the result should be what you want. With ERB I''ve found that I can have either nicely aligned templates, or somewhat nicely aligned HTML output. I write "somewhat" because it never seems to be quite right, and the whole thing seems ugly and awkward (surprising in Rails-land). If anyone has a solution for this problem (besides Haml), please respond. :) The other common issue is empty lines between code blocks. With Erubis you can fix this by changing closing tags from "%>" to "-%>". On Feb 16, 11:19 pm, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I''d like to unindent a block of ERB specifically to combat the extra > spacing being added to content inside <textarea> by the browser. Is > there such a feature in ERB?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 17 February 2011 11:26, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:>> >> I don''t think so, have you tried it and checked the html (View > Page >> Source or similar in the browser). The line >> __<%= render ''unindented'' %> >> says output underlines then render unindented. There is no way that >> you can remove the underlines before the <%= render %>. However why >> not just put, at the start of the line >> <%= render ''unindented'' %> >> However I do not understand why it matters. None of this will give >> you extra space *inside* the textarea. >> >> Colin >> > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaces > with underscores so it would be easy to picture. > He wanted to remove the indentation for the textarea tag so it would be in > line with the html tag when you look at the > html source. > To the OP, I don''t think there''s an erb option that would give you what you > want.I Knew that, I also was showing underscores for spaces. The point is that only spaces that the op includes in the erb will be copied through to the html. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you. I suspect as much. Would this be a worthwhile or nice to have feature? On Feb 17, 10:26 pm, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I don''t think so, have you tried it and checked the html (View > Page > > Source or similar in the browser). The line > > __<%= render ''unindented'' %> > > says output underlines then render unindented. There is no way that > > you can remove the underlines before the <%= render %>. However why > > not just put, at the start of the line > > <%= render ''unindented'' %> > > However I do not understand why it matters. None of this will give > > you extra space *inside* the textarea. > > > Colin > > > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaces > > with underscores so it would be easy to picture. > He wanted to remove the indentation for the textarea tag so it would be in > line with the html tag when you look at the > html source. > > To the OP, I don''t think there''s an erb option that would give you what you > want.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m using Rails 3. Erubis is using some XML::Builder with indent set to 2. I suspect Haml won''t be of help either, since it''ll delegate to Erubis at some point. the <%- only unindents a block to align with its closests <%= render parent. Can''t go further than that. On Feb 17, 11:08 pm, djangst <djan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> To solve the indentation problem, don''t indent the tags in your > templates. You may have to experiment, but the result should be what > you want. > > With ERB I''ve found that I can have either nicely aligned templates, > or somewhat nicely aligned HTML output. I write "somewhat" because it > never seems to be quite right, and the whole thing seems ugly and > awkward (surprising in Rails-land). > > If anyone has a solution for this problem (besides Haml), please > respond. :) > > The other common issue is empty lines between code blocks. With Erubis > you can fix this by changing closing tags from "%>" to "-%>". > > On Feb 16, 11:19 pm, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > Hi all, > > > I''d like to unindent a block of ERB specifically to combat the extra > > spacing being added to content inside <textarea> by the browser. Is > > there such a feature in ERB?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 February 2011 11:09, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using Rails 3. Erubis is using some XML::Builder with indent set > to 2. > > I suspect Haml won''t be of help either, since it''ll delegate to Erubis > at some point. > > the <%- only unindents a block to align with its closests <%= render > parent. Can''t go further than that.I don''t understand why you are worried about additional whitespace in the html. It should not make any difference to what is displayed. Can you show an exact example of the problem html and explain why it matters? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I have tried: _form.erb: <% form_for ... do %> __<%- safe_concat ''<textarea>this is unindented</textarea> %> <% end %> which would output: <html ...> __<form ...> __<textarea>this is unindented</textarea> __</form> </html> On Feb 18, 4:05 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 17 February 2011 11:26, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > >> I don''t think so, have you tried it and checked the html (View > Page > >> Source or similar in the browser). The line > >> __<%= render ''unindented'' %> > >> says output underlines then render unindented. There is no way that > >> you can remove the underlines before the <%= render %>. However why > >> not just put, at the start of the line > >> <%= render ''unindented'' %> > >> However I do not understand why it matters. None of this will give > >> you extra space *inside* the textarea. > > >> Colin > > > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaces > > with underscores so it would be easy to picture. > > He wanted to remove the indentation for the textarea tag so it would be in > > line with the html tag when you look at the > > html source. > > To the OP, I don''t think there''s an erb option that would give you what you > > want. > > I Knew that, I also was showing underscores for spaces. The point is > that only spaces that the op includes in the erb will be copied > through to the html. > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 February 2011 11:13, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have tried: > > _form.erb: > > <% form_for ... do %> > __<%- safe_concat ''<textarea>this is unindented</textarea> %> > <% end %> > > which would output: > > <html ...> > __<form ...> > __<textarea>this is unindented</textarea> > __</form> > </html>The question is why that matters to you. On screen or print it should look exactly the same as <html ...> <form ...> <textarea>this is unindented</textarea> </form> </html>> > On Feb 18, 4:05 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 17 February 2011 11:26, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> >> >> >> >> >> >> >> >> >> >> I don''t think so, have you tried it and checked the html (View > Page >> >> Source or similar in the browser). The line >> >> __<%= render ''unindented'' %> >> >> says output underlines then render unindented. There is no way that >> >> you can remove the underlines before the <%= render %>. However why >> >> not just put, at the start of the line >> >> <%= render ''unindented'' %> >> >> However I do not understand why it matters. None of this will give >> >> you extra space *inside* the textarea. >> >> >> Colin >> >> > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaces >> > with underscores so it would be easy to picture. >> > He wanted to remove the indentation for the textarea tag so it would be in >> > line with the html tag when you look at the >> > html source. >> > To the OP, I don''t think there''s an erb option that would give you what you >> > want. >> >> I Knew that, I also was showing underscores for spaces. The point is >> that only spaces that the op includes in the erb will be copied >> through to the html. >> >> Colin > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
<html> <body> <textarea>if indent then __indent end</textarea> __<textarea>if indent then __indent end</textarea> </body> </html> When viewed in the browser: the first <textarea> appears as and will be saved as thus: if indent then __indent end similarly, 2nd <textarea> appears as and will be saved as thus: __if indent then ____indent __end On Feb 18, 10:24 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 18 February 2011 11:13, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I have tried: > > > _form.erb: > > > <% form_for ... do %> > > __<%- safe_concat ''<textarea>this is unindented</textarea> %> > > <% end %> > > > which would output: > > > <html ...> > > __<form ...> > > __<textarea>this is unindented</textarea> > > __</form> > > </html> > > The question is why that matters to you. On screen or print it should > look exactly the same as > <html ...> > <form ...> > <textarea>this is unindented</textarea> > </form> > </html> > > > > > > > > > > > On Feb 18, 4:05 am, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 17 February 2011 11:26, Jim Ruther Nill <jvn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> >> I don''t think so, have you tried it and checked the html (View > Page > >> >> Source or similar in the browser). The line > >> >> __<%= render ''unindented'' %> > >> >> says output underlines then render unindented. There is no way that > >> >> you can remove the underlines before the <%= render %>. However why > >> >> not just put, at the start of the line > >> >> <%= render ''unindented'' %> > >> >> However I do not understand why it matters. None of this will give > >> >> you extra space *inside* the textarea. > > >> >> Colin > > >> > Colin, i''m just clarifying what the OP meant. He replaced the tabs/spaces > >> > with underscores so it would be easy to picture. > >> > He wanted to remove the indentation for the textarea tag so it would be in > >> > line with the html tag when you look at the > >> > html source. > >> > To the OP, I don''t think there''s an erb option that would give you what you > >> > want. > > >> I Knew that, I also was showing underscores for spaces. The point is > >> that only spaces that the op includes in the erb will be copied > >> through to the html. > > >> Colin > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 19 February 2011 09:30, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <html> > <body> > <textarea>if indent then > __indent > end</textarea> > > __<textarea>if indent then > __indent > end</textarea> > > </body> > </html> > > When viewed in the browser: > > the first <textarea> appears as and will be saved as thus: > > if indent then > __indent > end > > similarly, 2nd <textarea> appears as and will be saved as thus: > > __if indent then > ____indent > __endOK, that is not the problem you originally asked. From your first message you have <textarea><%= ''this is unindented'' %></textarea> which is not the above situation at all. Can you show me the erb you are using to generate the problem code you are now showing? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The app is using formtastic to generate the textarea. I''ve watered it down to the barebone code provided in the first post. If we can unindent the <%= render ''unindent'' %> to align with <html>, then we have a winner. So far I fathom that this is not possible. Work around would be to apply some js solution on the <textarea> to keep the formatting we want. On Feb 19, 8:59 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 19 February 2011 09:30, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > <html> > > <body> > > <textarea>if indent then > > __indent > > end</textarea> > > > __<textarea>if indent then > > __indent > > end</textarea> > > > </body> > > </html> > > > When viewed in the browser: > > > the first <textarea> appears as and will be saved as thus: > > > if indent then > > __indent > > end > > > similarly, 2nd <textarea> appears as and will be saved as thus: > > > __if indent then > > ____indent > > __end > > OK, that is not the problem you originally asked. From your first > message you have > <textarea><%= ''this is unindented'' %></textarea> > which is not the above situation at all. > > Can you show me the erb you are using to generate the problem code you > are now showing? > > Colin-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 20 February 2011 08:39, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The app is using formtastic to generate the textarea. I''ve watered it > down to the barebone code provided in the first post.How are you giving formtastic the initial text for the textarea? Can you show the code you use for that? Please don''t top post, it makes it difficult to follow the thread. Insert your reply into the previous post. Thanks. Colin> > If we can unindent the <%= render ''unindent'' %> to align with <html>, > then we have a winner. So far I fathom that this is not possible. Work > around would be to apply some js solution on the <textarea> to keep > the formatting we want. > > On Feb 19, 8:59 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 19 February 2011 09:30, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > <html> >> > <body> >> > <textarea>if indent then >> > __indent >> > end</textarea> >> >> > __<textarea>if indent then >> > __indent >> > end</textarea> >> >> > </body> >> > </html> >> >> > When viewed in the browser: >> >> > the first <textarea> appears as and will be saved as thus: >> >> > if indent then >> > __indent >> > end >> >> > similarly, 2nd <textarea> appears as and will be saved as thus: >> >> > __if indent then >> > ____indent >> > __end >> >> OK, that is not the problem you originally asked. From your first >> message you have >> <textarea><%= ''this is unindented'' %></textarea> >> which is not the above situation at all. >> >> Can you show me the erb you are using to generate the problem code you >> are now showing? >> >> Colin > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
<%= semantic_form_for @template do |f| %> <%= f.input :source %> <% end %> where template is an instance of class Template < ActiveRecord::Base # add_column :templates, :source, :text end On Feb 20, 8:19 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 20 February 2011 08:39, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > The app is using formtastic to generate the textarea. I''ve watered it > > down to the barebone code provided in the first post. > > How are you giving formtastic the initial text for the textarea? Can > you show the code you use for that? > > Please don''t top post, it makes it difficult to follow the thread. > Insert your reply into the previous post. Thanks. > > Colin > > > > > > > > > > > If we can unindent the <%= render ''unindent'' %> to align with <html>, > > then we have a winner. So far I fathom that this is not possible. Work > > around would be to apply some js solution on the <textarea> to keep > > the formatting we want. > > > On Feb 19, 8:59 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > >> On 19 February 2011 09:30, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> > <html> > >> > <body> > >> > <textarea>if indent then > >> > __indent > >> > end</textarea> > > >> > __<textarea>if indent then > >> > __indent > >> > end</textarea> > > >> > </body> > >> > </html> > > >> > When viewed in the browser: > > >> > the first <textarea> appears as and will be saved as thus: > > >> > if indent then > >> > __indent > >> > end > > >> > similarly, 2nd <textarea> appears as and will be saved as thus: > > >> > __if indent then > >> > ____indent > >> > __end > > >> OK, that is not the problem you originally asked. From your first > >> message you have > >> <textarea><%= ''this is unindented'' %></textarea> > >> which is not the above situation at all. > > >> Can you show me the erb you are using to generate the problem code you > >> are now showing? > > >> Colin > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 21 February 2011 08:51, khoan <huu.khoa.nguyen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <%= semantic_form_for @template do |f| %> > <%= f.input :source %> > <% end %> > > where template is an instance of > > class Template < ActiveRecord::Base > # add_column :templates, :source, :text > endPlease don''t top post, it makes it difficult to follow the thread. Insert your reply into the previous post. Thanks. And what html does that generate (open it in the browser and use View> Page Source or similar to view the html, then copy the relevantsection and paste it here)? Colin> > On Feb 20, 8:19 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> On 20 February 2011 08:39, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> > The app is using formtastic to generate the textarea. I''ve watered it >> > down to the barebone code provided in the first post. >> >> How are you giving formtastic the initial text for the textarea? Can >> you show the code you use for that? >> >> Please don''t top post, it makes it difficult to follow the thread. >> Insert your reply into the previous post. Thanks. >> >> Colin >> >> >> >> >> >> >> >> >> >> > If we can unindent the <%= render ''unindent'' %> to align with <html>, >> > then we have a winner. So far I fathom that this is not possible. Work >> > around would be to apply some js solution on the <textarea> to keep >> > the formatting we want. >> >> > On Feb 19, 8:59 pm, Colin Law <clan...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 19 February 2011 09:30, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >> > <html> >> >> > <body> >> >> > <textarea>if indent then >> >> > __indent >> >> > end</textarea> >> >> >> > __<textarea>if indent then >> >> > __indent >> >> > end</textarea> >> >> >> > </body> >> >> > </html> >> >> >> > When viewed in the browser: >> >> >> > the first <textarea> appears as and will be saved as thus: >> >> >> > if indent then >> >> > __indent >> >> > end >> >> >> > similarly, 2nd <textarea> appears as and will be saved as thus: >> >> >> > __if indent then >> >> > ____indent >> >> > __end >> >> >> OK, that is not the problem you originally asked. From your first >> >> message you have >> >> <textarea><%= ''this is unindented'' %></textarea> >> >> which is not the above situation at all. >> >> >> Can you show me the erb you are using to generate the problem code you >> >> are now showing? >> >> >> Colin >> >> > -- >> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. >> > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >> > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 17 Feb., 06:19, khoan <huu.khoa.ngu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''d like to unindent a block of ERB specifically to combat the extra > spacing being added to content inside <textarea> by the browser.I''ve solved the problem like this: https://github.com/tpo/irwi/commit/bf60ccf7a078f6a6fe971c245687915326b5cf60 (for context of this specific blossoming of this problem see: https://github.com/alno/irwi/issues/19 ) I admit it''s very ugly, however it works (it''s the same way HAML seems to solve this problem). I''m left wondering how anybody was ever able to use f.text_area in RoR... *t -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.