Drop deprecated Redcarpet based Markdown formatter (#40149).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23153 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2024-10-20 07:51:38 +00:00
parent d58c2a21ea
commit 5407fea873
50 changed files with 24 additions and 7626 deletions

View File

@@ -263,16 +263,16 @@ class ApplicationHelperTest < Redmine::HelperTest
end
def test_attached_images_with_markdown_and_non_ascii_filename
skip unless Object.const_defined?(:Redcarpet)
skip unless Object.const_defined?(:CommonMarker)
to_test = {
'CAFÉ.JPG' => 'CAF%C3%89.JPG',
'crème.jpg' => 'cr%C3%A8me.jpg',
}
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
to_test.each do |filename, result|
attachment = Attachment.generate!(:filename => filename)
assert_include %(<img src="/attachments/download/#{attachment.id}/#{result}" alt="" loading="lazy" />),
assert_include %(<img src="/attachments/download/#{attachment.id}/#{result}" alt="" loading="lazy">),
textilizable("![](#{filename})", :attachments => [attachment])
end
end
@@ -643,9 +643,9 @@ class ApplicationHelperTest < Redmine::HelperTest
end
def test_user_links_with_email_as_login_name_should_not_be_parsed_markdown
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
u = User.generate!(:login => 'jsmith@somenet.foo')
html = '<a href=\"mailto:jsmith@somenet.foo\">jsmith@somenet.foo</a>'
html = '<a href=\"mailto:jsmith@somenet.foo\" class=\"email\">jsmith@somenet.foo</a>'
# user link format: @jsmith@somenet.foo
raw = "@jsmith@somenet.foo should not be parsed in jsmith@somenet.foo"
@@ -1010,7 +1010,7 @@ class ApplicationHelperTest < Redmine::HelperTest
%r{<p><a class="attachment" href="/attachments/#{attachment.id}">image@2x.png</a> should not be parsed in image@2x.png</p>},
textilizable(raw, :attachments => [attachment]))
end
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
raw = "attachment:image@2x.png should not be parsed in image@2x.png"
assert_match(
%r{<p><a class="attachment" href="/attachments/#{attachment.id}">image@2x.png</a> should not be parsed in image@2x.png</p>},
@@ -1133,7 +1133,7 @@ class ApplicationHelperTest < Redmine::HelperTest
to_test = wiki_links_with_special_characters
@project = Project.find(1)
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
to_test.each {|text, result| assert_equal "<p>#{result}</p>", textilizable(text).strip}
end
end
@@ -1175,7 +1175,7 @@ class ApplicationHelperTest < Redmine::HelperTest
with_settings :text_formatting => 'textile' do
to_test.each {|text, result| assert_equal "<p>#{result}</p>", textilizable(text)}
end
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
to_test.each {|text, result| assert_equal "<p>#{result}</p>", textilizable(text).strip}
end
end
@@ -1669,9 +1669,9 @@ class ApplicationHelperTest < Redmine::HelperTest
end
end
if Object.const_defined?(:Redcarpet)
if Object.const_defined?(:CommonMarker)
def test_toc_with_markdown_formatting_should_be_parsed
with_settings :text_formatting => 'markdown' do
with_settings :text_formatting => 'common_mark' do
assert_select_in textilizable("{{toc}}\n\n# Heading"), 'ul.toc li', :text => 'Heading'
assert_select_in textilizable("{{<toc}}\n\n# Heading"), 'ul.toc.left li', :text => 'Heading'
assert_select_in textilizable("{{>toc}}\n\n# Heading"), 'ul.toc.right li', :text => 'Heading'
@@ -2321,20 +2321,6 @@ class ApplicationHelperTest < Redmine::HelperTest
end
end
# TODO: Remove this test when Redcarpet-based Markdown formatter is removed
def test_markdown_formatter
[
['markdown', 'markdown'],
['common_mark', 'common_mark'],
['textile', 'common_mark'],
['', 'common_mark']
].each do |text_formatting, expected|
with_settings text_formatting: text_formatting do
assert_equal expected, markdown_formatter
end
end
end
def test_export_csv_separator_select_tag
with_locale 'en' do
result = export_csv_separator_select_tag