Fixed the Content-negotiation for sending XHTML.

Fixed a non-well-formed page.
Maruku's metadata processing seems to be busted. May have to revert.
This commit is contained in:
Jacques Distler 2007-02-01 17:22:15 -06:00
parent 9cf0b504f1
commit eeef7952c3
2 changed files with 8 additions and 7 deletions

View file

@ -148,7 +148,7 @@ class ApplicationController < ActionController::Base
@response.headers['Content-Type'] = 'text/xml; charset=UTF-8' @response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
elsif %w(tex).include?(action_name) elsif %w(tex).include?(action_name)
@response.headers['Content-Type'] = 'text/plain; charset=UTF-8' @response.headers['Content-Type'] = 'text/plain; charset=UTF-8'
elsif Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML) or @request.env["USER_AGENT"] =~ /MathPlayer/ elsif @request.env['HTTP_USER_AGENT'] =~ /MathPlayer|Validator/ or Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML)
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8' @response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
else else
@response.headers['Content-Type'] = 'text/html; charset=UTF-8' @response.headers['Content-Type'] = 'text/html; charset=UTF-8'
@ -198,10 +198,11 @@ module Mime
# Fix HTML # Fix HTML
#HTML = Type.new "text/html", :html, %w( application/xhtml+xml ) #HTML = Type.new "text/html", :html, %w( application/xhtml+xml )
HTML = Type.new "text/html", :html HTML = Type.new "text/html", :html
# Add XHTML # Add XHTML
XHTML = Type.new "application/xhtml+xml", :xhtml XHTML = Type.new "application/xhtml+xml", :xhtml
# Fix xhtml lookup # Fix xhtml and html lookups
LOOKUP["text/html"] = HTML
LOOKUP["application/xhtml+xml"] = XHTML LOOKUP["application/xhtml+xml"] = XHTML
end end

View file

@ -1,11 +1,11 @@
<% @title = "Wiki webs" %> <% @title = "Wiki webs" %>
<br/>
<ul>
<% @webs.each do |web| %> <% @webs.each do |web| %>
<li>
<% if web.password %> <div class="web_protected"> <% if web.password %> <div class="web_protected">
<% else %> <div class="web_normal"> <% end %> <% else %> <div class="web_normal"> <% end %>
<span>
<%= link_to_page 'HomePage', web, web.name, :mode => 'show' %> <%= link_to_page 'HomePage', web, web.name, :mode => 'show' %>
<% if web.published? %> <% if web.published? %>
(<%= link_to_page 'HomePage', web, 'published version', :mode => 'publish' %>) (<%= link_to_page 'HomePage', web, 'published version', :mode => 'publish' %>)
@ -19,7 +19,7 @@
<%= web.last_page.revisions? ? "Revised" : "Created" %> by <%= author_link(web.last_page) %> (<%= web.last_page.current_revision.ip %>) <%= web.last_page.revisions? ? "Revised" : "Created" %> by <%= author_link(web.last_page) %> (<%= web.last_page.current_revision.ip %>)
<% end %> <% end %>
</div> </div>
</span> </div>
</div><br> </li>
<% end %> <% end %>
</ul> </ul>