1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 19:47:14 +00:00

Reverts r23190-r23187 because the CI build fails with error "ERROR: Failed to build gem native extension" (#40197).

git-svn-id: https://svn.redmine.org/redmine/trunk@23197 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2024-11-03 18:34:06 +00:00
parent 5802c68ffe
commit 39401e4b95
12 changed files with 35 additions and 39 deletions

View File

@ -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

View 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

View 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

View 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,

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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