set tabstop=4
set shiftwidth=4
set nu
set ai
syntax on
filetype plugin indent on
I tried this, content.gsub("\r\n","<br/>")
but when I click the view/show button to see the contents of these line, I get the output/result=>
set tabstop=4<br/> set shiftwidth=4<br/> set nu<br/> set ai<br/> syntax on<br/> filetype plugin indent on
But I tried to get those lines as a seperate lines. But all become as a single line. Why?
How can I make all those lines with a html break (<br/>
) ?
I tried this, that didn't work.
@addpost = Post.new params[:data]
@temptest = @addpost.content.html_safe
@addpost.content = @temptest
#logger.debug(@addpost)
@addpost.save
Also tried without saving into database. Tried only in view layer,<%= t.content.html_safe %>
That didn't work too.
Got this from page source
<a href="/posts/36">vimrc file</a> <br/>
2011-12-06<br/><br/>
set tabstop=4<br/><br/>set shiftwidth=4<br/><br/>set nu<br/><br/>set ai<br/><br/>syntax on<br/><br/>filetype plugin indent on<br/>
<a href="/posts/36/edit">Edit</a>
<a href="/posts/36" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Delete</a>
<br/><br/>
` is the way to write it as of html5. You can still write `
` for xhtml compatibility, but it is not recommended. In fact, stick with `
` ;-) – Dominic Goulet Dec 06 '11 at 19:07
, it looks the angle bracket are being translated – cola Dec 06 '11 at 19:50