RDoc's TemplatePage removed from Ruby

Eric Hodel | Mon, 07 Jan 2008 10:59:54 GMT

Posted in ,

If you’ve got a custom RDoc template, it won’t work with the next release of 1.9. I’ve removed the custom TemplatePage and replaced it with an ERB-based version that works similarly.

This should make it much, much easier to write a custom RDoc template as you can now use arbitrary ruby code inside your templates.

It’s really easy to convert an old RDoc template to the upcoming version:

Replace thisWith this
%blah%<%= values["blah"] %>
!INCLUDE!<%= template_include %>
HREF:aref:name<%= href values["aref"], values["name"] %>
IF:blah<% if values["blah"] then %>
IFNOT:blah<% unless values["blah"] then %>
ENDIF:blah<% end %>
START:blah<% values["blah"].each do |blah| %>
END:blah<% end %>

To make nested loops easier to convert, convert START statements to:

<% values["blah"].each do |blah| $stderr.puts blah.keys %>

So you can see what is being used inside which loop.

I’ve also removed the old_html template, as I don’t think anybody uses it anymore, and updated all the existing templates in RDoc to use ERB. (If somebody could double-check my work on the CHM and XML outputters, that would be great.)

11 comments

Comments RSS FEED

Bravo!

Bil Kleb said 9 minutes later

This is a good change.

bryanl said about 6 hours later

So sensible. I appreciate you putting in the work to make things easier for other people.

Joe Grossberg said about 14 hours later

+1, bro.

shaners said about 20 hours later

When you say “next release of 1.9” is that Ruby 1.9? Is it possible to use your erb-based RDoc in Runy 1.8? Thanks.

Tom said 4 days later

s/Runy/Ruby/

Tom said 4 days later

I’ll probably be making a release of RDoc as a gem to help flush out bugs in RDoc and to explore further RubyGems/Ruby integration.

Eric Hodel said 5 days later

Thanks, Eric!

Bruce Williams said 6 days later

Please do release the new rdoc as a gem.

Until then, how can I get the code and use your changes? Does the new rdoc run under 1.8 too?

sb said 7 days later

sb: You can see RDoc in action in ruby’s trunk. It should be 1.8 compatible, but the work won’t be backported for distribution with 1.8.

Eric Hodel said 8 days later

Awesome. Nice to see rDoc is still improving. Thanks.

Rob O said 20 days later

Comments are disabled