Fixed: Deselecting textile text formatting causes interning empty string errors (#4867).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3446 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
74e85953f0
commit
0fcc436f22
|
@ -25,17 +25,17 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
def register(name, formatter, helper)
|
def register(name, formatter, helper)
|
||||||
raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_sym]
|
raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_s]
|
||||||
@@formatters[name.to_sym] = {:formatter => formatter, :helper => helper}
|
@@formatters[name.to_s] = {:formatter => formatter, :helper => helper}
|
||||||
end
|
end
|
||||||
|
|
||||||
def formatter_for(name)
|
def formatter_for(name)
|
||||||
entry = @@formatters[name.to_sym]
|
entry = @@formatters[name.to_s]
|
||||||
(entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
|
(entry && entry[:formatter]) || Redmine::WikiFormatting::NullFormatter::Formatter
|
||||||
end
|
end
|
||||||
|
|
||||||
def helper_for(name)
|
def helper_for(name)
|
||||||
entry = @@formatters[name.to_sym]
|
entry = @@formatters[name.to_s]
|
||||||
(entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
|
(entry && entry[:helper]) || Redmine::WikiFormatting::NullFormatter::Helper
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,16 @@ require File.dirname(__FILE__) + '/../../../test_helper'
|
||||||
|
|
||||||
class Redmine::WikiFormattingTest < ActiveSupport::TestCase
|
class Redmine::WikiFormattingTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
|
def test_textile_formatter
|
||||||
|
assert_equal Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting.formatter_for('textile')
|
||||||
|
assert_equal Redmine::WikiFormatting::Textile::Helper, Redmine::WikiFormatting.helper_for('textile')
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_null_formatter
|
||||||
|
assert_equal Redmine::WikiFormatting::NullFormatter::Formatter, Redmine::WikiFormatting.formatter_for('')
|
||||||
|
assert_equal Redmine::WikiFormatting::NullFormatter::Helper, Redmine::WikiFormatting.helper_for('')
|
||||||
|
end
|
||||||
|
|
||||||
def test_should_link_urls_and_email_addresses
|
def test_should_link_urls_and_email_addresses
|
||||||
raw = <<-DIFF
|
raw = <<-DIFF
|
||||||
This is a sample *text* with a link: http://www.redmine.org
|
This is a sample *text* with a link: http://www.redmine.org
|
||||||
|
|
Loading…
Reference in New Issue