Safari's DOM support in XHTML is horribly broken. Send it S5 slideshows as text/html. (Sorry: no inline SVG for you!)

Turn on Maruku's Math support in S5 slideshows, only if corresponding Web is Math-enabled.
This commit is contained in:
Jacques Distler 2007-03-30 12:25:59 -05:00
parent 0db06a9fa3
commit 19889c98d4
3 changed files with 13 additions and 5 deletions

View file

@ -149,7 +149,9 @@ 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 @request.env['HTTP_USER_AGENT'] =~ /MathPlayer|Validator/ or @request.env.include?('HTTP_ACCEPT') && Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML)
elsif @request.env['HTTP_USER_AGENT'] =~ /MathPlayer|Validator/ or @request.env.include?('HTTP_ACCEPT') &&
Mime::Type.parse(@request.env["HTTP_ACCEPT"]).include?(Mime::XHTML) &&
!(@request.env['HTTP_USER_AGENT'] =~ /Safari/ and %w(s5).include?(action_name))
@response.headers['Content-Type'] = 'application/xhtml+xml; charset=UTF-8'
else
@response.headers['Content-Type'] = 'text/html; charset=UTF-8'

View file

@ -293,10 +293,16 @@ class WikiController < ApplicationController
end
def s5
if @web.markup == :markdownMML or @web.markup == :markdown
@s5_content = sanitize_html(Maruku.new(@page.content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F").to_ncr,
if @web.markup == :markdownMML
@s5_content = sanitize_html(Maruku.new(@page.content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
{:math_enabled => true, :math_numbered => ['\\[','\\begin{equation}'], :content_only => true,
:author => @page.author, :title => @page.plain_name}).to_s5)
:author => @page.author, :title => @page.plain_name}).to_s5).to_ncr
elsif @web.markup == :markdown
@s5_content = sanitize_html(Maruku.new(@page.content.delete("\r\x01-\x08\x0B\x0C\x0E-\x1F"),
{:math_enabled => false, :content_only => true,
:author => @page.author, :title => @page.plain_name}).to_s5).to_ncr
else
@s5_content = "S5 not supported with this text filter"
end
end

View file

@ -42,7 +42,7 @@ module MaRuKu
dummy_layout_slide =
"
<div class='layout'>
<div id='controls'></div>
<div id='controls'> </div>
<div id='currentSlide'> </div>
<div id='header'> #{slide_header}</div>
<div id='footer'>