From eeef7952c3be377fef09a4fde6c6e08582f09ee9 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Thu, 1 Feb 2007 17:22:15 -0600 Subject: [PATCH] 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. --- app/controllers/application.rb | 7 ++++--- app/views/wiki/web_list.rhtml | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index fb38e930..08973a1d 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -148,7 +148,7 @@ class ApplicationController < ActionController::Base @response.headers['Content-Type'] = 'text/xml; charset=UTF-8' elsif %w(tex).include?(action_name) @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' else @response.headers['Content-Type'] = 'text/html; charset=UTF-8' @@ -198,10 +198,11 @@ module Mime # Fix HTML #HTML = Type.new "text/html", :html, %w( application/xhtml+xml ) HTML = Type.new "text/html", :html - + # Add 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 end diff --git a/app/views/wiki/web_list.rhtml b/app/views/wiki/web_list.rhtml index 4f9608b0..73b2eec4 100644 --- a/app/views/wiki/web_list.rhtml +++ b/app/views/wiki/web_list.rhtml @@ -1,11 +1,11 @@ <% @title = "Wiki webs" %> -
+