Alexey Verkhovsky wrote:
> Is there any public interface that would allow me to render a template
> several times during the same action, with a different set of assigns?
> Or should I simply bypass the whole framework thing and render the
> contents of this ZIP by hand (which is what I am going to do right
> now, because I''m SO pissed off... :)
Gosh, this is ugly!
def export_html
stylesheet = File.read(File.join(RAILS_ROOT, ''public'',
''stylesheets'', ''instiki.css''))
export_pages_as_zip(''html'') do |page|
renderer = PageRenderer.new(page.revisions.last)
rendered_page = <<-EOL
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>#{page.plain_name} in #{@web.name}</title>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
<style type="text/css">
h1#pageName, .newWikiWord a, a.existingWikiWord,
.newWikiWord a:hover {
color: ##{@web ? @web.color : "393" };
}
.newWikiWord { background-color: white; font-style: italic; }
#{stylesheet}
</style>
<style type="text/css">
#{@web.additional_style}
</style>
</head>
<body>
#{renderer.display_content_for_export}
<div class="byline">
#{page.revisions? ? "Revised" : "Created" } on
#{
page.revised_at.strftime(''%B %d, %Y %H:%M:%S'') }
by
#{ UrlGenerator.new(self).make_link(page.author.name, @web,
nil, { :mode => :export }) }
</div>
</body>
</html>
EOL
rendered_page
end
end