From 8832dd34385edb904719ce3f7fe4bb5f28e30495 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Sun, 4 Jan 2009 16:40:50 -0600 Subject: [PATCH] Version 0.16.1 Make this version (minimally) usable with Textile Markup: For Webs with "Textile", "RDoc" or "Mixed" markup option selected, send text/html instead of application/xhtml+xml. This makes this software minimally usable with those markup dialects. "Markdown+itex2MML", "Markdown+BlahTeX/PNG" and "Markdown" should work as before, sending application/xhtml+xml to capable browsers. Bump the version number. --- app/controllers/application.rb | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 73a79037..d0dc37f6 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -156,13 +156,17 @@ class ApplicationController < ActionController::Base response.content_type = Mime::ATOM elsif %w(tex).include?(action_name) response.content_type = Mime::TEXT - elsif request.user_agent =~ /Validator/ or request.env.include?('HTTP_ACCEPT') && + elsif xhtml_enabled? + if request.user_agent =~ /Validator/ or request.env.include?('HTTP_ACCEPT') && Mime::Type.parse(request.env["HTTP_ACCEPT"]).include?(Mime::XHTML) - response.content_type = Mime::XHTML - elsif request.user_agent =~ /MathPlayer/ - response.charset = nil - response.content_type = Mime::XHTML - response.extend(MathPlayerHack) + response.content_type = Mime::XHTML + elsif request.user_agent =~ /MathPlayer/ + response.charset = nil + response.content_type = Mime::XHTML + response.extend(MathPlayerHack) + else + response.content_type = Mime::HTML + end else response.content_type = Mime::HTML end @@ -195,6 +199,10 @@ class ApplicationController < ActionController::Base def in_a_web? not @web_name.nil? end + + def xhtml_enabled? + in_a_web? and (@web.markup == :markdownMML or @web.markup == :markdownPNG or @web.markup == :markdown) + end def authorization_needed? not %w( login authenticate feeds published atom_with_headlines atom_with_content).include?(action_name) @@ -233,7 +241,7 @@ module Instiki module VERSION #:nodoc: MAJOR = 0 MINOR = 16 - TINY = 0 + TINY = 1 SUFFIX = '(MML+)' PRERELEASE = 'pre' # false if PRERELEASE