I may have beed deaf and blind, but Dave really should, while standing on
the soapbox for RDoc, also mention simple_markup explicitly. It is a very
nice tool, especially with eruby. Maybe not so much for regular CGI-work,
but for offline generation of simple pages it's perfect!

I especially like the fact that it does not add any <html>, <head>, or
<body> stuff to the html it generates. This make the inclusion of bits
generated by it to html nice and easy.

I recently discovered it and, and did something like this (it's a bit ugly
'cos I was in a hurry so I snipped the guts):

require 'markup/simple_markup'
require 'markup/simple_markup/to_html'

class Rhtml

  @@parser = SM::SimpleMarkup.new
  @@handler = SM::ToHtml.new

  def self.doctype
  end

  def self.head (title, css)
  end

  def self.page (body, title, css)
  end

  def self.simple_page (file, title, css)
    body = self.parse_simple (file)
    self.page ("<body>#{body}</body>", title, css)
  end

  def self.parse_simple( file )
   txt = File.open(file) { |f| f.read }
   @@parser.convert(txt, @@handler)
  end

  def self.parse_rhtml( file )
    `eruby #{file}`
  end

end

So the I could do:

<% require 'rhtml' %>
...html...
<%=Rhtml.parse_simple("foo.txt")%>
...html...

or

<% require 'rhtml'; Rhtml.simple_page("foo.txt", "Foo", "foo.css") %>


  -- Nikodemus