From: Ross Bamford Date: 2006-02-03T18:43:16+09:00 Subject: Re: Displaying source code of an rhtml file On Fri, 2006-02-03 at 18:13 +0900, Paul Johnston wrote: > Hi > I'm creating some embedded ruby web pages under Linux and Apache 2.0 > and after showing what it can do I like to display the source code. > I was wondering if there is an easier way to do this than what I am > doing at present. An example is where I wish to show the line > containing Do you mean like this? Just code

Here is the code

<%= ERB::Util.html_escape(File.read(__FILE__)) %>
	    
Alternatively, if you mean showing it in blocks you'll have to escape it anyway, or the browsers will eat it, won't they? So just pass them through html_escape. Alternatively, check out Rote (http://rote.rubyforge.org) for some ERB-based ruby-code-macro supporting syntax highlighting fun, where you can just do: #:code#ruby class SomeClass < Other def etc(&blk) #... end end #:code# -- Ross Bamford - rosco@roscopeco.REMOVE.co.uk