Bring up to current.

This commit is contained in:
Jacques Distler 2007-01-22 08:36:51 -06:00
parent 69b62b6f33
commit b19e1e4f47
71 changed files with 8305 additions and 39 deletions

View file

@ -48,6 +48,7 @@ class ApplicationController < ActionController::Base
'.pdf' => 'application/pdf',
'.png' => 'image/png',
'.txt' => 'text/plain',
'.tex' => 'text/plain',
'.zip' => 'application/zip'
} unless defined? FILE_TYPES
@ -114,7 +115,7 @@ class ApplicationController < ActionController::Base
def rescue_action_in_public(exception)
render :status => 500, :text => <<-EOL
<html><body>
<html xmlns="http://www.w3.org/1999/xhtml"><body>
<h2>Internal Error</h2>
<p>An application error occurred while processing your request.</p>
<!-- \n#{exception}\n#{exception.backtrace.join("\n")}\n -->
@ -145,8 +146,10 @@ class ApplicationController < ActionController::Base
def set_content_type_header
if %w(rss_with_content rss_with_headlines).include?(action_name)
@response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
elsif %w(tex).include?(action_name)
@response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
else
@response.headers['Content-Type'] = 'text/html; charset=UTF-8'
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
end
end

View file

@ -9,7 +9,7 @@ class WikiController < ApplicationController
caches_action :show, :published, :authors, :recently_revised, :list
cache_sweeper :revision_sweeper
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :export_tex, :export_html]
layout 'default', :except => [:rss_feed, :rss_with_content, :rss_with_headlines, :tex, :pdf, :export_tex, :export_html]
def index
if @web_name
@ -280,8 +280,12 @@ class WikiController < ApplicationController
end
def tex
if @web.markup == :markdownMML
@tex_content = Maruku.new(@page.content).to_latex
else
@tex_content = RedClothForTex.new(@page.content).to_tex
end
end
protected
@ -305,8 +309,12 @@ class WikiController < ApplicationController
end
def export_page_to_tex(file_path)
tex
File.open(file_path, 'w') { |f| f.write(render_to_string(:template => 'wiki/tex', :layout => false)) }
if @web.markup == :markdownMML
@tex_content = Maruku.new(@page.content).to_latex
else
@tex_content = RedClothForTex.new(@page.content).to_tex
end
File.open(file_path, 'w') { |f| f.write(render_to_string(:template => 'wiki/tex', :layout => 'tex')) }
end
def export_pages_as_zip(file_type, &block)
@ -396,7 +404,11 @@ class WikiController < ApplicationController
def render_tex_web
@web.select.by_name.inject({}) do |tex_web, page|
if @web.markup == :markdownMML
tex_web[page.name] = Maruku.new(page.content).to_latex
else
tex_web[page.name] = RedClothForTex.new(page.content).to_tex
end
tex_web
end
end