mirror of
https://github.com/redmine/redmine.git
synced 2025-10-29 01:06:20 +01:00
Updates commonmark gem version to 1.1.5 which switches from libcmark-gfm to comrak/Rust (#40197).
git-svn-id: https://svn.redmine.org/redmine/trunk@23247 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -46,7 +46,7 @@ end
|
|||||||
|
|
||||||
# Optional CommonMark support, not for JRuby
|
# Optional CommonMark support, not for JRuby
|
||||||
group :common_mark do
|
group :common_mark do
|
||||||
gem "commonmarker", '~> 0.23.8'
|
gem "commonmarker", '~> 1.1.0'
|
||||||
gem 'deckar01-task_list', '2.3.2'
|
gem 'deckar01-task_list', '2.3.2'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ rescue LoadError
|
|||||||
# MiniMagick is not available
|
# MiniMagick is not available
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
require 'commonmarker' unless Object.const_defined?(:CommonMarker)
|
require 'commonmarker' unless Object.const_defined?(:Commonmarker)
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
# CommonMarker is not available
|
# CommonMarker is not available
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,29 +26,26 @@ module Redmine
|
|||||||
# configuration of the rendering pipeline
|
# configuration of the rendering pipeline
|
||||||
PIPELINE_CONFIG = {
|
PIPELINE_CONFIG = {
|
||||||
# https://github.com/gjtorikian/commonmarker#extension-options
|
# https://github.com/gjtorikian/commonmarker#extension-options
|
||||||
commonmarker_extensions: [
|
commonmarker_extensions: {
|
||||||
:table,
|
table: true,
|
||||||
:strikethrough,
|
strikethrough: true,
|
||||||
:tagfilter,
|
tagfilter: true,
|
||||||
:autolink
|
autolink: true,
|
||||||
].freeze,
|
footnotes: true,
|
||||||
|
}.freeze,
|
||||||
|
|
||||||
# https://github.com/gjtorikian/commonmarker#parse-options
|
# https://github.com/gjtorikian/commonmarker#parse-options
|
||||||
commonmarker_parse_options: [
|
commonmarker_parse_options: {
|
||||||
:FOOTNOTES,
|
}.freeze,
|
||||||
:STRIKETHROUGH_DOUBLE_TILDE,
|
|
||||||
:UNSAFE,
|
|
||||||
:VALIDATE_UTF8
|
|
||||||
].freeze,
|
|
||||||
|
|
||||||
# https://github.com/gjtorikian/commonmarker#render-options
|
# https://github.com/gjtorikian/commonmarker#render-options
|
||||||
commonmarker_render_options: [
|
commonmarker_render_options: {
|
||||||
:UNSAFE
|
unsafe: true
|
||||||
],
|
},
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
if Redmine::Configuration['common_mark_enable_hardbreaks'] == true
|
if Redmine::Configuration['common_mark_enable_hardbreaks'] == true
|
||||||
PIPELINE_CONFIG[:commonmarker_render_options].push(:HARDBREAKS)
|
PIPELINE_CONFIG[:commonmarker_render_options].merge!({hardbreaks: true})
|
||||||
end
|
end
|
||||||
PIPELINE_CONFIG[:commonmarker_render_options].freeze
|
PIPELINE_CONFIG[:commonmarker_render_options].freeze
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,12 @@ module Redmine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def call
|
def call
|
||||||
doc = CommonMarker.render_doc(@text, parse_options, extensions)
|
html = Commonmarker.to_html(@text, options: {
|
||||||
html = doc.to_html render_options, extensions
|
extension: extensions,
|
||||||
|
render: render_options,
|
||||||
|
parse: parse_options
|
||||||
|
})
|
||||||
|
|
||||||
html.rstrip!
|
html.rstrip!
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
@@ -41,15 +45,15 @@ module Redmine
|
|||||||
private
|
private
|
||||||
|
|
||||||
def extensions
|
def extensions
|
||||||
context.fetch :commonmarker_extensions, []
|
context.fetch :commonmarker_extensions, {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_options
|
def parse_options
|
||||||
context.fetch :commonmarker_parse_options, :DEFAULT
|
context.fetch :commonmarker_parse_options, {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_options
|
def render_options
|
||||||
context.fetch :commonmarker_render_options, :DEFAULT
|
context.fetch :commonmarker_render_options, {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::ApplicationHelperTest < Redmine::HelperTest
|
class Redmine::WikiFormatting::CommonMark::ApplicationHelperTest < Redmine::HelperTest
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
|
|
||||||
include ERB::Util
|
include ERB::Util
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
require 'redmine/wiki_formatting/common_mark/external_links_filter'
|
require 'redmine/wiki_formatting/common_mark/external_links_filter'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::ExternalLinksFilterTest < ActiveSupport::TestCase
|
class Redmine::WikiFormatting::CommonMark::ExternalLinksFilterTest < ActiveSupport::TestCase
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
require 'redmine/wiki_formatting/common_mark/fixup_auto_links_filter'
|
require 'redmine/wiki_formatting/common_mark/fixup_auto_links_filter'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::FixupAutoLinksFilterTest < ActiveSupport::TestCase
|
class Redmine::WikiFormatting::CommonMark::FixupAutoLinksFilterTest < ActiveSupport::TestCase
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::FormatterTest < ActionView::TestCase
|
class Redmine::WikiFormatting::CommonMark::FormatterTest < ActionView::TestCase
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@formatter = Redmine::WikiFormatting::CommonMark::Formatter
|
@formatter = Redmine::WikiFormatting::CommonMark::Formatter
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
require 'redmine/wiki_formatting/common_mark/markdown_filter'
|
require 'redmine/wiki_formatting/common_mark/markdown_filter'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::MarkdownFilterTest < ActiveSupport::TestCase
|
class Redmine::WikiFormatting::CommonMark::MarkdownFilterTest < ActiveSupport::TestCase
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
|
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
require 'redmine/wiki_formatting/common_mark/sanitization_filter'
|
require 'redmine/wiki_formatting/common_mark/sanitization_filter'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::SanitizationFilterTest < ActiveSupport::TestCase
|
class Redmine::WikiFormatting::CommonMark::SanitizationFilterTest < ActiveSupport::TestCase
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
require_relative '../../../../../test_helper'
|
require_relative '../../../../../test_helper'
|
||||||
if Object.const_defined?(:CommonMarker)
|
if Object.const_defined?(:Commonmarker)
|
||||||
require 'redmine/wiki_formatting/common_mark/syntax_highlight_filter'
|
require 'redmine/wiki_formatting/common_mark/syntax_highlight_filter'
|
||||||
|
|
||||||
class Redmine::WikiFormatting::CommonMark::SyntaxHighlightFilterTest < ActiveSupport::TestCase
|
class Redmine::WikiFormatting::CommonMark::SyntaxHighlightFilterTest < ActiveSupport::TestCase
|
||||||
|
|||||||
Reference in New Issue
Block a user