]> source.dussan.org Git - redmine.git/commitdiff
Updates commonmark gem version to 1.1.5 which switches from libcmark-gfm to comrak...
authorMarius Balteanu <marius.balteanu@zitec.com>
Mon, 11 Nov 2024 18:28:41 +0000 (18:28 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Mon, 11 Nov 2024 18:28:41 +0000 (18:28 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@23247 e93f8b46-1217-0410-a6f0-8f06a7374b81

Gemfile
lib/redmine.rb
lib/redmine/wiki_formatting/common_mark/formatter.rb
lib/redmine/wiki_formatting/common_mark/markdown_filter.rb
test/unit/lib/redmine/wiki_formatting/common_mark/application_helper_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/external_links_filter_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/fixup_auto_links_filter_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/markdown_filter_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/sanitization_filter_test.rb
test/unit/lib/redmine/wiki_formatting/common_mark/syntax_highlight_filter_test.rb

diff --git a/Gemfile b/Gemfile
index 1737bc0af4ebccf65df29f9ea83a4a3ac55d6973..1afed558d6d8df186e7ffa318a994f72e92c3550 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -46,7 +46,7 @@ end
 
 # Optional CommonMark support, not for JRuby
 group :common_mark do
-  gem "commonmarker", '~> 0.23.8'
+  gem "commonmarker", '~> 1.1.0'
   gem 'deckar01-task_list', '2.3.2'
 end
 
index 2edfa55e9d8d40bc84997bf43cf5ff81c39a10ab..95b3b7f3fac1c7b997d33eff4e0acf14402da069 100644 (file)
@@ -25,7 +25,7 @@ rescue LoadError
   # MiniMagick is not available
 end
 begin
-  require 'commonmarker' unless Object.const_defined?(:CommonMarker)
+  require 'commonmarker' unless Object.const_defined?(:Commonmarker)
 rescue LoadError
   # CommonMarker is not available
 end
index 42cae4f3ae4081282ad752a1995fe78b9119859f..4a0a7ec53c19b9a501cdbb4e1727c89d6cbb3718 100644 (file)
@@ -26,29 +26,26 @@ module Redmine
       # configuration of the rendering pipeline
       PIPELINE_CONFIG = {
         # https://github.com/gjtorikian/commonmarker#extension-options
-        commonmarker_extensions: [
-          :table,
-          :strikethrough,
-          :tagfilter,
-          :autolink
-        ].freeze,
+        commonmarker_extensions: {
+          table: true,
+          strikethrough: true,
+          tagfilter: true,
+          autolink: true,
+          footnotes: true,
+        }.freeze,
 
         # https://github.com/gjtorikian/commonmarker#parse-options
-        commonmarker_parse_options: [
-          :FOOTNOTES,
-          :STRIKETHROUGH_DOUBLE_TILDE,
-          :UNSAFE,
-          :VALIDATE_UTF8
-        ].freeze,
+        commonmarker_parse_options: {
+        }.freeze,
 
         # https://github.com/gjtorikian/commonmarker#render-options
-        commonmarker_render_options: [
-          :UNSAFE
-        ],
+        commonmarker_render_options: {
+          unsafe: true
+        },
       }.freeze
 
       if Redmine::Configuration['common_mark_enable_hardbreaks'] == true
-        PIPELINE_CONFIG[:commonmarker_render_options].push(:HARDBREAKS)
+        PIPELINE_CONFIG[:commonmarker_render_options].merge!({hardbreaks: true})
       end
       PIPELINE_CONFIG[:commonmarker_render_options].freeze
 
index 916c8883c4e339fdd4340eb57982172d9109817c..abde254434912b7c81f6896ea1417025e16275aa 100644 (file)
@@ -32,8 +32,12 @@ module Redmine
         end
 
         def call
-          doc = CommonMarker.render_doc(@text, parse_options, extensions)
-          html = doc.to_html render_options, extensions
+          html = Commonmarker.to_html(@text, options: {
+            extension: extensions,
+            render: render_options,
+            parse: parse_options
+          })
+
           html.rstrip!
           html
         end
@@ -41,15 +45,15 @@ module Redmine
         private
 
         def extensions
-          context.fetch :commonmarker_extensions, []
+          context.fetch :commonmarker_extensions, {}
         end
 
         def parse_options
-          context.fetch :commonmarker_parse_options, :DEFAULT
+          context.fetch :commonmarker_parse_options, {}
         end
 
         def render_options
-          context.fetch :commonmarker_render_options, :DEFAULT
+          context.fetch :commonmarker_render_options, {}
         end
       end
     end
index 7b5915f7db9767f62092dc097f74915b9be87912..46057f132da5674d61044ef449d3f08b3942e88c 100644 (file)
@@ -20,7 +20,7 @@
 require_relative '../../../../../test_helper'
 
 class Redmine::WikiFormatting::CommonMark::ApplicationHelperTest < Redmine::HelperTest
-  if Object.const_defined?(:CommonMarker)
+  if Object.const_defined?(:Commonmarker)
 
     include ERB::Util
 
index 179ff9bbfe3b14c89b145484e5ddfc031dcaf242..cde6381b8a599c53979e8f58e96448322c489c7d 100644 (file)
@@ -19,7 +19,7 @@
 
 require_relative '../../../../../test_helper'
 
-if Object.const_defined?(:CommonMarker)
+if Object.const_defined?(:Commonmarker)
   require 'redmine/wiki_formatting/common_mark/external_links_filter'
 
   class Redmine::WikiFormatting::CommonMark::ExternalLinksFilterTest < ActiveSupport::TestCase
index 2ed04df8f6bc0746f184ec73e4245d352c159b83..1b093d71861eadf639401b1f85bfef3e79be2783 100644 (file)
@@ -19,7 +19,7 @@
 
 require_relative '../../../../../test_helper'
 
-if Object.const_defined?(:CommonMarker)
+if Object.const_defined?(:Commonmarker)
   require 'redmine/wiki_formatting/common_mark/fixup_auto_links_filter'
 
   class Redmine::WikiFormatting::CommonMark::FixupAutoLinksFilterTest < ActiveSupport::TestCase
index f7ffb3e9764de6db96f1c1cac54881339d9a2375..5214a1e0072861801df350a36671e60a3238106c 100644 (file)
@@ -20,7 +20,7 @@
 require_relative '../../../../../test_helper'
 
 class Redmine::WikiFormatting::CommonMark::FormatterTest < ActionView::TestCase
-  if Object.const_defined?(:CommonMarker)
+  if Object.const_defined?(:Commonmarker)
 
     def setup
       @formatter = Redmine::WikiFormatting::CommonMark::Formatter
index 374705423c13a8d12c25e7d38c42a95821c037cf..d5e416d2c443739df34c07b64dbb1a852820fdf4 100644 (file)
@@ -19,7 +19,7 @@
 
 require_relative '../../../../../test_helper'
 
-if Object.const_defined?(:CommonMarker)
+if Object.const_defined?(:Commonmarker)
   require 'redmine/wiki_formatting/common_mark/markdown_filter'
 
   class Redmine::WikiFormatting::CommonMark::MarkdownFilterTest < ActiveSupport::TestCase
index d3956e8026d9df6e4bb4712842872f4b47858cc7..4c0282f2d4af83b0adc8213dac592250827d348f 100644 (file)
@@ -19,7 +19,7 @@
 
 require_relative '../../../../../test_helper'
 
-if Object.const_defined?(:CommonMarker)
+if Object.const_defined?(:Commonmarker)
   require 'redmine/wiki_formatting/common_mark/sanitization_filter'
 
   class Redmine::WikiFormatting::CommonMark::SanitizationFilterTest < ActiveSupport::TestCase
index 630d9a27332eb1bd387a66ed54d380372f1434f2..70cc953017948de6b3f2d82f50f0d92855a5a59a 100644 (file)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 require_relative '../../../../../test_helper'
-if Object.const_defined?(:CommonMarker)
+if Object.const_defined?(:Commonmarker)
   require 'redmine/wiki_formatting/common_mark/syntax_highlight_filter'
 
   class Redmine::WikiFormatting::CommonMark::SyntaxHighlightFilterTest < ActiveSupport::TestCase