diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/lib/rdoc/template.rb | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/lib/rdoc/template.rb')
-rw-r--r-- | trunk/lib/rdoc/template.rb | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/trunk/lib/rdoc/template.rb b/trunk/lib/rdoc/template.rb deleted file mode 100644 index 53d0e3ce68..0000000000 --- a/trunk/lib/rdoc/template.rb +++ /dev/null @@ -1,64 +0,0 @@ -require 'erb' - -module RDoc; end - -## -# An ERb wrapper that allows nesting of one ERb template inside another. -# -# This TemplatePage operates similarly to RDoc 1.x's TemplatePage, but uses -# ERb instead of a custom template language. -# -# Converting from a RDoc 1.x template to an RDoc 2.x template is fairly easy. -# -# * %blah% becomes <%= values["blah"] %> -# * !INCLUDE! becomes <%= template_include %> -# * HREF:aref:name becomes <%= href values["aref"], values["name"] %> -# * IF:blah becomes <% if values["blah"] then %> -# * IFNOT:blah becomes <% unless values["blah"] then %> -# * ENDIF:blah becomes <% end %> -# * START:blah becomes <% values["blah"].each do |blah| %> -# * END:blah becomes <% end %> -# -# To make nested loops easier to convert, start by converting START statements -# to: -# -# <% values["blah"].each do |blah| $stderr.puts blah.keys %> -# -# So you can see what is being used inside which loop. - -class RDoc::TemplatePage - - ## - # Create a new TemplatePage that will use +templates+. - - def initialize(*templates) - @templates = templates - end - - ## - # Returns "<a href=\"#{ref}\">#{name}</a>" - - def href(ref, name) - if ref then - "<a href=\"#{ref}\">#{name}</a>" - else - name - end - end - - ## - # Process the template using +values+, writing the result to +io+. - - def write_html_on(io, values) - b = binding - template_include = "" - - @templates.reverse_each do |template| - template_include = ERB.new(template).result b - end - - io.write template_include - end - -end - |