This page contains automated test results for code from O'Reilly's Ruby Cookbook. If this code looks interesting or useful, you might want to buy the whole book.

Transforming Plain Text into HTML
CodeExpectedActual
require 'rubygems'
require 'redcloth'
text = RedCloth.new %{Who would ever write "HTML":http://www.w3.org/MarkUp/ 
markup directly?
I mean, _who has the time_? Nobody, that's who:
|_. Person |_. Has the time?        |
|   Jake   |     No                 |
|  Alice   |     No                 |
|  Rodney  | Not since the accident |
}
puts text.to_html
<p>Who would ever write
<a href="http://www.w3.org/MarkUp/"><span class="caps">HTML</span></a>
markup directly?</p>

<p>I mean, <em>who has the time</em>? Nobody, that&#8217;s who:</p>

<table>
<tr>
<th>Person </th>
<th>Has the time?        </th>
</tr>
...
Who would ever write <a href="http://www.w3.org/MarkUp/"><span class="caps">HTML</span></a> 
markup directly?
I mean, <em>who has the time</em>? Nobody, that&#8217;s who:
	<table>
		<tr>
			<th>Person </th>
			<th>Has the time?        </th>
		</tr>
		<tr>
			<td>   Jake   </td>
			<td>     No                 </td>
		</tr>
		<tr>
			<td>  Alice   </td>
			<td>     No                 </td>
		</tr>
		<tr>
			<td>  Rodney  </td>
			<td> Not since the accident </td>
		</tr>
	</table>