From: Tobias Reif
Date: 2002-05-07T20:44:57+09:00
Subject: Re: tags for embedded ruby
Dan Allen wrote:
> After reading endless xml books and watching all of these languages
> like perl, python and ruby go the way of PHP and make embedding code
> within html possible, I don't understand why the standards for xml
> processing instructions are not followed.
You mean in eruby? Months ago, I mailed em, asking for XHTML, but they
replied no, IIRC.
Anyways, for small homecooked stuff, you can use what you want:
from
http://www.pinkjuice.com/howto/RubySVG/examples.xhtml
:
http://www.rubynewbies.com/~tobi/show_source.rb?file=h_time.rb&format=.xhtml
(you may want to change the regex to /.../m), as in the fragment below
Tobi
doc = <
get MIMEtype
The content-type sent for' ruby?>
' ruby?>
which is the correct MIME type for SVG.'
else
'
(if the content is SVG, the MIME type (content-type header)
should be
image/svg+xml
)
'
end
ruby?>
see www.pinkjuice.com/SVG/mime.xhtml

DELIMITER
resolved_doc = doc.gsub /<\?ruby\s+(.*?)\s+ruby\?>/m do
eval $1
end
print "content-type: text/html\n\n"
print resolved_doc
--
http://www.pinkjuice.com/