Skip to content
代码片段 群组 项目
提交 51f8cab8 编辑于 作者: Brett Walker's avatar Brett Walker
浏览文件

Remove the markdown_corrected_blockquote

feature flag

Changelog: changed
上级 735fc66e
No related branches found
No related tags found
无相关合并请求
---
name: markdown_corrected_blockquote
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/95967
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372089
milestone: '15.4'
type: development
group: group::project management
default_enabled: false
...@@ -34,44 +34,13 @@ class BlockquoteFenceFilter < HTML::Pipeline::TextFilter ...@@ -34,44 +34,13 @@ class BlockquoteFenceFilter < HTML::Pipeline::TextFilter
) )
}mx.freeze }mx.freeze
OLD_REGEX = %r{
#{::Gitlab::Regex.markdown_code_or_html_blocks}
|
(?=^>>>\ *\n.*\n>>>\ *$)(?:
# Blockquote:
# >>>
# Anything, including code and HTML blocks
# >>>
^>>>\ *\n
(?<quote>
(?:
# Any character that doesn't introduce a code or HTML block
(?!
^```
|
^<[^>]+?>\ *\n
)
.
|
# A code block
\g<code>
|
# An HTML block
\g<html>
)+?
)
\n>>>\ *$
)
}mx.freeze
def initialize(text, context = nil, result = nil) def initialize(text, context = nil, result = nil)
super text, context, result super text, context, result
@text = @text.delete("\r") @text = @text.delete("\r")
end end
def call def call
@text.gsub(regex) do @text.gsub(REGEX) do
if $~[:quote] if $~[:quote]
# keep the same number of source lines/positions by replacing the # keep the same number of source lines/positions by replacing the
# fence lines with newlines # fence lines with newlines
...@@ -81,12 +50,6 @@ def call ...@@ -81,12 +50,6 @@ def call
end end
end end
end end
private
def regex
Feature.enabled?(:markdown_corrected_blockquote) ? REGEX : OLD_REGEX
end
end end
end end
end end
...@@ -22,14 +22,6 @@ ...@@ -22,14 +22,6 @@
expect(filter(">>> \ntest\n>>> ")).to eq("\n> test\n") expect(filter(">>> \ntest\n>>> ")).to eq("\n> test\n")
end end
context 'when feature flag is turned off' do
it 'does not require a leading or trailing blank line' do
stub_feature_flags(markdown_corrected_blockquote: false)
expect(filter("Foo\n>>>\ntest\n>>>\nBar")).to eq("Foo\n\n> test\n\nBar")
end
end
context 'when incomplete blockquote fences with multiple blocks are present' do context 'when incomplete blockquote fences with multiple blocks are present' do
it 'does not raise timeout error' do it 'does not raise timeout error' do
test_string = ">>>#{"\n```\nfoo\n```" * 20}" test_string = ">>>#{"\n```\nfoo\n```" * 20}"
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册