]> source.dussan.org Git - redmine.git/commitdiff
Reverts r23190-r23187 because the CI build fails with error "ERROR: Failed to build...
authorMarius Balteanu <marius.balteanu@zitec.com>
Sun, 3 Nov 2024 18:34:06 +0000 (18:34 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sun, 3 Nov 2024 18:34:06 +0000 (18:34 +0000)
git-svn-id: https://svn.redmine.org/redmine/trunk@23197 e93f8b46-1217-0410-a6f0-8f06a7374b81

12 files changed:
Gemfile
lib/redmine.rb
lib/redmine/preparation.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 f8847b789ca6f195541d33c41c0d789d627de919..0dda8f0d3caa91c29bd627f867c6f3cf59c0f001 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -46,7 +46,7 @@ end
 
 # Optional CommonMark support, not for JRuby
 group :common_mark do
-  gem "commonmarker", '~> 1.1.0'
+  gem "commonmarker", '~> 0.23.8'
   gem 'deckar01-task_list', '2.3.2'
 end
 
index 95b3b7f3fac1c7b997d33eff4e0acf14402da069..2edfa55e9d8d40bc84997bf43cf5ff81c39a10ab 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 822662e11fb1095ac6f6b8d83fb76528b4afdf71..1aeb81e46bed7e1274deab597e46d5a47749e990 100644 (file)
@@ -408,7 +408,7 @@ module Redmine
 
       WikiFormatting.map do |format|
         format.register :textile
-        if Object.const_defined?(:Commonmarker)
+        if Object.const_defined?(:CommonMarker)
           format.register :common_mark, label: 'CommonMark Markdown (GitHub Flavored)'
         end
       end
index 2eee19fa3845004e59531bf74051d647a42b39cc..42cae4f3ae4081282ad752a1995fe78b9119859f 100644 (file)
@@ -26,28 +26,32 @@ module Redmine
       # configuration of the rendering pipeline
       PIPELINE_CONFIG = {
         # https://github.com/gjtorikian/commonmarker#extension-options
-        commonmarker_extensions: {
-          table: true,
-          strikethrough: true,
-          tagfilter: true,
-          autolink: true,
-          footnotes: true,
-        }.freeze,
+        commonmarker_extensions: [
+          :table,
+          :strikethrough,
+          :tagfilter,
+          :autolink
+        ].freeze,
 
         # https://github.com/gjtorikian/commonmarker#parse-options
-        commonmarker_parse_options: {
-        }.freeze,
+        commonmarker_parse_options: [
+          :FOOTNOTES,
+          :STRIKETHROUGH_DOUBLE_TILDE,
+          :UNSAFE,
+          :VALIDATE_UTF8
+        ].freeze,
 
         # https://github.com/gjtorikian/commonmarker#render-options
-        commonmarker_render_options: {
-          unsafe: true,
-          hardbreaks: Redmine::Configuration['common_mark_enable_hardbreaks'] == true ? true : false,
-        }.freeze,
-        commonmarker_plugins: {
-          syntax_highlighter: nil
-        }.freeze,
+        commonmarker_render_options: [
+          :UNSAFE
+        ],
       }.freeze
 
+      if Redmine::Configuration['common_mark_enable_hardbreaks'] == true
+        PIPELINE_CONFIG[:commonmarker_render_options].push(:HARDBREAKS)
+      end
+      PIPELINE_CONFIG[:commonmarker_render_options].freeze
+
       MarkdownPipeline = HTML::Pipeline.new [
         MarkdownFilter,
         SanitizationFilter,
index 0b7f52ea3b5cba92b63b3969d9dcea7af0527aba..916c8883c4e339fdd4340eb57982172d9109817c 100644 (file)
@@ -32,12 +32,8 @@ module Redmine
         end
 
         def call
-          html = Commonmarker.to_html(@text, options: {
-            extension: extensions,
-            render: render_options,
-            parse: parse_options
-          }, plugins: plugins )
-
+          doc = CommonMarker.render_doc(@text, parse_options, extensions)
+          html = doc.to_html render_options, extensions
           html.rstrip!
           html
         end
@@ -45,19 +41,15 @@ module Redmine
         private
 
         def extensions
-          context.fetch :commonmarker_extensions, {}
+          context.fetch :commonmarker_extensions, []
         end
 
         def parse_options
-          context.fetch :commonmarker_parse_options, {}
+          context.fetch :commonmarker_parse_options, :DEFAULT
         end
 
         def render_options
-          context.fetch :commonmarker_render_options, {}
-        end
-
-        def plugins
-          context.fetch :commonmarker_plugins, {}
+          context.fetch :commonmarker_render_options, :DEFAULT
         end
       end
     end
index 46057f132da5674d61044ef449d3f08b3942e88c..7b5915f7db9767f62092dc097f74915b9be87912 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 cde6381b8a599c53979e8f58e96448322c489c7d..179ff9bbfe3b14c89b145484e5ddfc031dcaf242 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 1b093d71861eadf639401b1f85bfef3e79be2783..2ed04df8f6bc0746f184ec73e4245d352c159b83 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 5214a1e0072861801df350a36671e60a3238106c..f7ffb3e9764de6db96f1c1cac54881339d9a2375 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 d5e416d2c443739df34c07b64dbb1a852820fdf4..374705423c13a8d12c25e7d38c42a95821c037cf 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 4c0282f2d4af83b0adc8213dac592250827d348f..d3956e8026d9df6e4bb4712842872f4b47858cc7 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 70cc953017948de6b3f2d82f50f0d92855a5a59a..630d9a27332eb1bd387a66ed54d380372f1434f2 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