I'm trying to use Textile and ERB together for a website I'm
developing.  Basically, a sample file looks like:

---

<%= produce_some_output "param" %>

Here's some *Textile* text.


---

I want the ERB code to be evaluated and I also want the Textile markup
translated into HTML.  How can I do this?  Right now I'm doing:

s = File.read "myfile.rhtml"
result = RedCloth.new(ERB.new(s).result).to_html

The problem is that the produce_some_output function prints out the
opening <html>, <body>, and <head> tags.  RedCloth surrounds this with
<p> tags and thus prevents the page from rendering properly.  I tried
running ERB after RedCloth, but RedCloth converted the quotes in the
ERB code to HTML entities.

How can I make this work?

Bill Atkins