Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
c391c0eeee
|
@ -19,13 +19,22 @@ class ApplicationController < ActionController::Base
|
|||
Wiki.new
|
||||
end
|
||||
|
||||
helper_method :xhtml_enabled?, :html_ext
|
||||
|
||||
protected
|
||||
|
||||
def xhtml_enabled?
|
||||
in_a_web? and [:markdownMML, :markdownPNG, :markdown].include?(@web.markup)
|
||||
end
|
||||
|
||||
helper_method :xhtml_enabled?
|
||||
def html_ext
|
||||
if xhtml_enabled? && request.env.include?('HTTP_ACCEPT') &&
|
||||
Mime::Type.parse(request.env["HTTP_ACCEPT"]).include?(Mime::XHTML)
|
||||
'xhtml'
|
||||
else
|
||||
'html'
|
||||
end
|
||||
end
|
||||
|
||||
def check_authorization
|
||||
if in_a_web? and authorization_needed? and not authorized?
|
||||
|
|
|
@ -380,15 +380,6 @@ class WikiController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def html_ext
|
||||
if xhtml_enabled? && request.env.include?('HTTP_ACCEPT') &&
|
||||
Mime::Type.parse(request.env["HTTP_ACCEPT"]).include?(Mime::XHTML)
|
||||
'xhtml'
|
||||
else
|
||||
'html'
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def do_caching?
|
||||
|
|
|
@ -64,7 +64,7 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
case mode
|
||||
when :export
|
||||
if known_file
|
||||
%{<a class="existingWikiWord" title="#{description}" href="#{CGI.escape(name)}.#{@controller.html_ext}">#{text}</a>}
|
||||
%{<a class="existingWikiWord" title="#{description}" href="#{CGI.escape(name)}.#{html_ext}">#{text}</a>}
|
||||
else
|
||||
%{<span class="newWikiWord">#{text}</span>}
|
||||
end
|
||||
|
@ -92,7 +92,7 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
case mode
|
||||
when :export
|
||||
if known_page
|
||||
%{<a class="existingWikiWord" href="#{CGI.escape(name)}.#{@controller.html_ext}">#{text}</a>}
|
||||
%{<a class="existingWikiWord" href="#{CGI.escape(name)}.#{html_ext}">#{text}</a>}
|
||||
else
|
||||
%{<span class="newWikiWord">#{text}</span>}
|
||||
end
|
||||
|
@ -182,4 +182,10 @@ class UrlGenerator < AbstractUrlGenerator
|
|||
:id => name, :only_path => true
|
||||
%{<a class="existingWikiWord" href="#{href}">#{text}</a>}
|
||||
end
|
||||
|
||||
def html_ext
|
||||
@html_ext ||= @controller.method(:html_ext).call
|
||||
# Why method().call ? A Ruby 1.9.2preview1 bug:
|
||||
# http://redmine.ruby-lang.org/issues/show/1802
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue