<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: converting all newline characters to br tag</title>
	<atom:link href="http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/</link>
	<description>Exploring Ruby On Rails</description>
	<lastBuildDate>Wed, 19 Aug 2009 09:10:09 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: ian</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5139</link>
		<dc:creator>ian</dc:creator>
		<pubDate>Mon, 02 Jun 2008 12:51:28 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5139</guid>
		<description>if you are using rails you can use the simple_format function in your views.

here&#039;s the source code from the api (http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057)


def simple_format(text)
        content_tag &#039;p&#039;, text.to_s.
        gsub(/\r\n?/, &quot;\n&quot;).                  
        gsub(/\n\n+/, &quot;\n\n&quot;).      
        gsub(/([^\n]\n)(?=[^\n])/, &#039;\1&#039;)  
end</description>
		<content:encoded><![CDATA[<p>if you are using rails you can use the simple_format function in your views.</p>
<p>here&#8217;s the source code from the api (<a href="http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057" rel="nofollow">http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001057</a>)</p>
<p>def simple_format(text)<br />
        content_tag &#8216;p&#8217;, text.to_s.<br />
        gsub(/\r\n?/, &#8220;\n&#8221;).<br />
        gsub(/\n\n+/, &#8220;\n\n&#8221;).<br />
        gsub(/([^\n]\n)(?=[^\n])/, &#8216;\1&#8242;)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alen</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5131</link>
		<dc:creator>Alen</dc:creator>
		<pubDate>Sat, 05 Apr 2008 12:35:18 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5131</guid>
		<description>Don&#039;t understand why Ruby as a multi-purpose language directly should have such function/method. 

If you using Rails web framework, there is a simple_format() method of ActionView::Helpers::TextHelper module that does exactly that and more.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t understand why Ruby as a multi-purpose language directly should have such function/method. </p>
<p>If you using Rails web framework, there is a simple_format() method of ActionView::Helpers::TextHelper module that does exactly that and more.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akhil Bansal</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5062</link>
		<dc:creator>Akhil Bansal</dc:creator>
		<pubDate>Tue, 15 Jan 2008 11:27:02 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5062</guid>
		<description>I don&#039;t use windows so I don&#039;t have that idea</description>
		<content:encoded><![CDATA[<p>I don&#8217;t use windows so I don&#8217;t have that idea</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wiras Adi</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5061</link>
		<dc:creator>Wiras Adi</dc:creator>
		<pubDate>Tue, 15 Jan 2008 11:19:11 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5061</guid>
		<description>Sorry, forgot to escape the br tag.

def nl2br(s)
s.gsub(/(\r)?\n/, &quot;&lt;br /&gt;&quot;)
end</description>
		<content:encoded><![CDATA[<p>Sorry, forgot to escape the br tag.</p>
<p>def nl2br(s)<br />
s.gsub(/(\r)?\n/, &#8220;&lt;br /&gt;&#8221;)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wiras Adi</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5060</link>
		<dc:creator>Wiras Adi</dc:creator>
		<pubDate>Tue, 15 Jan 2008 11:17:32 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5060</guid>
		<description>Don&#039;t you think that it should be something like this:

def nl2br(s)
    s.gsub(/(\r)?\n/, &quot;&quot;)
end

Windows has different way of breaking a line, that code will check also for the carriage return Windows used.</description>
		<content:encoded><![CDATA[<p>Don&#8217;t you think that it should be something like this:</p>
<p>def nl2br(s)<br />
    s.gsub(/(\r)?\n/, &#8220;&#8221;)<br />
end</p>
<p>Windows has different way of breaking a line, that code will check also for the carriage return Windows used.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Idetrorce</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-4738</link>
		<dc:creator>Idetrorce</dc:creator>
		<pubDate>Sat, 15 Dec 2007 12:18:33 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-4738</guid>
		<description>very interesting, but I don&#039;t agree with you 
Idetrorce</description>
		<content:encoded><![CDATA[<p>very interesting, but I don&#8217;t agree with you<br />
Idetrorce</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AllForYou123</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-3777</link>
		<dc:creator>AllForYou123</dc:creator>
		<pubDate>Thu, 30 Aug 2007 04:39:11 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-3777</guid>
		<description>Helo, it is very interesting site. If You want you can visit mine. &lt;a href=&quot;http://gena-lee-nolin.usgol.info/ &quot; rel=&quot;nofollow&quot;&gt; chain hang jibbs low lyric&lt;/a&gt; I have make it myself. There you can find all about  chain hang jibbs low lyric etc...</description>
		<content:encoded><![CDATA[<p>Helo, it is very interesting site. If You want you can visit mine. <a href="http://gena-lee-nolin.usgol.info/ " rel="nofollow"> chain hang jibbs low lyric</a> I have make it myself. There you can find all about  chain hang jibbs low lyric etc&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kalle</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-3611</link>
		<dc:creator>Kalle</dc:creator>
		<pubDate>Mon, 20 Aug 2007 20:34:52 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-3611</guid>
		<description>Actually... s.gsub(/\n/, &#039;&#039;) vorked like a charm! Thanks man. ;o)</description>
		<content:encoded><![CDATA[<p>Actually&#8230; s.gsub(/\n/, &#8221;) vorked like a charm! Thanks man. ;o)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcio Lima</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-3474</link>
		<dc:creator>Marcio Lima</dc:creator>
		<pubDate>Sun, 12 Aug 2007 05:26:03 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-3474</guid>
		<description>i`m using

param.gsub(/\n/, &#039;&#039;)

work nice</description>
		<content:encoded><![CDATA[<p>i`m using</p>
<p>param.gsub(/\n/, &#8221;)</p>
<p>work nice</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iain</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-1661</link>
		<dc:creator>Iain</dc:creator>
		<pubDate>Sun, 04 Mar 2007 19:23:20 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-1661</guid>
		<description>s.gsub didnt work for me alone, but 

var = s.gsub(/\n/, &#039;&#039;) 

did work. Just in case anyone else has the same problem</description>
		<content:encoded><![CDATA[<p>s.gsub didnt work for me alone, but </p>
<p>var = s.gsub(/\n/, &#8221;) </p>
<p>did work. Just in case anyone else has the same problem</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Akhil Bansal</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-9</link>
		<dc:creator>Akhil Bansal</dc:creator>
		<pubDate>Fri, 18 Aug 2006 12:30:48 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-9</guid>
		<description>This will remove all new line characters not replace them by &lt;br&gt; :-)

</description>
		<content:encoded><![CDATA[<p>This will remove all new line characters not replace them by &lt;br&gt; :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pratik</title>
		<link>http://webonrails.wordpress.com/2006/08/07/converting-all-newline-characters-to/#comment-5</link>
		<dc:creator>Pratik</dc:creator>
		<pubDate>Tue, 08 Aug 2006 14:42:52 +0000</pubDate>
		<guid isPermaLink="false">https://webonrails.wordpress.com/2006/08/08/converting-all-newline-characters-to/#comment-5</guid>
		<description>def nl2br(s)
     s.gsub(/\n/, &#039;&#039;)
 end

This would be more appropriate :)</description>
		<content:encoded><![CDATA[<p>def nl2br(s)<br />
     s.gsub(/\n/, &#8221;)<br />
 end</p>
<p>This would be more appropriate :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
